Git Product home page Git Product logo

miykael / pupillometryanalyzer Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 557 KB

The pupillometryAnalyzer script can be used to analyse pupillometry raw data saved in a wks-file. It analyzes the time-series of one or both eyes and creates informative csv- and png-outputs that can be used for further statistical analysis.

License: BSD 3-Clause "New" or "Revised" License

MATLAB 100.00%
python pupillometry

pupillometryanalyzer's Introduction

Pupillometry Analyzer

GitHub issues GitHub pull-requests GitHub contributors GitHub Commits GitHub size GitHub HitCount

This short script can be used to analyse pupillometry raw data saved in a wks-file. It analyzes the timeseries and creates informative figures and saves all relevant information for further analysis in xls-files.

This script runs on MATLAB or Octave. If you use Octave, than you also need the folder sgolay_functions under https://github.com/miykael/pupillometryAnalyzer.

Citation

DOI

If you used Pupillometry Analyzer in your project, please cite as:

Notter, Michael P., & Murray, Micah M. (2017). Pupillometry Analyzer: a lightweight matlab tool to pre-process pupillometry data. Zenodo. http://doi.org/10.5281/zenodo.592386.

How does the script work?

First, it reads the WKS-file and reads out relevant information such as pupil width and marker onset.

Second, it selects only relevant markers (according to the step variables on line 37).

Third, it plots an overview figure (as seen below) that shows pupil width over the whole timecourse. Highlighted in red are the relevant marker onsets.

Forth, it extracts single epochs from the timecourse and transforms the values to percentage signal change. This is done by dividing the time-course of the whole epoch by the average of the pre-stimuli period. Afterwards, the epochs will be plotted as a raw timecourse.

Fifth, all epoch time-courses are inspected and corrected for eye blinks. Eye blinks are defined as periods where the time-course abruptly changes in more than 4% (pupilSpeedThreshold). The stop of the blink period is defined as another abrupt change of at least 4% in the opposite direction, followed by a "non blink period" of at least noBlinkingWindow time points. Those blink periods are then linearly interpolated between their onsets and offsets. Blink corrected figures of the timecourse are created.

Sixth, epoch time-courses are smoothed with MATLAB's Savitzky-Golay function, by using a 3rd order (sgolayOrder) polynomial and a window length of sgolayWindow time-points.

Seventh, amplitude and latency of informative time-points such as drop-point, minima and recovery point àre computed for each epoch. A drop-point is defined as the first time-point where the signal drops for more than two (i.e. stdDropMultiplier) pre-stimuli standard deviation below the stimuli onset amplitude for a duration of at least 1250ms (i.e. 5 times pre-stimuli duration). Minima is defined as the minima of the epoch time-course between 0ms and 3000ms (3 times the refresh rate of your data) after stimuli onset. The recover point represents a time-point of interest at 6000ms (recoveryTime) after stimuli onset. Figures of the smoothed time course with highlighted drop-point and minima are created.

Ninth, all relevant information are saved as outputs into a mat- and an xls-file. Those file can than be used for further analysis.

What do you need to know to start?

All the things you need to change so that the script runs according your case should be within the first 45 lines.

First, make sure that you set experimentPath to the parent folder of your experiment (Don't forget the '' at the end of the path) and specify the path to the wks-files with wksfilepath.

Second, adapt all script relevant variables between line 18-26.

  • pupilSpeedThreshold and noBlinkingWindow are needed to detect and correct for eye blinks. They work as follows: As soon as a timepoint to timepoint pupil dilation differec more than 4% (according to pupilSpeedThreshold), than it is seen as an eyeblink. The end of the eyeblink period is seen as the last eyeblink point after which there are no eyeblink points for 15 timepoints (according to noBlinkingWindow).
  • The "Droppoint" of the epoch timecourse is divined as the point where the timecourse falls for more than 5 pre-interval duration (e.g. 250ms x 5 = 1250ms) below 2 x Standard Deviation (according stdDropMultiplier) of the pre-stimuli timecourse.
  • recoveryTime specifies the timepoint from which amplitude information should be read out and saved into the output xls-file

Third, change the conditions variable according your conditions. The first string in conditions.con1.name specifies the filename string which defines the condition, followed by the individual names of the conditions. The conditions.con1.step array specifies which markers of all recorded markers should be considered as relevant.

pupillometryanalyzer's People

Contributors

miykael avatar

Stargazers

 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.