gazelib.legacy package

Submodules

gazelib.legacy.igazelib module

igazelib: A low level library for analyzing gaze-data files provided usually by eyetracker-devices.

Gaze data is expected to be in JSON-format such as list of datapoints with similar dict storing the properties for each point.

Example:
[{xcoordinate:0.4, ...}, {xcoordinate:0.5, ...}, ..., {xcoordinate:-1, ...}]

List elements are called “gazepoints”, and dict keys as “keys”.

gazelib-library is designed to be used with a script file that calls the library functions to perform different analysis steps.

Created by researchers in Infant Cognition Lab, University of Tampere, Finland

gazelib.legacy.igazelib.SRT_index(rtimes, max_rt, min_rt)[source]

Calculate SRT index (Leppanen et al.)

gazelib.legacy.igazelib.add_key(data, key, new_values)[source]

Adds a key to the datapoint-list. New_values must match in length to the column with keys.

gazelib.legacy.igazelib.border_violation(data, aoi, xkey, ykey, valkey, accepted_validities, silent=True)[source]

Return true if during-non valid perioid gaze has crossed aoi-border.

gazelib.legacy.igazelib.combine_coordinates(data, accepted_validities, rxkey, rykey, rvalkey, lxkey, lykey, lvalkey, silent=True)[source]

Combine two coordinate-columns with third validity-column to one column.

gazelib.legacy.igazelib.duration(data, timekey)[source]

Returns the length of the data in time units.

gazelib.legacy.igazelib.first_gazepoints(data, gpcount, silent=True)[source]

Clip first rows from DATA before milliseconds count of time has passed

gazelib.legacy.igazelib.first_gazepoints_by_time(data, time_key, timeunits, silent=True)[source]

Clip first rows from DATA before milliseconds count of time has passed

gazelib.legacy.igazelib.gaze_inside_aoi(data, xcol, ycol, aoi, firstorlast, silent=True)[source]

Finds either the first row when gaze enters aoi or last. If gaze does not enter aoi, return -1

gazelib.legacy.igazelib.gaze_inside_aoi_percentage(data, xcol, ycol, aoi, silent=True)[source]

Calculate the percentage of gaze inside aoi borders on given data.

gazelib.legacy.igazelib.gazepoints_after_time(data, time_key, timeunits, silent=True)[source]

Clip rows from DATA after [timeunits] count of time has passed

gazelib.legacy.igazelib.gazepoints_containing_value(data, key, value_list, silent=True)[source]

return the rows that contain certain value

gazelib.legacy.igazelib.gazepoints_not_containing_value(data, key, value_list, silent=True)[source]

return the rows that DO NOT contain certain value

gazelib.legacy.igazelib.get_key(data, key)[source]

Returns a list of values, from single key in the data-parameter.

gazelib.legacy.igazelib.get_value(data, gazepoint, key)[source]

Returns a value from specific datapoint with specific key.

gazelib.legacy.igazelib.group(data, group_key, value_key)[source]

Groups a list of datapoint-dicts so that one of the keys is used as “grouping key” - according to this the values specified by “value key” are sorted to the dict containing lists.

gazelib.legacy.igazelib.group_lists(datas, group_key)[source]

Groups data by 0’th value in group_column and places each subset to a group defined by group_column. parameter: list of list of rows, grouping key value in datapoint[0][group_key] expected to exist

gazelib.legacy.igazelib.inside_aoi(aoi, x, y)[source]

If coordinates are inside aoi, return true, otherwise false. Aoi is expected to be a dict with keys “x1”, “x2”, “y1”, “y2”. Aoi represents an rectangle with top-left corner at (x1, y1) and bottom-right corner at (x2, y2).

gazelib.legacy.igazelib.interpolate_using_last_good_value(data, key, valkey, accepted_validities, silent=True)[source]

Interpolates values with key “key” in DATA-matrix by replacing the bad value with last good value before bad values (if there is at least one good value, otherwise, do nothing). Validitycolumn contains the validity markings for each datapoint and good validities are defined by the accepted validities-parameter. If the beginning of a trail is “bad”, use the first appearing good value to interpolate that.

gazelib.legacy.igazelib.longest_non_valid_streak(data, valkey, timekey, accepted_validities, silent=True)[source]

Longest streak of invalid values

gazelib.legacy.igazelib.mean(lst)[source]

Return mean of the list of numbers.

gazelib.legacy.igazelib.mean_of_valid_values(values, validities, accepted_validities)[source]

Returns mean of good validity tagged values. If none, returns -1. values: list, validities:list

gazelib.legacy.igazelib.median(lst)[source]

Return median of the list of numbers.

gazelib.legacy.igazelib.median_filter(datapoints, winlen, silent=True)[source]

Performs median filtering to the datapoints with window-length winlen. Winlen must be an odd integer (window: sample-(winlen-1)/2..sample..sample+(winlen-1)/2. Endings of the sample are truncated by the first/last sample to achieve filtered trace of same length than the original. Here datapoints must contain numbers, otherwise an error is presented.

gazelib.legacy.igazelib.median_filter_data(data, winlen, key)[source]

Performs median filtering to the datapoints in the specified column on DATA-structure. Further information see help medianFilter. Column specifies the column to filter the data with.

gazelib.legacy.igazelib.replace_value(data, key, value_to_replace, value, silent=True)[source]

replaces all values value_to_replace on key with value.

gazelib.legacy.igazelib.split_at_change_in_value(data, key, silent=True)[source]

Split one list to multiple lists. New list is started each time when value in the column changes from previous one. Omitted on the case of first element.

gazelib.legacy.igazelib.valid_gaze_percentage(data, valkey, accepted_validities)[source]

Calculates the percentage of valid gaze in data.

Module contents

Tools from the previous igazelib project