allensdk.brain_observatory.behavior.data_objects.metadata.behavior_metadata.behavior_metadata module

class allensdk.brain_observatory.behavior.data_objects.metadata.behavior_metadata.behavior_metadata.BehaviorMetadata(date_of_acquisition: DateOfAcquisition, subject_metadata: SubjectMetadata, behavior_session_id: BehaviorSessionId, equipment: Equipment, stimulus_frame_rate: StimulusFrameRate, session_type: SessionType, behavior_session_uuid: BehaviorSessionUUID, project_code: ProjectCode = <allensdk.brain_observatory.behavior.data_objects.metadata.behavior_metadata.project_code.ProjectCode object>, session_duration: float | None = None)[source]

Bases: DataObject, LimsReadableInterface, JsonReadableInterface, NwbReadableInterface, NwbWritableInterface

Container class for behavior metadata

property behavior_session_id: int
property behavior_session_uuid: UUID | None
property date_of_acquisition: datetime
property equipment: Equipment
classmethod from_json(dict_repr: dict) BehaviorMetadata[source]

Populates a DataFile from a JSON compatible dict (likely parsed by argschema)

Returns:
DataObject:

An instantiated DataObject which has name and value properties

classmethod from_lims(behavior_session_id: BehaviorSessionId, lims_db: PostgresQueryMixin) BehaviorMetadata[source]

Populate a DataObject from an internal database (likely LIMS)

Returns:
DataObject:

An instantiated DataObject which has name and value properties

classmethod from_nwb(nwbfile: NWBFile) BehaviorMetadata[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

get_session_duration() float | None[source]
Returns:
session duration

Notes

Missing in the case of reading from NWB since we don’t include this

field in that case

property is_pretest
property is_training
property project_code: str
property session_type: str
property stimulus_frame_rate: float
property subject_metadata
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.metadata.behavior_metadata.behavior_metadata.get_expt_description(session_type: str) str[source]

Determine a behavior ophys session’s experiment description based on session type. Matches the regex patterns defined as the keys in description_dict

Parameters:
session_typestr

A session description string (e.g. OPHYS_1_images_B )

Returns:
str

A description of the experiment based on the session_type.

Raises:
RuntimeError

Behavior ophys sessions should only have 6 different session types. Unknown session types (or malformed session_type strings) will raise an error.

allensdk.brain_observatory.behavior.data_objects.metadata.behavior_metadata.behavior_metadata.get_task_parameters(data: Dict) Dict[source]

Read task_parameters metadata from the behavior stimulus pickle file.

Parameters:
data: dict

The nested dict read in from the behavior stimulus pickle file. All of the data expected by this method lives under data[‘items’][‘behavior’]

Returns:
dict

A dict containing the task_parameters associated with this session.