Giter Club home page Giter Club logo

dp-copydraw's Introduction

Dareplane CopyDraw module

This repo contains the python implementation of the copy draw recording and analysis pipeline

Config

Configuration files are stored under ./configs

Testing

You should be able to test a single run with This

python -m copydraw.main 

--> If this is not working, something is still odd in the setup

Calibration

Some calibration of scaling an shifting of the trace might be necessary, depending on the aspect ratio which is being used for the copydraw psychopy window. This is due to the trace being displayed as a png background image instead of rendering it as a psychopy trace. We had to resort to this in order to keep up a higher frame rate of recording (usually > 80hz) It is best to check the calibration by running this:

python -m copydraw.main --for_calibration=True

Should the traces and control points be non overlapping, you have three places to adjust:

  1. in copydraw/elements.py
    'template': {
        'units': 'norm',
        'pos': (-0.0, 0.01),
        'interpolate': True,
    }

The 'pos' parameter can be used for translations.

  1. in copydraw/copydraw.py
    def create_frame(self, stimuli_idx, scale=True, for_calibration: bool = False):

        self.frame['elements'] = {}
        self.frame['elements']['template'] = create_element(
            'template',
            win=self.win,
            image=template_to_image(
                self.get_stimuli(stimuli_idx, scale=scale),
                f'{self.stimuli["fname"][:-4]}_{stimuli_idx}',
                self.paths['data'].joinpath('template_images'),
                linewidth=15,
                for_calibration=for_calibration,
            ),
            size=self.block_settings['size'] * 1.67,
        )

Here the size parameter is used for an isometric scaling of the picture.

  1. in copydraw/utils/template_tools.py
def template_to_image(template, fname, path, for_calibration: bool = False,
                      scale: float = 1, **kwargs):

    # if template images dir doesn't exists make it
    path = Path(path)
    path.mkdir(exist_ok=True, parents=True)

    fullpath = path.joinpath(f'{fname}.png')

    if not fullpath.exists():
        # fig = plt.figure(figsize=(16, 10))
        fig = plt.figure(figsize=(16, 9), frameon=False)

Here you can adjust the figsize according to the target screen.

Server

Like for other Dareplane modules, one can manually spawn the server via

python -m api.server

and after connecting e.g. via telnet 127.0.0.1 8080, try sending a START_BLOCK to run a single block of copydraw.

Installation Windows

Use anaconda, normal python interpreter under windows will require tons of extra set up due to some libraries not being properly compiled for windows.

  1. conda create --name copydraw python=3.9
  2. conda activate copydraw
  3. conda install -c conda-forge pywinhook
  4. install the rest of the dependancies using pip install -r requirements.txt from the root of this repository
    • it's possible there are dependancy conflicts because of different versions, just loosen them up by replacing library=2.0 to library>=1.5 so that the version conflict is resolved.
  5. Download this, install the driver from the win32 folder and copy inpoutx64.dll from the x64 folder to C:\Windows\System32

problems with Pyo?

dp-copydraw's People

Contributors

matthiasdold avatar

Watchers

Sebastián Castaño-Candamil avatar Andreas Meinel avatar Michael Tangermann avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.