ibllib.io.extractors.ephys_passive

Functions

extract_passive_periods

Extract passive protocol periods from a session.

extract_rfmapping

Extract the receptive field mapping stimulus times from a passive session.

extract_task_replay

Extract the task replay stimuli from a passive session.

load_task_replay_fixtures

Load the expected task replay sequence for a passive session.

Classes

PassiveChoiceWorld

load_task_replay_fixtures(session_path: Path, task_collection: str = 'raw_passive_data', settings: dict | None = None, task_version: Version | None = None, adjust: bool = True) DataFrame[source]

Load the expected task replay sequence for a passive session.

Parameters:
  • session_path (Path) – The path to a session

  • task_collection (str) – The collection containing task data

  • settings (dict, optional) – A dictionary containing the session settings.

  • task_version (str, optional) – The iblrig version used for the session.

Returns:

task_replay – A dataframe containing the expected task replay sequence.

Return type:

pd.DataFrame

extract_passive_periods(session_path: Path, sync_collection: str = 'raw_ephys_data', sync: dict | None = None, sync_map: dict | None = None, tmin: float | None = None, tmax: float | None = None) DataFrame[source]

Extract passive protocol periods from a session.

Parameters:
  • session_path (Path) – The path to a session

  • sync_collection (str, default 'raw_ephys_data') – The collection containing the sync data.

  • sync (dict, optional) – Preloaded sync dictionary. If None, it is loaded via ephys_fpga.get_sync_and_chn_map.

  • sync_map (dict, optional) – Channel map for sync. Loaded if None.

  • tmin (float, optional) – Time window to restrict the extraction.

  • tmax (float, optional) – Time window to restrict the extraction.

Returns:

A dataFrame containing passive periods. Contains rows: ‘start’, ‘stop’ and columns: ‘passiveProtocol’, ‘spontaneousActivity’, ‘RFM’, ‘taskReplay’

Return type:

pd.DataFrame

extract_rfmapping(session_path: Path, sync_collection: str = 'raw_ephys_data', task_collection: str = 'raw_passive_data', sync: dict | None = None, sync_map: dict | None = None, trfm: ndarray | None = None) tuple[ndarray, ndarray][source]

Extract the receptive field mapping stimulus times from a passive session.

Parameters:
  • session_path (Path) – The path to a session

  • sync_collection (str, default 'raw_ephys_data') – The collection containing the sync data.

  • sync (dict, optional) – Preloaded sync dictionary. If None, it is loaded via ephys_fpga.get_sync_and_chn_map.

  • sync_map (dict, optional) – Channel map for sync. Loaded if None.

  • trfm – The start and end times of the receptive field mapping period. If None, extracted from passive periods.

Returns:

The times of each frame presented during the receptive field mapping stimulus.

Return type:

np.array

extract_task_replay(session_path: Path, sync_collection: str = 'raw_ephys_data', task_collection: str = 'raw_passive_data', settings: dict | None = None, sync: dict | None = None, sync_map: dict | None = None, treplay: ndarray | None = None) tuple[DataFrame, DataFrame][source]

Extract the task replay stimuli from a passive session.

Parameters:
  • session_path (Path) – The path to a session

  • sync_collection (str, default 'raw_ephys_data') – The collection containing the sync data.

  • task_collection (str, default 'raw_passive_data') – The collection containing the passive task data.

  • settings (dict, optional) – A dictionary containing the session settings. If None, it is loaded via rawio.load_settings.

  • sync (dict, optional) – The sync data from the fpga

  • sync_map (dict, optional) – The map of sync channels

  • treplay (np.ndarray, optional) – The start and end times of the task replay period. If None, extracted from passive periods.

Returns:

  • gabor_df (pd.DataFrame) – A dataframe containing the gabor stimulus times and properties.

  • stim_df (pd.DataFrame) – A dataframe containing the valve, tone and noise stimulus times.

class PassiveChoiceWorld(session_path=None)[source]

Bases: BaseExtractor

save_names = ('_ibl_passivePeriods.intervalsTable.csv', '_ibl_passiveRFM.times.npy', '_ibl_passiveGabor.table.csv', '_ibl_passiveStims.table.csv')

The filenames of each extracted dataset, or None if array should not be saved.

Type:

tuple of str

var_names = ('passivePeriods_df', 'passiveRFM_times', 'passiveGabor_df', 'passiveStims_df')

A list of names for the extracted variables. These become the returned output keys.

Type:

tuple of str