get_session_dir¶
- behavenet.fitting.utils.get_session_dir(hparams, session_source='save')[source]¶
Get session-level directory for saving model outputs from hparams dict.
Relies on hparams keys ‘sessions_csv’, ‘multisession’, ‘lab’, ‘expt’, ‘animal’, ‘session’.
The
sessions_csvkey takes precedence. The value for this key is a non-empty string of the pattern/path/to/session_info.csv, where session_info.csv has 4 columns for lab, expt, animal and session.If sessions_csv is an empty string or the key is not in hparams, the following occurs:
if
'lab' == 'all', an error is thrown since multiple-lab runs are not currently supportedif
'expt' == 'all', all sessions from all animals from all expts from the specified lab are used; the session_dir will then besave_dir/lab/multisession-xxif
'animal' == 'all', all sessions from all animals in the specified expt are used; the session_dir will then besave_dir/lab/expt/multisession-xxif
'session' == 'all', all sessions from the specified animal are used; the session_dir will then besave_dir/lab/expt/animal/multisession-xxif none of ‘lab’, ‘expt’, ‘animal’ or ‘session’ is ‘all’, session_dir is
save_dir/lab/expt/animal/session
The
session_sourceargument defines where the code looks for sessions whenever one of ‘lab’, ‘expt’, ‘animal’, or ‘session’ is'all'; if'session_source' = 'data', the data directory is searched for sessions; if'session_source' = 'save', the save directory is searched for sessions. This means that only sessions that have been previously used for fitting models will be included.The
multisession-xxdirectory will contain a filesession_info.csvwhich will contain information about the sessions that comprise the multisession; this file is used to determine whether or not a new multisession directory needs to be created.- Parameters:
hparams (
dict) – requires sessions_csv, multisession, lab, expt, animal and sessionsession_source (
str, optional) – ‘save’ to use hparams[‘save_dir’], ‘data’ to use hparams[‘data_dir’] as base directory; note that usingpath_type='data'will not return multisession directories
- Returns:
session_dir (
str)sessions_single (
list)
- Return type:
tuple