allensdk.brain_observatory.behavior.behavior_data_session module

class allensdk.brain_observatory.behavior.behavior_data_session.BehaviorDataSession(api: Optional[Type[allensdk.brain_observatory.behavior.internal.behavior_base.BehaviorBase]] = None)[source]

Bases: object

behavior_session_id

Unique identifier for this experimental session. :rtype: int

cache_clear(self) → None[source]

Convenience method to clear the api cache, if applicable.

classmethod from_lims(behavior_session_id: int) → 'BehaviorDataSession'[source]
classmethod from_nwb_path(nwb_path: str, **api_kwargs: Any) → 'BehaviorDataSession'[source]
licks

Get lick data from pkl file.

Returns:
np.ndarray

A dataframe containing lick timestamps.

list_api_methods(self) → List[Tuple[str, str]][source]

Convenience method to expose list of API get methods. These methods can be accessed by referencing the API used to initialize this BehaviorDataSession via its api instance attribute. :rtype: list of tuples, where the first value in the tuple is the method name, and the second value is the method docstring.

metadata

Return metadata about the session. :rtype: dict

ophys_experiment_ids

The unique identifiers for the ophys experiment(s) associated with this behavior session (if one exists) :rtype: int

ophys_session_id

The unique identifier for the ophys session associated with this behavior session (if one exists) :rtype: int

rewards

Get reward data from pkl file.

Returns:
pd.DataFrame

A dataframe containing timestamps of delivered rewards.

running_data_df

Get running speed data.

Returns:
pd.DataFrame

Dataframe containing various signals used to compute running speed.

running_speed

Get running speed using timestamps from self.get_stimulus_timestamps.

NOTE: Do not correct for monitor delay.

Returns:
RunningSpeed (NamedTuple with two fields)
timestamps : np.ndarray

Timestamps of running speed data samples

values : np.ndarray

Running speed of the experimental subject (in cm / s).

stimulus_presentations

Get stimulus presentation data.

NOTE: Uses timestamps that do not account for monitor delay.

Returns:
pd.DataFrame

Table whose rows are stimulus presentations (i.e. a given image, for a given duration, typically 250 ms) and whose columns are presentation characteristics.

stimulus_templates

Get stimulus templates (movies, scenes) for behavior session.

Returns:
Dict[str, np.ndarray]

A dictionary containing the stimulus images presented during the session. Keys are data set names, and values are 3D numpy arrays.

stimulus_timestamps

Get stimulus timestamps from pkl file.

NOTE: Located with behavior_session_id

Returns:
np.ndarray

Timestamps associated with stimulus presentations on the monitor that do no account for monitor delay.

task_parameters

Get task parameters from pkl file.

Returns:
dict

A dictionary containing parameters used to define the task runtime behavior.

trials

Get trials from pkl file

Returns:
pd.DataFrame

A dataframe containing behavioral trial start/stop times, and trial data