ibllib.io.extractors.ephys_fpga

Data extraction from raw FPGA output Complete FPGA data extraction depends on Bpod extraction

Functions

extract_all

For the IBL ephys task, reads ephys binary file and extract:

extract_behaviour_sync

Extract wheel positions and times from sync fronts dictionary

extract_sync

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_sync

Extract wheel positions and times from sync fronts dictionary for all 16 chans Output position is in radians, mathematical convention :param sync: dictionary ‘times’, ‘polarities’ of fronts detected on sync trace :param chmap: dictionary containing channel indices. Default to constant. chmap = {‘rotary_encoder_0’: 13, ‘rotary_encoder_1’: 14} :return: timestamps (np.array) :return: positions (np.array).

get_ibl_sync_map

Gets default channel map for the version/binary file type combination :param ef: ibllib.io.spikeglx.glob_ephys_file dictionary with field ‘ap’ or ‘nidq’ :return: channel map dictionary

get_main_probe_sync

From 3A or 3B multiprobe session, returns the main probe (3A) or nidq sync pulses with the attached channel map (default chmap if none) :param session_path: :return:

get_sync_fronts

Classes

FpgaTrials

ProbaContrasts

Bpod pre-generated values for probabilityLeft, contrastLR, phase, quiescence

get_ibl_sync_map(ef, version)[source]

Gets default channel map for the version/binary file type combination :param ef: ibllib.io.spikeglx.glob_ephys_file dictionary with field ‘ap’ or ‘nidq’ :return: channel map dictionary

get_sync_fronts(sync, channel_nb, tmin=None, tmax=None)[source]
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 :param sync: dictionary ‘times’, ‘polarities’ of fronts detected on sync trace :param 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, tmax=inf)[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)[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_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) :param session_path: :return:

class ProbaContrasts(session_path=None)[source]

Bases: ibllib.io.extractors.base.BaseBpodTrialsExtractor

Bpod pre-generated values for probabilityLeft, contrastLR, phase, quiescence

save_names = ('_ibl_trials.contrastLeft.npy', '_ibl_trials.contrastRight.npy', None, None, '_ibl_trials.probabilityLeft.npy', None)
var_names = ('contrastLeft', 'contrastRight', 'phase', 'position', 'probabilityLeft', 'quiescence')
static get_pregenerated_events(bpod_trials, settings)[source]
class FpgaTrials(*args, **kwargs)[source]

Bases: ibllib.io.extractors.base.BaseExtractor

save_names = ('_ibl_trials.feedbackType.npy', '_ibl_trials.choice.npy', '_ibl_trials.rewardVolume.npy', '_ibl_trials.intervals_bpod.npy', '_ibl_trials.intervals.npy', '_ibl_trials.response_times.npy', '_ibl_trials.goCueTrigger_times.npy', None, None, None, None, None, '_ibl_trials.feedback_times.npy', '_ibl_trials.goCue_times.npy', None, None, '_ibl_trials.stimOff_times.npy', '_ibl_trials.stimOn_times.npy', None, '_ibl_trials.firstMovement_times.npy', '_ibl_wheel.timestamps.npy', '_ibl_wheel.position.npy', '_ibl_wheelMoves.intervals.npy', '_ibl_wheelMoves.peakAmplitude.npy')
var_names = ('feedbackType', 'choice', 'rewardVolume', 'intervals_bpod', 'intervals', 'response_times', 'goCueTrigger_times', 'stimOnTrigger_times', 'stimOffTrigger_times', 'stimFreezeTrigger_times', 'errorCueTrigger_times', 'errorCue_times', 'feedback_times', 'goCue_times', 'itiIn_times', 'stimFreeze_times', 'stimOff_times', 'stimOn_times', 'valveOpen_times', 'firstMovement_times', 'wheel_timestamps', 'wheel_position', 'wheelMoves_intervals', 'wheelMoves_peakAmplitude')
extract_all(session_path, save=True, bin_exists=False)[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