Giter VIP home page Giter VIP logo

underdesign / psychophysics Goto Github PK

View Code? Open in Web Editor NEW

This project forked from crowding/psychophysics

0.0 2.0 0.0 165.07 MB

Event-driven framework for psychophysical and oculomotor experiments

R 0.20% MATLAB 58.22% M 0.91% Limbo 0.01% Objective-C 0.07% Makefile 4.14% C 17.20% C++ 7.52% Shell 6.46% M4 0.39% Roff 0.03% HTML 2.87% Python 1.54% CSS 0.04% XSLT 0.12% Batchfile 0.04% TeX 0.25% Mathematica 0.01% Inno Setup 0.01%

psychophysics's Introduction

Matlab psychophysics code

Peter Meilstrup

This repository collects code I used in experiment control and development of visual illusions and demos.

It contains a high-level, event-driven framework for psychophysical and oculomotor experimentation, built above the Psychtoolbox, and various experiments built on top of that.

It is poorly organized because <reasons> (it is approximately as well organized as can be expected given the pressures it was developed under.)

It includes an older version of Psychtoolbox, compiled in 32-bit mode, which is not compatible with MATLAB versions newer than 2010b. I haven't tried upgrading the version of PTB (and no longer have a legal MATLAB license to work with) so I don't know how hard that will be.

Installation

In MATLAB, change the working directory to the root of this repository and type startup.

Try running ConcentricDemo and try pressing the keys indicated.

DemoNight and VortexDemo show illusions I presented at VSS in 2010.

See the file code/demos/AdjustableDemo.m to see how this responsiveness is implemented.

It probably won't work straight away. Contact me over email or Github for help.

Roadmap

code contains all MATLAB code used to perform my experiments.

  • code/defaults contains some mechanism to configure system-wide defaults (class variable default values etc.) to suit particular experiment rigs. Getting this library running on a new rig probably means writing a new defaults file.

  • code/experiments concerns implementation of entire experiments.

    • JumpyRectangle.m API demo: when used with an Eyelink draws random rectangles anywhere except where you're looking.
    • Experiment.m is an object that can be configured to run various constant-stimuli and adaptive psychophysics routines. Most other files in this directory start by configuring an Experiment object with parameter sets, blocking, staircase handlers and so on. Experiment.m also arranges for the logging of whatever goes on in an experiment (for code that parses the log files, see [https://github.com/crowding/logfile-reader].
    • Experiment 1 of my thesis is done in ConcentricDirectionDiscriminabilityCritDistance.m, which builds an Experiment object around the trial object implemented in ConcentricTrial.m.
    • Experiment 2 is done in ConcentricDirectionSegment.m.
    • ConcentricOculomotor.m runs a related experiment that used oculomotor pursuit as the response modality, allowing humans and monkeys to run on the same task.
    • CalibrateEyes.m and EyeCalibration.m implement an eye tracker calibration routine that runs without operator intervention. I usually placed these at the start of blocks in my experiments.
  • code/events contains the event-driven sort of framework for constructing psychophysics experiments.

    • mainloop.m is the heart of it. It is the main graphics loop, which centralizes the responsibility of being very picky about vblank timing and detecting frame drops. For each drawn frame it swaps buffers, calls handlers to draw graphics objects, calls more handlers to collect input data, and calls other handlers to respond to inpus and advance the experiment's state. Typically each trial of an experiment constructs a MainLoop object, populates it with input handlers, graphics objects and output handlers, and calls mainLoop.go().
    • Trigger.m is a trigger manager used for adding and removing input-conditional triggers, and logging the firing of triggers.Typically an experiment trial adds Trigger as one of its event handlers. For example, I enforce fixation by first adding a circularwindowEnter to the trigger object to detect fixation, using the callback from that to start the trial, and then adding a circularWindowExit condition to the trigger object.
    • Most other files in events are helpers to use with Trigger and MainLoop.
    • For an example, of how event-driven programming builds a psychophysics experiment, see code/experiments/ConcentricTrial.m.
  • code/infrastructure contains some implementation of reference-valued objects for MATLAB (to explain this much of which was written before reference objects were added to MATLAB).

    • unittest contains a rather useful unit testing framework for Matlab. See TestCase.m and other test cases implemented in various test directories.
    • require.m implements a sort of try...finally or unwind-protect and is essential for experiments that talk to hardware.
  • code/graphics contains various graphic objects you can attach to the main drawing loop.

    • CauchyDrawer.m draws Cauchy wavelets, given a callback that tells it where to draw on each frame.
    • CauchySpritePlayer builds on CauchyDrawer using it to draw motion pulses (taht have a time of appearance, Gaussian temporal window and specified temporal frequency. In turn, it takes a "motion process" to tell it "where" and "when" to place the pulses.
    • CircularCauchyMotion is a motion process used with CauchySpritePlayer that implements the circularly moving animated Gabor wavelets I used as stimuli in my disseration.
  • code/analysis contains some data analysis routines but I eventually decided to move analysis of particular experiments to separate repositories (and mostly write it in R instead of Matlab.) *MarkSaccades is a useful routine for detecting saccades in eye position data.

  • code/old_graphics contains some code that I used in early days before writing the event-driven framework. Most is dead except for the Calibration data structure which is still used.

    • @calibration/calibrate.m is a routine to linearize a gamma curve for gray-background experiments, using a photometer connected to the serial port.
  • code/input contains input drivers for the event-driven framework:

    • AudioInput.m wraps the Psychtoolbox audio recording facilities.
    • EyelinkInput.m streams data from Eyelink series eyetrackers, wrapping the EyelinkToolbox libraries.
    • TrackpadInput allows you do do some nifty things with non-multitouch trackpads from some old. model of Mac laptop. See code/demos/TrackpadTheremin for an application.
    • LabJackInput.m integrates the LabJack UE9 as used in my physiology rig (to produce a TTL_reward signal, record analog eye trackign signals and verify VSYNC and frame counts
    • PowermateInput.m receives events from the PowerMate knob controller.
  • code/resources similarly contains event-driven output drivers and hardware interfacing..

    • AudioOutput.m contains a driver that manages playing sound samples during experiments.
    • LabJackUE9.m is a relatively complete object that controls the LabJack UE9 data acquisition device from Matlab.
  • library contains an archive of some libraries I used in configuring experimental rigs.

psychophysics's People

Contributors

crowding avatar

Watchers

 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.