baseline correction on data recorded by Pupil Core device
I am very new to Series and DataMatrix and I am just starting to learn how to apply preprocessing methods to my pupil size data recorded by the Pupil Core device.
The device gives out pupil size measures in the form of .csv files.
I need to know how to prepare (parse?) my data so that I can apply all the functions to it, such as srs.baseline, smooth, blinkreconstruct, etc.
A gist containing an example of my data is here:
https://gist.github.com/Zahra-on-Github/aa67a3e309fa66582a118f5c08509f77
pupil_positions.csv is my main data, in which pupil size in under the column: diameter_3d
I would appreciate some guidance on how to do the baseline correction as the first step.
Comments
Hi @Zahra ,
In principle, the pupil data is directly plottable as the
diameter_3dcolumn, as you already pointed out. (see below).But the real question is: how is the data segmented, that is, I assume that the
pupil_positions.csvfile corresponds to different trials (?) and that the information about which trial begins where, and which condition each trial is in, is included inannotations.csv. So the first step is conceptual, rather than technical: What kind of data is this? Exactly how is the data structured? Exactly how do you want to analyze the data and what kind of measures do you want to extract?Do you see what I mean? Once you have a clear picture of that, you can start thinking about how to implement the analysis.
— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi @sebastiaan
Thanks a lot for your swift response!
Of course, I see what you mean, and I do have trials and sequences in my data. I just added a sample script to the gist, where I plot each trial and its sequences.
Basically in this recording, I am looking at how changes in stimuli duration, size, contrast and frequency affect the pupil dilation. So, what I want to extract is pupil size (its peaks and the speed of its changes)
Now, at the level of preprocessing, I am trying to figure out how to do baseline correction. I have to do that at the beginning of each trial.
I hope my explanation is clear.
Hi @Zahra ,
You're parsing the data in a way that doesn't fit with the
DataMatrixstyle of representing continuous data asSeriesColumnobjects. This means that you cannot easily use the data-processing functions (includingbaseline()) from the datamatrix.series module.However, doing baseline correction is simple enough to implement it yourself. Say that
dfcorresponds to aDataFramethat contains data for a single trial, and thatdf.diameter_3dis the pupil-size column. And now say that you want to use the first 10 samples of this trial as the baseline. Then you can simply do this as follows:— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Thanks @sebastiaan ,
I applied this to each of my trials and it works.
I have already detected and rejected blinks in my data. Now, I need to compensate for the rejected data. Do you suggest to do something like
blinkreconstruct(), or tointerpolate()?And how do you think it would be applicable to the structure of my data?
- Zahra