allensdk.brain_observatory.behavior.metadata.behavior_metadata module

class allensdk.brain_observatory.behavior.metadata.behavior_metadata.BehaviorMetadata(extractor: allensdk.brain_observatory.behavior.session_apis.abcs.data_extractor_base.behavior_data_extractor_base.BehaviorDataExtractorBase, stimulus_timestamps: numpy.ndarray, behavior_stimulus_file: dict)[source]

Bases: object

Container class for behavior metadata

age_in_days

Converts the age cod into a numeric days representation

behavior_session_id
behavior_session_uuid

Get the universally unique identifier (UUID)

cre_line

Parses cre_line from full_genotype

date_of_acquisition

Return the timestamp for when experiment was started in UTC

NOTE: This method will only get acquisition datetime from extractor (data from LIMS) methods. As a sanity check, it will also read the acquisition datetime from the behavior stimulus (.pkl) file and raise a warning if the date differs too much from the datetime obtained from the behavior stimulus (.pkl) file.

Return type:datetime
driver_line
equipment_name
full_genotype
get_extractor(self)[source]
mouse_id
reporter_line

There can be multiple reporter lines, so it is returned from LIMS as a list. But there shouldn’t be more than 1 for behavior. This tries to convert to str

Returns:
single reporter line, or None if not possible
session_type
sex
stimulus_frame_rate
to_dict(self) → dict[source]

Returns dict representation of all properties in class

allensdk.brain_observatory.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_type : str

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