allensdk.internal.brain_observatory.util.multi_session_utils module¶
Utilities for accessing data across multiple sessions
- allensdk.internal.brain_observatory.util.multi_session_utils.get_images_shown(behavior_session_ids: List[int], lims_engine: PostgresQueryMixin, n_workers: int | None = None) Set[str][source]¶
Gets images shown to mouse during behavior_session_ids
- Parameters:
- behavior_session_ids
- lims_engine
- n_workers
- Returns:
- Set[str]: set of image names shown to mouse in behavior_session_ids
- allensdk.internal.brain_observatory.util.multi_session_utils.get_session_metadata_multiprocessing(behavior_session_ids: List[int], lims_engine: PostgresQueryMixin, n_workers: int | None = None) List[BehaviorMetadata][source]¶
Gets session metadata for behavior_session_ids. Uses multiprocessing to speed up reading
- Parameters:
- behavior_session_ids
behavior session ids to fetch session type for
- lims_engine
connection to lims DB
- n_workers
Number of processes to use. If None, will use all available cores
- Returns:
- List[BehaviorMetadata]: list of BehaviorMetadata
- allensdk.internal.brain_observatory.util.multi_session_utils.multiprocessing_helper(target: Callable, progress_bar_title: str, behavior_session_ids: List[int], lims_engine: PostgresQueryMixin, n_workers: int | None = None)[source]¶
- allensdk.internal.brain_observatory.util.multi_session_utils.remove_invalid_sessions(behavior_sessions: List[BehaviorMetadata], remove_pretest_sessions: bool = True, remove_sessions_after_mouse_death_date: bool = True, remove_aborted_sessions: bool = True, expected_training_duration: int = 900, expected_duration: int = 3600) List[BehaviorMetadata][source]¶
Removes any invalid sessions from behavior_sessions
- Parameters:
- behavior_sessions:
List of behavior session metadata
- remove_pretest_sessions
Remove any “pretest” session
- remove_sessions_after_mouse_death_date
Remove any sessions mistakenly entered that fall after mouse death date Sessions were loaded into LIMS with the wrong donor_id, causing there to be sessions associated with some mice that occur after those mice’s recorded death dates. Our assumption is that the error is with the donor_id rather than the death date, so we can correct it by filtering out any sessions that occur on mice that are supposed to be dead.
- remove_aborted_sessions
Remove aborted sessions
- expected_training_duration
Expected duration for TRAINING_0 session in seconds
- expected_duration
Expected duration for all sessions except TRAINING_0 in seconds
- Returns:
- List[BehaviorMetadata]:
list of behavior sessions with invalid sessions removed