allensdk.brain_observatory.behavior.data_objects.licks module¶
- class allensdk.brain_observatory.behavior.data_objects.licks.Licks(licks: DataFrame)[source]¶
Bases:
DataObject,StimulusFileReadableInterface,NwbReadableInterface,NwbWritableInterface- classmethod from_nwb(nwbfile: NWBFile) Licks | None[source]¶
Populate a DataObject from a pyNWB file object.
- Parameters:
- nwbfile:
The file object (NWBFile) of a pynwb dataset file.
- Returns:
- DataObject:
An instantiated DataObject which has name and value properties
- classmethod from_stimulus_file(stimulus_file: BehaviorStimulusFile, stimulus_timestamps: StimulusTimestamps | ndarray) Licks[source]¶
Get lick data from pkl file. This function assumes that the first sensor in the list of lick_sensors is the desired lick sensor.
Since licks can occur outside of a trial context, the lick times are extracted from the vsyncs and the frame number in lick_events. Since we don’t have a timestamp for when in “experiment time” the vsync stream starts (from self.get_stimulus_timestamps), we compute it by fitting a linear regression (frame number x time) for the start_trial and end_trial events in the trial_log, to true up these time streams.
- Parameters:
- stimulus_fileBehaviorStimulusFile
Input Behavior stims loaded from a pickle file.
- stimulus_timestampsStimulusTimestamps or np.ndarray
Timestamps containing lick data either in a StimulusTimestamps object or numpy array. Numpy array data must be the SyncFile line named
lick_times.
- Returns:
- Licks instance