cibrrig.utils.alf_utils
alf_utils.py
This module provides utilities for handling ALF (Alyx File) data. The primary usage is for concatenating data from multiple recordings within a session.
May be useful to expand functionality in the future.
Attributes
Classes
Represents a recording session and provides methods to load, concatenate, and process ALF objects and logs. |
Module Contents
- cibrrig.utils.alf_utils.TEMPORAL_FEATURES = ['intervals', 'times', 'on_sec', 'off_sec', 'pk_time', 'inhale_peaks', 'exhale_troughs',...[source]
- class cibrrig.utils.alf_utils.Recording(session_path)[source]
Represents a recording session and provides methods to load, concatenate, and process ALF objects and logs.
- breaks
Array of break times between recordings.
- Type:
np.ndarray
- alf_objects
List of all ALF objects in the session.
- Type:
list
- get_breaks_times()[source]
Calculates the break times between recordings and stores them in the breaks attribute.
This method reads the metadata from each NIDQ binary file to determine the duration of each recording and calculates the cumulative break times.
- list_all_alf_objects()[source]
Lists all ALF objects present in the session and stores them in the alf_objects attribute.
This method scans the ALF directory for all ALF objects and extracts their names.
- concatenate_triggers(object_name)[source]
Concatenates data of a given object (e.g., breaths, laser…) from multiple recordings (i.e. triggers) into a single ALF object.
- Parameters:
object_name (str) – Name of the ALF object to concatenate.
- Returns:
Concatenated ALF object.
- Return type:
dict
- concatenate_log(save=True, overwrite=True)[source]
Concatenates log data from multiple recordings into a single DataFrame.
- Parameters:
save (bool, optional) – If True, save the concatenated log to a file. Defaults to True.
overwrite (bool, optional) – If True, overwrite existing log files. Defaults to True.
- Returns:
Concatenated log DataFrame.
- Return type:
pd.DataFrame
- improve_opto_log(log)[source]
Enhances the optogenetic stimulation log by adding calibrated amplitudes and end times.
- Parameters:
log (pd.DataFrame) – DataFrame containing the optogenetic stimulation log.
- Returns:
Enhanced optogenetic stimulation log.
- Return type:
pd.DataFrame
- concatenate_alf_objects(save=True, overwrite=True)[source]
Concatenates all ALF objects in the session.
- Parameters:
save (bool, optional) – If True, save the concatenated ALF objects to files. Defaults to True.
overwrite (bool, optional) – If True, overwrite existing ALF files. Defaults to True.
- Returns:
None
- concatenate_session(save=True, overwrite=True)[source]
Concatenates all ALF objects and logs in the session.
- Parameters:
save (bool, optional) – If True, save the concatenated data to files. Defaults to True.
overwrite (bool, optional) – If True, overwrite existing files. Defaults to True.
- Returns:
None