Giter Club home page Giter Club logo

Comments (13)

jgeller112 avatar jgeller112 commented on August 29, 2024

Hi!

that function does not take pupilz as an input it is either pupil or gaze

from gazer.

vicentemunozlh avatar vicentemunozlh commented on August 29, 2024

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.

vicentemunozlh avatar vicentemunozlh commented on August 29, 2024

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.

jgeller112 avatar jgeller112 commented on August 29, 2024

Change pupilz to pupil and it should work. Gazer requires columns to be named appropriately to work with certain functions.

from gazer.

jgeller112 avatar jgeller112 commented on August 29, 2024

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.

vicentemunozlh avatar vicentemunozlh commented on August 29, 2024

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.

jgeller112 avatar jgeller112 commented on August 29, 2024

from gazer.

vicentemunozlh avatar vicentemunozlh commented on August 29, 2024

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.

jgeller112 avatar jgeller112 commented on August 29, 2024

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.

jgeller112 avatar jgeller112 commented on August 29, 2024

My suggestion would be to take your pupilz column and change it to pupil and run the pipeline on that

from gazer.

vicentemunozlh avatar vicentemunozlh commented on August 29, 2024

Thank you very much for your help and the gazeR package !

from gazer.

sebacea avatar sebacea commented on August 29, 2024

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

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

jgeller112 avatar jgeller112 commented on August 29, 2024

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)

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.