ibllib.pipes.misc

Miscellaneous pipeline utility functions.

Functions

create_alyx_probe_insertions

get_iblscripts_folder

get_new_filename

get_new_filename is system agnostic (3A, 3B1, 3B2).

move_ephys_files

move_ephys_files is system agnostic (3A, 3B1, 3B2).

probe_labels_from_session_path

Finds ephys probes according to the metadata spikeglx files.

rename_ephys_files

rename_ephys_files is system agnostic (3A, 3B1, 3B2).

sleepless

Decorator to ensure that the system doesn't enter sleep or idle mode during a long-running task.

Classes

WindowsInhibitor

Prevent OS sleep/hibernate in windows; code from: https://github.com/h3llrais3r/Deluge-PreventSuspendPlus/blob/master/preventsuspendplus/core.py API documentation: https://msdn.microsoft.com/en-us/library/windows/desktop/aa373208(v=vs.85).aspx

probe_labels_from_session_path(session_path: str | Path) List[str][source]

Finds ephys probes according to the metadata spikeglx files. Only returns first subfolder name under raw_ephys_data folder, ie. raw_ephys_data/probe00/copy_of_probe00 won’t be returned If there is a NP2.4 probe with several shanks, create several probes

Parameters:

session_path

Returns:

list of strings

create_alyx_probe_insertions(session_path: str, force: bool = False, one: object = None, model: str = None, labels: list = None)[source]
rename_ephys_files(session_folder: str) None[source]

rename_ephys_files is system agnostic (3A, 3B1, 3B2). Renames all ephys files to Alyx compatible filenames. Uses get_new_filename.

Parameters:

session_folder (str) – Session folder path

Returns:

None - Changes names of files on filesystem

Return type:

None

get_new_filename(filename: str) str[source]

get_new_filename is system agnostic (3A, 3B1, 3B2). Gets an alyx compatible filename from any spikeglx ephys file.

Parameters:

filename – Name of an ephys file

Returns:

New name for ephys file

move_ephys_files(session_folder: str) None[source]

move_ephys_files is system agnostic (3A, 3B1, 3B2). Moves all properly named ephys files to appropriate locations for transfer. Use rename_ephys_files function before this one.

Parameters:

session_folder (str) – Session folder path

Returns:

None - Moves files on filesystem

Return type:

None

get_iblscripts_folder()[source]
class WindowsInhibitor[source]

Bases: object

Prevent OS sleep/hibernate in windows; code from: https://github.com/h3llrais3r/Deluge-PreventSuspendPlus/blob/master/preventsuspendplus/core.py API documentation: https://msdn.microsoft.com/en-us/library/windows/desktop/aa373208(v=vs.85).aspx

ES_CONTINUOUS = 2147483648
ES_SYSTEM_REQUIRED = 1
static inhibit(quiet: bool = False)[source]
static uninhibit(quiet: bool = False)[source]
sleepless(func: Callable[[...], Any]) Callable[[...], Any][source]

Decorator to ensure that the system doesn’t enter sleep or idle mode during a long-running task.

This decorator wraps a function and sets the thread execution state to prevent the system from entering sleep or idle mode while the decorated function is running.

Parameters:

func (callable) – The function to decorate.

Returns:

The decorated function.

Return type:

callable