ibllib.tests.fixtures.utils
Functions
Create the folder structure for a raw behaviour session. |
|
create_fake_raw_ephys_data_folder creates raw_ephys_data folder can populate with empty files with expected names |
|
Create the folder structure for a raw video session with three cameras. |
|
Touch file tree to emulate files saved by SpikeGLX |
|
Populate a task settings JSON file. |
|
Register a new test session. |
- create_fake_session_folder(root_data_path, lab='fakelab', mouse='fakemouse', date='1900-01-01', num='001', increment=True)[source]
- create_fake_raw_ephys_data_folder(session_path, populate=True)[source]
create_fake_raw_ephys_data_folder creates raw_ephys_data folder can populate with empty files with expected names
- Parameters:
session_path ([type]) – [description]
populate (bool, optional) – [description], defaults to True
- Returns:
[description]
- Return type:
[type]
- populate_raw_spikeglx(session_path, model='3B', legacy=False, user_label='my_run', n_probes=2)[source]
Touch file tree to emulate files saved by SpikeGLX
- Parameters:
session_path – The raw ephys data path to place files
model – Probe model file structure (‘3A’ or ‘3B’)
legacy – If true, emulate older SpikeGLX version where all files are saved
into a single folder :param user_label: User may input any name into SpikeGLX and filenames will include this :param n_probes: Number of probe datafiles to touch :return:
Examples
populate_raw_spikeglx(‘3A_folder’, model=’3A’, legacy=True, n_probes=1) 3A_folder
- └───raw_ephys_folder
my_run_probe00_g0_t0.imec.ap.bin my_run_probe00_g0_t0.imec.ap.meta my_run_probe00_g0_t0.imec.lf.bin my_run_probe00_g0_t0.imec.lf.meta
populate_raw_spikeglx(‘3B_folder’, model=’3B’, n_probes=3) 3B_folder
- └───my_run_g0_t0
my_run_g0_t0.imec0.ap.bin my_run_g0_t0.imec0.ap.meta my_run_g0_t0.imec0.lf.bin my_run_g0_t0.imec0.lf.meta my_run_g0_t0.imec1.ap.bin my_run_g0_t0.imec1.ap.meta my_run_g0_t0.imec1.lf.bin my_run_g0_t0.imec1.lf.meta my_run_g0_t0.imec2.ap.bin my_run_g0_t0.imec2.ap.meta my_run_g0_t0.imec2.lf.bin my_run_g0_t0.imec2.lf.meta my_run_g0_t0.nidq.bin my_run_g0_t0.nidq.meta
- create_fake_raw_video_data_folder(session_path, populate=True, write_pars_stub=False)[source]
Create the folder structure for a raw video session with three cameras. Creates a raw_video_data folder and optionally, touches some files and writes a experiment description stub to a _devices folder.
- Parameters:
session_path (str, pathlib.Path) – The session path in which to create the folders.
populate (bool) – If true, touch some raw video files.
write_pars_stub (bool, str, dict) – If true, write an experiment description stub containing behaviour settings. If a string, the stub filename will contain this. If a dict, the key is used as the filename; the value, the file contents.
Example
>>> create_fake_raw_video_data_folder(session_path, populate=False, write_pars_stub=False) >>> create_fake_raw_video_data_folder(session_path, write_pars_stub='hostname_19826354')
- create_fake_raw_behavior_data_folder(session_path, populate=True, task='ephysCW', folder='raw_behavior_data', write_pars_stub=False)[source]
Create the folder structure for a raw behaviour session.
Creates a raw_behavior_data folder and optionally, touches some files and writes an experiment description stub to a _devices folder.
- Parameters:
session_path (pathlib.Path) – The session path in which to create the folders.
populate (bool) – If true, touch some raw behaviour files.
task (str) – The name of the task protocol, if ‘ephys’ or ‘passive’ extra files are touched.
write_pars_stub (bool, str, dict) – If true, write an experiment description stub containing behaviour settings. If a string, the stub will be named as such. If a dict, the key is used as the filename; the value, the file contents.
- Returns:
The raw behaviour data path.
- Return type:
pathlib.Path
- populate_task_settings(fpath: Path, patch: dict)[source]
Populate a task settings JSON file.
- Parameters:
fpath (pathlib.Path) – A path to a raw task settings folder or the full settings file path.
patch (dict) – The settings dict to write to file.
- Returns:
The full settings file path.
- Return type:
pathlib.Path
- create_fake_complete_ephys_session(root_data_path, lab='fakelab', mouse='fakemouse', date='1900-01-01', num='001', increment=True)[source]
- create_fake_ephys_recording_bad_passive_transfer_sessions(root_data_path, lab='fakelab', mouse='fakemouse', date='1900-01-01', num='001', increment=True)[source]
- register_new_session(one, subject=None, date=None)[source]
Register a new test session.
NB: This creates the session path on disk, using one.cache_dir.
- Parameters:
one (one.api.OneAlyx) – An instance of ONE.
subject (str) – The subject name. If None, a new random subject is created.
date (str) – An ISO date string. If None, a random one is created.
- Returns:
pathlib.Path – New local session path.
uuid.UUID – The experiment UUID.