dr-JT / pupillometry

An R Package to preprocess pupil data
https://dr-jt.github.io/pupillometry/
6 stars 0 forks source link

asc file format #1

Open renderann opened 4 years ago

renderann commented 4 years ago

Hey JT,

I'm trying to use your code and it worked pretty well with the example file you uploaded.. Unfornuately, we have eyelink and cannot figure out how to use the pupil read function to upload the asc file in R. It keeps sending me the error message, probably I dont know how to define the subject prefix and suffix?

Error in stringr::str_split(x, "/")[[1]] : subscript out of bounds In addition: Warning message: Unknown or uninitialised column: 'RECORDING_SESSION_LABEL'.

Do you by any chance have an example for eyelink data as well and how to adjust the code to it? Thanks and all the best,

Anna

dr-JT commented 4 years ago

Hi Anna,

So that I can better understand your data file, did you use Data Viewer to import the .edf file and export the raw sample data? What format did you export to? You say the file is an asc file, but you will need a tab-delimited .txt file.

renderann commented 4 years ago

Hey JT, Thanks for replying so quickly! Originally it was the raw data file that eyelink creates immidiately after the experiment for each participant.I converted that edf to an asc file with the eyelink converter, please see the link below. So I didn't even use the dataviewer, I have done that before to create csv or xlxs but I thought asc would be more common for analysis? I'll try to make a tab delimited .txt file then and try again! All the best! https://www.dropbox.com/s/5lrhepy39k8tyb4/VPN_10.asc?dl=0

dr-JT commented 4 years ago

I have never worked with .asc files before and it does not seem to be easy to import into R. Therefore, I suggest you use data viewer to get the raw sample data into a csv, xlxs, or tab delimited text file. If you prefer to use a csv or xlxs file then I may need to update the function to read in that filetype, which would not be a problem at all

renderann commented 4 years ago

Hey JT, I followed your advice and used the txt file but the trial numbers don't appear in the dataset (NA) if I use the function pupil.read. I tried to look into the function and was wondering if it because trial is set to NA in there? if (eyetracker == "eyelink") { data <- readr::read_delim(file, "\t", escape_double = FALSE, trim_ws = TRUE, na = ".", guess_max = 1e+05) subj <- subj.extract(data$RECORDING_SESSION_LABEL[1], prefix = subj.prefix, suffix = subj.suffix) data <- dplyr::mutate(data, Subject = subj, Trial = NA, ms_conversion = 1)

I tried to rename diffferent columns in the raw data txt file as well but I couldnt figure out how to get the trial numbers in R, do you maybe have advice for me for that as well? Thanks so much for your help! All the best,

Anna

dr-JT commented 4 years ago

The pupil_read() function will set the trial number based on message strings in the data file. Did you set the argument: start_tracking.message = ""

See

https://dr-jt.github.io/pupillometry/articles/Message%20Markers.html

or

https://dr-jt.github.io/pupillometry/articles/Using%20the%20Preprocessing%20Functions.html#read-in-raw-files