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
¶
-
mouse_id
¶
-
static
parse_age_in_days
(age: str, warn=False) → Union[int, NoneType][source]¶ Converts the age code into a numeric days representation
Parameters: - age
age code, ie P123
- warn
Whether to output warning if parsing fails
-
static
parse_cre_line
(full_genotype: str, warn=False) → Union[str, NoneType][source]¶ Parameters: - full_genotype
formatted from LIMS, e.g. Vip-IRES-Cre/wt;Ai148(TIT2L-GC6f-ICL-tTA2)/wt
- warn
Whether to output warning if parsing fails
Returns: - cre_line
just the Cre line, e.g. Vip-IRES-Cre, or None if not possible to parse
-
static
parse_indicator
(reporter_line: Union[str, NoneType], warn=False) → Union[str, NoneType][source]¶ Parses indicator from reporter
-
static
parse_reporter_line
(reporter_line: Union[List[str], NoneType], warn=False) → Union[str, NoneType][source]¶ 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
Parameters: - reporter_line
List of reporter line
- warn
Whether to output warnings if parsing fails
Returns: - single reporter line, or None if not possible
-
reporter_line
¶
-
session_type
¶
-
sex
¶
-
stimulus_frame_rate
¶
-
-
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.