Module eyekit.io
Functions for reading and writing data.
Functions
def read(file_path)
-
Read in a JSON file.
FixationSequence
andTextBlock
objects are automatically decoded and instantiated. def write(data, file_path, compress=True)
-
Write arbitrary data to a JSON file. If
compress
isTrue
, the file is written in the most compact way; ifFalse
, the file will be larger but more human-readable.FixationSequence
andTextBlock
objects are automatically serialized. def import_asc(file_path, trial_begin_var, trial_begin_vals, extract_vars=[])
-
Import a single ASC file or a directory of ASC files. The importer looks for a
trial_begin_var
that is set to one of thetrial_begin_vals
, and then extracts allEFIX
lines that occur within the subsequentSTART
–END
block. Optionally, you can specify other variables that you want to extract, resulting in imported data that looks like this:{ "trial_0" : { "trial_type" : "Experimental", "passage_id" : "passage_a", "response" : "yes", "fixations" : FixationSequence[[368, 161, 208], ..., [562, 924, 115]] } }