ibllib.io.extractors.ephys_fpga
Data extraction from raw FPGA output Complete FPGA data extraction depends on Bpod extraction
Functions
Check keys exist in 'data' dict and contain values other than None |
|
For the IBL ephys task, reads ephys binary file and extract: |
|
Extract wheel positions and times from sync fronts dictionary |
|
Reads ephys binary file (s) and extract sync within the binary file folder Assumes ephys data is within a raw_ephys_data folder |
|
Extract wheel positions and times from sync fronts dictionary for all 16 chans Output position is in radians, mathematical convention |
|
Gets default channel map for the version/binary file type combination |
|
From 3A or 3B multiprobe session, returns the main probe (3A) or nidq sync pulses with the attached channel map (default chmap if none) |
|
Return sync and channel map for session based on collection where main sync is stored |
|
Gets the wheel position from synchronisation pulses |
|
Load syncing channel map for session path and collection |
|
Load sync files from session path and collection |
Classes
- data_for_keys(keys, data)[source]
Check keys exist in ‘data’ dict and contain values other than None
- get_ibl_sync_map(ef, version)[source]
Gets default channel map for the version/binary file type combination
- Parameters
ef – ibllib.io.spikeglx.glob_ephys_file dictionary with field ‘ap’ or ‘nidq’
- Returns
channel map dictionary
- extract_wheel_sync(sync, chmap=None)[source]
Extract wheel positions and times from sync fronts dictionary for all 16 chans Output position is in radians, mathematical convention
- Parameters
sync – dictionary ‘times’, ‘polarities’ of fronts detected on sync trace
chmap – dictionary containing channel indices. Default to constant. chmap = {‘rotary_encoder_0’: 13, ‘rotary_encoder_1’: 14}
- Returns
timestamps (np.array)
- Returns
positions (np.array)
- extract_behaviour_sync(sync, chmap=None, display=False, bpod_trials=None)[source]
Extract wheel positions and times from sync fronts dictionary
- Parameters
sync – dictionary ‘times’, ‘polarities’ of fronts detected on sync trace for all 16 chans
chmap – dictionary containing channel index. Default to constant. chmap = {‘bpod’: 7, ‘frame2ttl’: 12, ‘audio’: 15}
display – bool or matplotlib axes: show the full session sync pulses display
defaults to False :return: trials dictionary
- extract_sync(session_path, overwrite=False, ephys_files=None, namespace='spikeglx')[source]
Reads ephys binary file (s) and extract sync within the binary file folder Assumes ephys data is within a raw_ephys_data folder
- Parameters
session_path – ‘/path/to/subject/yyyy-mm-dd/001’
overwrite – Bool on re-extraction, forces overwrite instead of loading existing files
- Returns
list of sync dictionaries
- get_wheel_positions(sync, chmap)[source]
Gets the wheel position from synchronisation pulses
- Parameters
sync –
chmap –
- Return:wheel
dictionary with keys ‘timestamps’ and ‘position’ moves: dictionary with keys ‘intervals’ and ‘peakAmplitude’
- get_main_probe_sync(session_path, bin_exists=False)[source]
From 3A or 3B multiprobe session, returns the main probe (3A) or nidq sync pulses with the attached channel map (default chmap if none)
- Parameters
session_path –
- Returns
- class FpgaTrials(*args, **kwargs)[source]
Bases:
BaseExtractor
- save_names = ('_ibl_trials.intervals_bpod.npy', '_ibl_trials.goCueTrigger_times.npy', None, None, None, None, None, None, None, '_ibl_trials.stimOff_times.npy', None, None, None, None, '_ibl_trials.table.pqt', '_ibl_wheel.timestamps.npy', '_ibl_wheel.position.npy', '_ibl_wheelMoves.intervals.npy', '_ibl_wheelMoves.peakAmplitude.npy')
- var_names = ('intervals_bpod', 'goCueTrigger_times', 'stimOnTrigger_times', 'stimOffTrigger_times', 'stimFreezeTrigger_times', 'errorCueTrigger_times', 'errorCue_times', 'itiIn_times', 'stimFreeze_times', 'stimOff_times', 'valveOpen_times', 'phase', 'position', 'quiescence', 'table', 'wheel_timestamps', 'wheel_position', 'wheelMoves_intervals', 'wheelMoves_peakAmplitude')
- bpod_rsync_fields = ('intervals', 'response_times', 'goCueTrigger_times', 'stimOnTrigger_times', 'stimOffTrigger_times', 'stimFreezeTrigger_times', 'errorCueTrigger_times')
- bpod_fields = ('feedbackType', 'choice', 'rewardVolume', 'contrastLeft', 'contrastRight', 'probabilityLeft', 'intervals_bpod', 'phase', 'position', 'quiescence')
- extract_all(session_path, sync_collection='raw_ephys_data', save=True)[source]
- For the IBL ephys task, reads ephys binary file and extract:
sync
wheel
behaviour
video time stamps
- Parameters
session_path – ‘/path/to/subject/yyyy-mm-dd/001’
save – Bool, defaults to False
- Returns
outputs, files
- get_sync_and_chn_map(session_path, sync_collection)[source]
Return sync and channel map for session based on collection where main sync is stored
- Parameters
session_path –
sync_collection –
- Returns