dmirman / gazer

Functions for reading and pre-processing eye tracking data.
43 stars 11 forks source link

parse_edf function creates more trials than actually present #11

Closed juthzi closed 3 years ago

juthzi commented 3 years ago

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.

jgeller112 commented 3 years ago

Hi,

That is odd... Is it possible that when that participant was run they got an extra trial? I have not run into this problem processing EDFs before.

jgeller112 commented 3 years ago

Can you send me the EDF file in question and the code you are using?

juthzi commented 3 years ago

Hi jgeller112,

thanks for taking a look at this. The experimental code does not allow for more than 96 trials. Also, when I run the function 'find_messages_edf()', I get the correct amount of trials.

You can download the respective EDF file here: https://uni-koeln.sciebo.de/s/ZoqDiNjczxc1Sln

The code I am using is the following:

# set the path to edfs
directory_edf = '/Users/jzimmermann/Desktop/HANNA/Hanna_pupillen_auswertung/edf'

# set the path where csv files should be stored
directory_csv_from_edf_conversion = "../csv"

# get list of edf files
file_list_edf <- list.files(path = directory_edf, pattern = '.EDF')

# ...change the working directory to where your data is held 
setwd('/Users/jzimmermann/Desktop/HANNA/Hanna_pupillen_auswertung/edf')

# parse edfs and saves them into directory
parse_edf(file_list = file_list_edf, output_dir = directory_csv_from_edf_conversion, type = "pupil")
jgeller112 commented 3 years ago

Can you re-send the file link? I cant download it anymore.

juthzi commented 3 years ago

Yes, of course. I time-limited it. Here it is again:

https://uni-koeln.sciebo.de/s/tlC9YnYHiscmov2

jgeller112 commented 3 years ago

So it looks like an issue within the EDF file itself and not the gazeR function. Can you pass the file through Data Viewer and see if it parses the correct number of trials? I do not have access to the full version of Data Viewer to do this.

The message function does not use the trial column included in the sample report of the EDF to parse trials, but instead uses messages to do this. This is why there is a discrepancy between parse_edf and parse_messages. It is possible that in the EDF file there is an erroneous extra trial thrown in there.

jgeller112 commented 3 years ago

It looks like trial 1 does not have any events associated with it.

blocks

jgeller112 commented 3 years ago

My suggestion would be to remove the first trial.

juthzi commented 3 years ago

Thank you very much! Indeed, it seems there was a first trial logged, which should not be there. I agree, that I should remove it. I cannot check the number of trials in Data Viewer at the moment (working at home), but will do so when I can.

juthzi commented 3 years ago

Just to add: I checked the number of trials in Data Viewer. It finds 97 as well. However, the first trial it identifies, does not refer to the actual first trial.

jgeller112 commented 3 years ago

Glad we solved that problem!