allensdk.brain_observatory.behavior.data_objects.eye_tracking.eye_tracking_table module

class allensdk.brain_observatory.behavior.data_objects.eye_tracking.eye_tracking_table.EyeTrackingTable(eye_tracking: DataFrame)[source]

Bases: DataObject, DataFileReadableInterface, NwbReadableInterface, NwbWritableInterface

corneal, eye, and pupil ellipse fit data

classmethod from_data_file(data_file: EyeTrackingFile, stimulus_timestamps: StimulusTimestamps, metadata_file: EyeTrackingMetadataFile | None = None, video: EyeTrackingVideo | None = None, z_threshold: float = 3.0, dilation_frames: int = 2, empty_on_fail: bool = False) EyeTrackingTable[source]
Parameters:
data_file
stimulus_timestamps: StimulusTimestamps

The timestamps associated with this eye tracking table

z_thresholdfloat, optional

See EyeTracking.from_lims

dilation_framesint, optional

See EyeTracking.from_lims

empty_on_fail: bool

If True, this method will return an empty dataframe if an EyeTrackingError is raised (usually because timestamps and eye tracking video frames do not align). If false, the error will get raised.

metadata_file: EyeTrackingMetadataFile. Used for detecting if video is

MVR. Either this or video must be given.

video: EyeTrackingVideo. Used for detecting if video is MVR.

Either this or metadata_file must be given.

classmethod from_nwb(nwbfile: NWBFile, z_threshold: float = 3.0, dilation_frames: int = 2) EyeTrackingTable | None[source]
Parameters:
nwbfile
z_threshold

See from_lims for description

dilation_frames

See from_lims for description

to_nwb(nwbfile: NWBFile) NWBFile[source]

Given an already populated DataObject, return an pyNWB file object that had had DataObject data added.

Parameters:
nwbfileNWBFile

An NWB file object

Returns:
NWBFile

An NWB file object that has had data from the DataObject added to it.

allensdk.brain_observatory.behavior.data_objects.eye_tracking.eye_tracking_table.get_lost_frames(eye_tracking_metadata: EyeTrackingMetadataFile) ndarray[source]

Get lost frames from the video metadata json Must subtract one since the json starts indexing at 1

The lost frames are recorded like [‘13-14,67395-67398’] which would mean frames 13, 15, 67395, 67396, 67397, 67398 were lost.

This method needs to parse these strings into lists of integers.

Parameters:
eye_tracking_metadata: EyeTrackingMetadataFile
Returns:
indices of lost frames

Notes

This algorithm was copied almost directly from an implementation at https://github.com/corbennett/NP_pipeline_QC/blob/6a66f195c4cd6b300776f089773577db542fe7eb/probeSync_qc.py