Git Product home page Git Product logo

propixx_flicker's Introduction

propixx_flicker

This module provides tools to show frequency-tagged stimuli in Psychopy using a Propixx projector. High-frequency flickering can allow you to measure cortical excitability using rapid frequency tagging. The propixx_flicker module makes it easy to show stimuli that flicker at frequencies up to the 720 Hz.

Background

The Propixx projector allows you to show stimuli in greyscale at a refresh rate of 1440 Hz. Here's how that works. The stimulus-presentation computer sends frames to the projector at 120 Hz. For every screen refresh you send to the projector, the projector shows 12 frames. Images from the stimulus computer are split into 4 quadrants, and information from each RGB channel is treated as a separate image. Your single image will be displayed like this: Red Q1, Red Q2, Red Q3, Red Q4, Green Q1, Green Q2...

Quadrants of the screen are organized like this:

      1  2
      3  4

Frames are selected like this:

for color_channel in (red, green, blue):
    for quadrant in range(4):
        show_data(quadrant, color_channel)

The tools in propixx_flicker make it easy to show flickering stimuli on a Propixx projector without worrying about any of this.

Classes

This module provides three main classes.

  • QuadStim: Show a non-flickering stimulus on the Propixx projector. This takes a single Psychopy stimulus object and duplicates it across the four quadrants of the screen.

  • OpacityFlickerStim: Flicker a Psychopy stimulus object by modulating the opacity of the image.

  • BrightnessFlickerStim: Flicker a Psychopy stimulus object by modulating the brightness of the image.

Extensibility

The classes currently support sinusoidal flickering, but can easily be overridden to show other kinds of flickers. To do that, you would overwrite the _next() method. For example, if you want your stimuli to flicker with a square wave, you could make a new class that inherits from OpacityFlickerStim or BrightnessFlickerStim.

class SquareFlickerStim(BrightnessFlickerStim):
    def _next(self):
        self.phase += self._freq # Update the phase
        self.phase = np.mod(self.phase, 2 * np.pi) # wrap to 2pi
        # Square-wave modulation
        if self.phase <= np.pi:
            opacity = 1.0
        else:
            opacity = 0.0
        return opacity

Example

See minimal_example.py for an example of how to use this module.

Requirements

  • Psychopy 3
  • Propixx projector
  • Matlab and the Datapixx toolbox provided by VPixx. (This is necessary to set the mode of the Propixx projector. VPixx provides a Python toolbox to do this, but it didn't work the last time I checked.)

propixx_flicker's People

Contributors

gbrookshire 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.