Comments (13)
Hi!
that function does not take pupilz
as an input it is either pupil
or gaze
from gazer.
Hello! thanks for the quick response. What if I change the variable name, will the results be correct or by beeing scaled before (with the pupilz method) it will create bad results ?
from gazer.
Sorry but now by checking the functions in the code section I am a little bit confused. If I made the pupilz convertion in the re-scaling section, what parameter should I be putting in the pup_missing, pup_outliers and mad_removal ?? sorry if it is clearer but I can't figure it out , this is that section of the code :
timebinsz <- baseline_pupil %>%
group_by(subject, trial) %>%
mutate(pupilz= scale(pup_interp)) %>% ungroup()
pup_missing<-count_missing_pupil(timebinsz, pupil="pupilz", missingthresh = .2)
puphist <- ggplot(timebinsz, aes(x = pupilz)) +
geom_histogram(aes(y = ..count..), colour = 'green', binwidth = 0.001) +
geom_vline(xintercept = -4, linetype = 'dotted') +
geom_vline(xintercept = 4, linetype = 'dotted') +
xlab('Pupil Size') +
ylab('Count') +
theme_bw()
pup_outliers <- pup_missing %>%
filter(pupilz >= number, pupilz <= number2)
mad_removal <- pup_outliers %>%
group_by(subject, trial) %>%
mutate(speed = speed_pupil(pupilz, time)) %>%
mutate(MAD = calc_mad(speed, n = 16)) %>%
filter(speed < MAD)
Tanks a lot for any help possible !
from gazer.
Change pupilz
to pupil
and it should work. Gazer requires columns to be named appropriately to work with certain functions.
from gazer.
Just to be clear here type="pupilz" is not correct as the type is either pupil or gaze. It is not asking for a column name
from gazer.
So, the pupilz created should not be used as a replacement of pupil in the next steps ? That is the part I am confused about.
from gazer.
from gazer.
Ok, I think I understand, thank you. Last question, in case I used the timbinz to create the pupilz variable, should I run the baseline_correction_pupil_msg function with pupil_colname= 'pupilz' instead of pupil_colname= 'pup_interp' ?
Or does the pupilz became just a replacement for the pupil variable? , so in the code when you use pupil I should be using pupilz instead but when you are using pup_interp and baselinecorrectedp continue using those?
from gazer.
In those functions, your pupilz would be changed to pup_interp in the function
baseline <- event_time %>%
dplyr::group_by(subject, trial) %>%
dplyr::filter(time >= event_offset_time - baseline_dur,
time <= event_offset_time) %>%
_**dplyr::rename(pupil_avg = pupil_colname) %>%**_
dplyr::summarise(baseline = median(pupil_avg, na.rm=TRUE)) %>%
dplyr::full_join(., datafile) %>%
dplyr::ungroup()
message("Merging baseline")
message("Performing median divisive baseline correction")
corrected_baseline <- baseline %>%
dplyr::rename(pupil_avg = pupil_colname) %>%
dplyr::mutate(baselinecorrectedp = (pupil_avg - baseline)/baseline) %>%
_**dplyr::rename(pup_interp = pupil_avg) %>%**_
dplyr::arrange(subject, trial, time)
for instance here whatever you specified as pupil_colname in the baseline_correction function will be changed to pupil_avg and then to pupil_interp in the function. (the pupil_interp variable created is interpolated with your z score var). You should be able to carry on without changing the defaults.
from gazer.
My suggestion would be to take your pupilz column and change it to pupil and run the pipeline on that
from gazer.
Thank you very much for your help and the gazeR package !
from gazer.
Hi @jgeller112 , I'm working with @vicentemunozlh. I think there are two questions in this Issue.
First, regarding the use of type=pupilz
in downsample_gaze
function. We got that available types are either gaze
or pupil
only.
Second, provided the application of baseline_correction_pupil
or baseline_correction_pupil_msg
, the generated data frame, let us say baseline_pupil
as in the paper, includes a new variable called baselinecorrectedp
. Thus, if Re-scaling is applied, it is correct to apply the scale
function to the variable baselinecorrectedp
?
Our question is rooted in the fact the data frame timebinz
(in page 2248 of Geller, Winn, Mahr and Mirman (2020)) is created by scaling the variable baseline_pupil$pup_interp
instead of baseline_pupil$baselinecorrectedp
. Thus, we need to be sure if a re-scale like:
timebinz<- baseline_pupil %>%
group_by(subject,trial) %>%
mutate(pupilz = scale(baselinecorrectedp))
is correct or not.
We have a similar question regarding the application of Artifact rejection through MAD since you use pup_interp
variable instead of baselinecorrectedp
. Should we use also baselinecorrectedp
in the creation of the data frame mad_removal
? That is,
mad_removal<- pup_outliers %>%
group_by(subject,trial) %>%
mutate(speed = speed_pupil(baselinecorrectedp, time)) %>%
mutate(MAD=calc_mad(speed, n=16)) %>%
filter(speed < MAD)
Note that we use time
instead of time_zero
in the call to speed_pupil
since we believe it is a typo.
from gazer.
First, regarding the use of type=pupilz in downsample_gaze function. We got that available types are either gaze or pupilonly.
As I said, this is an argument function and not where you put your pupil variable name. This function assumes your pupil variable is called baselinecorrectedp
The paper assumes you have used gazeR consistent names
timebinz<- baseline_pupil %>%
group_by(subject,trial) %>%
mutate(pupilz = scale(baselinecorrectedp))
Call pupilz (baselinecorrectedp) so it is consistent with gazeR names and carry one with preprocessing .
Note that we use time instead of time_zero in the call to speed_pupil since we believe it is a typo.
Yep! Here is most up-to-date paper with corrections: https://psyarxiv.com/4qwr8/
mad_removal<- pup_outliers %>%
group_by(subject,trial) %>%
mutate(speed = speed_pupil(baselinecorrectedp, time)) %>%
mutate(MAD=calc_mad(speed, n=16)) %>%
filter(speed < MAD)
I performed this correction on non-baseline corrected data (pup_interp). I guess it could be done on the baseline corrected pupil column as well. In the MAD pupil paper (https://d-nb.info/1167304861/34) it was done on non-baselined data.
from gazer.
Related Issues (20)
- GazeR functions exceed my working space limit: how to downsample HOT 12
- Can GazeR process datasets of the task which is implemented using MATLAB? HOT 2
- parse_edf function deletes message entries on the way HOT 3
- Cannot either install or download the GazeR package(s) HOT 11
- parse_edf function creates more trials than actually present HOT 11
- unable to use edfR HOT 14
- blink velocity hz? HOT 14
- Downsample XY for Pupil
- sample_message to message not updated in merge_pupil HOT 1
- unable to install saccades and edfR HOT 15
- Baseline correction problem HOT 5
- Loading edfs on Code Ocean HOT 28
- Read pupil data from excel HOT 7
- Error when running dplyr::gather HOT 2
- issues edfR HOT 14
- error using the downsample_gaze function HOT 5
- Accommodating data timebinned in Eyelink HOT 2
- Can GazeR analyze eye movement data in virtual reality environments? HOT 10
- How to find the peak pupil size and a possible bug in remove missing data? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gazer.