multimatch_gaze.tests package

Submodules

multimatch_gaze.tests.test_MultiMatch module

multimatch_gaze.tests.utils module

multimatch_gaze.tests.utils.create_chunks(onsets, fixations, dur)[source]

Chunk eyetracking data into scanpaths.

Use onset data to obtain indices of full eyetracking data for chunking.

Param:onsets: array-like, onset times of movie shots
Param:fixations: record array, nx4 fixation vector (onset, x, y, duration), output of preprocess() function
Param:dur: float, desired duration of segment length
Returns:startidx, endix: array, start and end ids of eyemovement data to chunk into segments
multimatch_gaze.tests.utils.create_offsetchunks(offsets, fixations, dur)[source]

Chunk eyetracking data into scanpaths.

Use offset data to obtain indices of full eyetracking data for chunking.

Param:offsets: array-like, offset times of movie shots
Param:fixations: record array, nx4 fixation vector (onset, x, y, duration), output of preprocess()
Param:dur: float, desired duration of segment length
Returns:startidx, endix: array start and end ids of eyemovement data to chunk into segments
multimatch_gaze.tests.utils.create_offsets(data, dur)[source]

Create shot offsets from studyforrests location annotation.

Create offset times of all shots of at least ‘dur’ seconds of length

Param:data: dataframe, location annotation from studyforrest
Param:dur: float, time in seconds a shot should at least be long
Returns:onsets: array-like, list of shot offset times
multimatch_gaze.tests.utils.create_onsets(data, dur)[source]

Create shot onsets from studyforrests location annotation.

Create onset times of all shots of at least ‘dur’ seconds of length.

Param:data: dataframe location annotation from studyforrest
Param:dur: float time in seconds a shot should at least be long
Returns:onsets: array-like, list of shot onset times
multimatch_gaze.tests.utils.docomparison_forrest(shots, data1, data2, screensize=[1280, 720], dur=4.92, ldur=0, offset=False, TDur=0, TDir=0, TAmp=0, grouping=False)[source]

Compare two scanpaths on five similarity dimensions.

Param:data1, data2: recarray, eyemovement information of forrest gump studyforrest dataset
Param:screensize: list, screen dimensions in px.
Param:ldur: float, duration in seconds. An attempt is made to group short shots together to form shots of ldur length
Param:grouping: boolean, if True, simplification is performed based on thresholds TAmp, TDir, and TDur
Param:TDir: float, Direction threshold, angle in degrees.
Param:TDur: float, Duration threshold, duration in seconds.
Param:TAmp: float, Amplitude threshold, length in px.
Returns:scanpathcomparisons: array array of 5 scanpath similarity measures
Returns:durations: array-like durations of extracted scanpaths. Vector (Shape), Direction (Angle), Length, Position, and Duration. 1 = absolute similarity, 0 = lowest similarity possible.
Returns:onsets: array-like onset times of the scanpaths
multimatch_gaze.tests.utils.fixations_chunks(fixations, startid, endid)[source]

Chunk eyemovement data into scanpaths.

Param:fixations: record array, nx4 fixation vector (onset, x, y, duration), output of preprocess()
Param:startid, endid: array, start- and end-ids of the scanpaths, output from either create_chunks() or create_offsetchunks()
Returns:fixation_vector: array-like, a nx3 fixation vector (x, y, duration)
multimatch_gaze.tests.utils.longshot(shots, group_shots, ldur=4.92)[source]

Group movie shots without a cut together to obtain longer segments.

Note: This way, fewer but longer scanpaths are obtained. Example: use median shotlength of 4.92s.

Param:shots: dataframe, contains movie location annotation
Param:group_shots: boolean, if True, grouping of movie shots is performed
Param:dur: float, length in seconds for movie shot. An attempt is made to group short shots without a cut together to form longer shots of ldur length
Returns:aggregated, dataframe of aggregated movie shots
multimatch_gaze.tests.utils.mk_angles()[source]

creates vectors with predefined angular relations. angles1 and angles2 contain the following properties: 1. same 0, 2. 60 diff, 3. 90 diff, 4.120 diff,4. 180 diff (max. dissimilar). They are in sectors (0,1) and (0, -1). Angles3 and angles4 contain the same properties reversed and lie in sectors (-1, 0) and (-1, -1)

multimatch_gaze.tests.utils.mk_durs()[source]

create some example duration for test_durationsim()

multimatch_gaze.tests.utils.mk_fix_vector(length=5)[source]

creates a random length x 3 fixation vector in form of a record array

multimatch_gaze.tests.utils.mk_longershots()[source]
multimatch_gaze.tests.utils.mk_strucarray(length=5)[source]

create a random scanpath in the data format generateScanpathStructureArray would output

multimatch_gaze.tests.utils.mk_supershort_shots()[source]
multimatch_gaze.tests.utils.preprocess_remodnav(data, screensize)[source]

Preprocess record array of eye-events.

A record array from REMoDNaV data is preprocessed in the following way: Subset to only get fixation data, disregard out-of-frame gazes, subset to only keep x, y coordinates, duration.

Param:data: recordarray, REMoDNaV output of eye events from movie data
Param:screensize: list of float, screen measurements in px
Returns:fixations: array-like nx3 fixation vectors (onset, x, y, duration)
multimatch_gaze.tests.utils.pursuits_to_fixations(remodnav_data)[source]

Transform start and endpoints of pursuits to fixations.

Uses the output of a record array created by the remodnav algorithm for eye-movement classification to transform pursuit data into fixations. The start and end point of a pursuit are relabeled as a fixation. This is useful for example if the underlying stimulus material is a moving image - visual intake of a moving object would then resemble a pursuit.

Param:npdata: recordarray, remodnav output of eyemovement data
Returns:newdata: recordarray
multimatch_gaze.tests.utils.read_remodnav(data)[source]

Helper to read input data produced by the REMoDNaV algorithm. Further information on the REMoDNaV algorithm can be found here: https://github.com/psychoinformatics-de/remodnav

multimatch_gaze.tests.utils.same_sample(run=1, subj=1)[source]

duplicate dataset to force exactly similar scanpaths. Choose the run (integer between 1-8) and whether you want a lab (1) or mri (2) subject

multimatch_gaze.tests.utils.short_shots(run=3)[source]

create a shortened shots location annotation to test longshots()

multimatch_gaze.tests.utils.takeclosestleft(mylist, mynumber)[source]

Return integer closest left to ‘myNumber’ in an ordered list.

Param:mylist: int
Param:mynumber: array
Returns:after: float, number within mylist closest to the left of mynumber
multimatch_gaze.tests.utils.takeclosestright(mylist, mynumber)[source]

Return integer closest right to ‘myNumber’ in an ordered list.

Param:mylist: int
Param:mynumber: array
Returns:after: float, number within mylist closest to right of my number

Module contents