allensdk.brain_observatory.behavior.internal.behavior_base module

class allensdk.brain_observatory.behavior.internal.behavior_base.BehaviorBase[source]

Bases: abc.ABC

Abstract base class implementing required methods for interacting with behavior session data.

Child classes should be instantiated with a fetch API that implements these methods.

get_licks(self) → pandas.core.frame.DataFrame[source]

Get lick data from pkl file.

Returns:
np.ndarray

A dataframe containing lick timestamps.

get_rewards(self) → pandas.core.frame.DataFrame[source]

Get reward data from pkl file.

Returns:
pd.DataFrame

A dataframe containing timestamps of delivered rewards.

get_running_data_df(self) → pandas.core.frame.DataFrame[source]

Get running speed data.

Returns:
pd.DataFrame

Dataframe containing various signals used to compute running speed.

get_running_speed(self) → allensdk.brain_observatory.running_speed.RunningSpeed[source]

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).

get_stimulus_presentations(self) → pandas.core.frame.DataFrame[source]

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.

get_stimulus_templates(self) → Dict[str, numpy.ndarray][source]

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.

get_stimulus_timestamps(self) → numpy.ndarray[source]

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.

get_task_parameters(self) → dict[source]

Get task parameters from pkl file.

Returns:
dict

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

get_trials(self) → pandas.core.frame.DataFrame[source]

Get trials from pkl file

Returns:
pd.DataFrame

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