Giter Club home page Giter Club logo

gazer's People

Contributors

dmirman avatar jgeller112 avatar mwinn83 avatar roddalben avatar sebacea avatar tamabala avatar tjmahr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

gazer's Issues

Baseline correction problem

I have done all the preprocessing steps, as specified in the paper
But when i try to perform baseline corrections,my output is :
Error: Problem with filter() input ..1. x comparison (1) is possible only for atomic and list types i Input ..1 is message == "target". i The error occurred in group 1: subject = 1, trial = "1". Run rlang::last_error() to see where the error occurred.

This is the commend I use:
baseline_pupil <- baseline_correction_pupil_msg(smooth_interp,
pupil_colname = "pup_interp",
baseline_dur = 50,
event="target",
baseline_method = "sub")

function find_messages_edf() does not work, likely due to mismatch of TRIALID occurrences

I would like to use the function find_messages_edf(), which worked for some of my files. However, when I wanted to process all of them, I get the following error message:

Error: Can't recycle ..1 (size 95) to match ..2 (size 96).

Investigating the files, I found that the csv, which I created earlier in the script from the edf file, contains the expected 96 trials, whereas there are only 95 instances of "TRIALID" in the asc file I created from my edf file (because I cannot read the edf file with a text program). Investigating further, I found that apparently in some of my edf files, the first or last TRIALID-message was not logged. I do not know why this would happen, maybe because I did not hand over the actual number of the trial in my experiment script, so it only loggs "TRIALID", but not the actual number associated with it? The behaviour is odd also because the rest of the trial's messages were logged (e.g. the 96 objects pertaining to the 96 trials are always logged). I could alter the asc files manually (adding an extra line of message with "TRIALID"), to make the function work on my files. However, I do not know of a way to alter edf files. Does anyone have an idea?

problems using the function 'parse_edf'

Dear Dan, or other gazer-professionals,

I would like to use the gazer package, so I have installed the package. However when I run the function 'parse_edf' in R Studio, R (version 3.5.1, but I also tried 3.6.0) for some reason wants to access a package called edfR (by jashubbard).

my command:
parse_edf(file_list = file_list_edf, output_dir = directory_csv_from_edf_conversion, type = "pupil")

R output:
Fehler in library(edfR) : there is no package called ‘edfR’

When I enter 'gazer::parse_edf(...)', the same error message occurs.

I also tried installing the package edfR, but it cannot be compiled for some reason. Before I proceed investigating this compiling problem further, I thought you might have an idea, what is going on in the first place.

Thank you for any advice on how to proceed.

Juliane

assign_aoi function for non-corner AOIs

Hi, I am a beginner in R and in eyetracking data analysis. My stimuli are shown in triangle formation on the screen. I was wondering how I exactly I can add the coordinates to the aoi_loc argument in such cases. In your vignette, it says that "each AOI location should be a separate row in a data frame that has variables xmin, xmax, ymin, and ymax" but I am not sure how that information should be inputted in the code. Also, I am using a webcam-based eyetracker and the coordinates will be different for each participant.

Here are the coordinates for my stimuli:
top --> x = 653, y = 683, width = 230, height = 172
left --> x = 204, y = 9, width = 230, height = 172
right --> x = 1102, y = 9, width = 230, height = 172

Data yielded from one of my participants in a pilot study outputted the following:

top --> x_normalized = 0.400173611, y_normalized = 0.790509259, width_normalized = 0.199652778, height_normalized =
0.199074074
left --> x_normalized = 0.010416667, y_normalized = 0.010416667, width_normalized = 0.199652778, height_normalized =
0.199074074
right --> x_normalized =0.789930556, y_normalized = 0.010416667, width_normalized = 0.199652778, height_normalized =
0.199074074

Thnak you so much! I would appreciate if you could post an example.

error using the downsample_gaze function

Hi! I'm trying to us the downsample_gaze function to downsample pupil data. However, using the downsample_gaze function I stumble upon the following error:

Error in sym(timevar)/bin.length : non-numeric argument to binary operator

If you want to reproduce the error, this error is also present when trying to use the downsample_gaze function in the Pupil Preprocessing vignette. How to solve this?

Downsample XY for Pupil

To downsample XY coordinates you will have to modify the downsample_gaze function

#' This function will combine gaze samples into time bins
#' @param dataframe dataframe
#' @param bin.length Length of time bins
#' @param timevar time column
#' @param aggvars vector of variable names to group by for aggregation
#' @param type pupil for pupil data gaze for gaze data
#' @export
downsample_gaze <- function(dataframe, bin.length = 50, timevar = "time", aggvars = c("subject", "condition", "target", "trial", "object", "timebins"), type="gaze"){
  if(type=="gaze") {
  downsample <- dataframe %>%
    mutate(timebins = round(!!sym(timevar)/bin.length)*bin.length)
  # if there are aggregation variables, then aggregate
  if(length(aggvars > 0)){
    downsample <- downsample %>%
      dplyr::group_by_(.dots = aggvars) %>%
      dplyr::summarize(acc = unique(acc), rt = unique(rt),
                       Fix = mean(Fix) > 0.5) %>%
      dplyr::ungroup()
  }
  return(downsample)
}
  if (type=="pupil") {
    downsample <- dataframe %>%
      mutate(timebins = round(!!sym(timevar)/bin.length)*bin.length)
    # if there are aggregation variables, then aggregate
    if(length(aggvars > 0)){
      downsample <- downsample %>%
        dplyr::group_by(.dots = aggvars) %>%
        dplyr::summarize(aggbaseline=mean(pupilcol, na.rm=TRUE), mean_x=mean(x, na.rm=TRUE), mean_y=mean(y, na.rm=TRUE)) %>% 
        dplyr::ungroup()
    }
  }
  return(downsample)
}

You will probably have to make sure you interpolate the missing gaze values or delete them altogether before aggregating.

GazeR functions exceed my working space limit: how to downsample

Dear GazeR-Team,

I have trouble processing my pupil data with some of the GazeR functions. I run into working space limit problems.

Therefore, I wanted to downsample the files (they have been created with 1000 Hz) to 250 Hz for a start. In the GazeR manual you describe a way to downsample using "downsample_gaze", but for me, this step occurs too late in the script, so that I run into problems beforehand. Do you know, if there is a way to downsample the edf files when they are initially parsed(edf) or imported (csv) into R? Or can I simply use the "downsample_gaze" at an earlier point in the script without messing other things up?

For explanation:
The problem is not so much the reading in of the files, but running the functions following after that, so far: behave_pupil() and baseline_correction_pupil_msg().

I guess I could run these functions on individual files or on only a couple of files. However, I am reluctant to do this, because this means, that I have to run the whole pipeline for an individual file and afterwards concatenate the files, which always creates new sources of errors (I am not that firm with R yet, or the package).

Thank you for your advice,
Juliane

blink velocity hz?

Hi! Happy to see this implemented! I am wondering if "hz=250" on line 34 should be set to "hz=hz"?

mutate(extendpupil=extend_blinks(blinks_pupil, fillback=fillback, fillforward=fillforward, hz=250)) %>%

mutate(extendpupil=extend_blinks(blinks_pupil, fillback=fillback, fillforward=fillforward, hz=hz)) %>%

If not. what is the rational for using a different sample rate for extending blinks?

Moreover, I am wondering if blink extension and interpolation need to be incorporated in this function at all... I find it odd not to give the choice of interpolation type (linear or cubic) or max gap which you have incorporated into the interpolation function.

Best,
Bonnie

function "find_messages_edf()" does not return trial numbers for "TRIALID"

I would like to extract variables from EDF files using the function find_messages_edf(). However, when using the following code (following the paper on GazeR), I get only NAs for the trial column. The other columns look fine, though. Am I doing something wrong here? Thank you for any advice.

find_messages_edf(file_list = file_list_edf, 
                  varnames = c("TRIALID", "TRIAL_VAR condition", "TRIAL_VAR item", "TRIAL_VAR keypress"), 
                  patterns = c("TRIALID", "!V TRIAL_VAR condition", "!V TRIAL_VAR item", "!V TRIAL_VAR keypress"),
                  output_dir_behave_data)

Read pupil data from excel

Hi,

I was wondering if it could directly read pupil size data in the excel file. I recorded the pupil size data using MATLAB, and exported the data as excel file. But when I used the merge_gazer_files function, it reported an error. I have tried several methods, but I still can't solve it. The column "RECORDING_SESSION_LABEL" exist in the excel file. When I tried to use another function (read_fixation_report), it reported the same error.

image
image

image
image

adjust code to monocular recording

Hi,

I was wondering if it possible to adjust the code to monocular recording? so far, I exchanged the average_in_blink and average_in_pupil with right_in_blink and right_in_pupil but its causing trouble when I am trying to run the code for the baseline corrections (cause its still based on avg_pupil?).
Do you have any recommendation how to preceed?
Thanks and all the best,

Anna

unable to install saccades and edfR

Hi,

I am unable to install packages saccades and edfR. The message I receive is:

"Error: (converted from warning) package 'zoom' was built under R version 4.0.4
Execution halted
ERROR: lazy loading failed for package 'saccades'

  • removing 'C:/Users/.../Dokumenter/R/win-library/4.0/saccades'
    Error: Failed to install 'saccades' from GitHub:
    (converted from warning) installation of package ‘C:/Users/.../AppData/Local/Temp/Rtmp6TEECc/file696864227a8f/saccades_0.2-1.tar.gz’ had non-zero exit status"

Maybe you have seen this before? Any help is very appreciated.

Error when running dplyr::gather

Dear all,

I am trying to run the Gazer_walkthrough.R script, i am getting an error when running the following part

gaze_obj <-gaze_aoi %>% dplyr::gather(key ="object", value ="fix",Targ, Comp, Unrelated, factor_key =TRUE) %>% dplyr::mutate(Fix =replace_na(fix, FALSE)) # recode NA as not-
Error: 'gather' is not an exported object from 'namespace:dplyr'

Any help is much appreciated
Thanks in advance!
Best regards,
Nayla

Accommodating data timebinned in Eyelink

Hi,

Thanks for the comprehensive overview of the package, much appreciated!

One quick question - when the functions specify hz input, is this referring to the original sampling rate, or to the downsampled rate if this has already been conducted in Eyelink dataviewer?

Loading edfs on Code Ocean

Hi,

I would like to use gazeR to analyse my pupil data. I tried to load in an edf on Code Ocean but I received the following error message:

Error: Can't subset columns that don't exist.
x The column `blink` doesn't exist.

I've also tried to load in a few different edfs but I receive the same error message each time.
Any advice on what the issue might be here would be greatly appreciated!

Many thanks,
Iman

Can GazeR analyze eye movement data in virtual reality environments?

We built a 3D scene in Unity and then used the HTC VIVE pro eye, a virtual reality headset device, to obtain eye movement data as follows.
QQ图片20230405144401
The data includes pupil size, gaze direction, and gaze starting position for both eyes, but the coordinates include X-axis, Y-axis, and Z-axis. Can GazeR analyze such data? And we exported the CSV file directly.

sample_message to message not updated in merge_pupil

Hi there!

I am updating some past scripts and noticed that merge_pupil does not change sample_message to message but merge_gazer_files does. This becomes an issues when you call baseline_correction_pupil_msg. Is merge_pupil just an old hold over from the earlier versions of the package? Everything is working with the updated calls.

Thanks,
Bonnie

parse_edf function creates more trials than actually present

Hello everyone,

I use the parse_edf function, which outputs the csv file with the expected number of trials (96) for most of my participants. However, for one subject, it outputs 97 trials. The number of logs of 'TRIALID' in that participant seems to be 96, however, so I do not know why this happens.

Thank you for any help regarding the issue.

Can GazeR process datasets of the task which is implemented using MATLAB?

Dear GazeR team,
My experiment was programmed using MATLAB. After transferring edf to asc files and compare my datasets with EB examples, I find the format of my datasets is different from that programmed in Experiment Builder. As shown below, the messages of my dataset is plugged into the data point.
So I want to know whether GazeR can preprocess the datasets like this?
EB examples
my dataset

Cannot either install or download the GazeR package(s)

Dear Team,

I encountered your paper published in Behavior Research Methods Journal on GazeR.
I find the paper very informative and helpful for pupillometry data pre-processing and wanted to give it a try.

Following the instrustions provided in the paper, I've tried to download and install the gazer, saccades and jashhubbard packages from github in R, but the installation failed with the following error(s) across all packages:

"Downloading GitHub repo dmirman/gazer@HEAD
Error in utils::download.file(url, path, method = method, quiet = quiet, :
cannot open URL 'https://api.github.com/repos/dmirman/gazer/tarball/HEAD'

And direct download from Github is also giving the same error.
I wonder if you could help fix this technical issue.

Thank you,
Odko

How to find the peak pupil size and a possible bug in remove missing data?

Hi Jason,

Thanks for developing the great package :) I ran into two issues and I would be grateful if you could help me with that.

For my experiment, I want to get the peak pupil size in each trial and remove those greater or less than 3SD of the personal mean. I am just wondering if there is a function that exists in the package that could help me find the peak pupil size (and to winsorize, ideally) in a trial directly.

Also, I have another question about the package not excluding the participant that has the percentage of missing trials over the missing threshold I specified. For example, in the below screenshot, I set the missing threshold as 0.2. However, subject 4 has 23.6% of missing trials but was not taken out, which was a bit confusing.
Screenshot 2023-12-07 at 15 37 33

Many thanks for your help in advance!

Best,
Rongru

parse_edf function deletes message entries on the way

Hello everyone,

I have just now realized that after using the parse_edf function, a lot of my messages got lost on the way, which means, they are not present in the csv file anymore. This seems to be case whenever there are multiple message logged for ONE timestamp in the EDF/ASC file, like in this example excerpt:
...
MSG 1072433 !V TRIAL_VAR condition high_short
MSG 1072433 !V TRIAL_VAR item blume
MSG 1072433 !V TRIAL_VAR keypress 1
MSG 1072433 !V IAREA RECTANGLE 1 854 385 1066 495 roi_eyes
MSG 1072433 !V IAREA RECTANGLE 2 820 213 1100 627 roi_head
MSG 1072433 !V IAREA RECTANGLE 3 820 770 1100 1051 roi_object
MSG 1072433 TRIAL_RESULT
1072433 497.7 522.0 697.0 127.0 ...
...

Here, all messages in theory are logged with sample 1072433, but only the first message ('!V TRIAL_VAR condition high_short') makes it through the parse_edf function. It makes sense, that the function would not know where to attribute these messages to if not to the following sample. However, I need these messages (at least the 'item' and 'keypress') for analysis. Do you have plans to include this functionality in the function? If not, do you have recommendations for me how to tackle this issue?

Thank you!

issues edfR

Hello!

I'm trying to use the edfR package for R 4.2.0 on a Macbook Pro (MacOS Monterey 12.4).
I already installed the Eyelink Developer's Kit (EDF API) and all the packages required. However, I keep receiving this error:

Error: package or namespace load failed for ‘edfR’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/4.2/Resources/library/edfR/libs/edfR.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.2/Resources/library/edfR/libs/edfR.so, 0x0006): Library not loaded: @rpath/edfapi.framework/Versions/A/edfapi
Referenced from: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/edfR/libs/edfR.so
Reason: tried: '/System/Library/Frameworks/edfapi.framework/Versions/A/edfapi' (no such file)

So, I switched to Code Ocean (following your tutorial on YouTube), and I loaded in an edf file, but I got the following error message:

Success! (633988 samples)
Error: Can't subset columns that don't exist.
x The column blink doesn't exist.

I took a look at the suggestions reported here, but still having issues.

unable to use edfR

I wonder is there anyone having a similar problem as me that edfR does not work (had reported an issue in edfR: jashubbard/edfR#12). Is there any other alternative approach to parse the edf file when package edfR doesn't work? thanks a lot!

downsample_gaze not found

Hello, thanks for the great algorithm!

every other function is working great for me exept for the downsample_gaze one. The error showed in the console is the following:

> timebins1 <- downsample_gaze(baseline_pupil_onset, bin.length = 100, timevar = "time_zero", aggvars= c("subject", "timebins"), type="pupilz")
Error in downsample_gaze(baseline_pupil_onset, bin.length = 100, timevar = "time_zero",  : 
  object 'downsample' not found

Is there a reason why or am I just applying it wrong??

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.