ibllib.io.extractors.training_wheel

class ibllib.io.extractors.training_wheel.Wheel(session_path=None)
Get wheel data from raw files and converts positions into radians mathematical convention
(anti-clockwise = +) and timestamps into seconds relative to Bpod clock.

Optional: saves _ibl_wheel.times.npy and _ibl_wheel.position.npy

Times: Gets Rotary Encoder timestamps (us) for each position and converts to times. Synchronize with Bpod and outputs

Positions: Radians mathematical convention

ibllib.io.extractors.training_wheel.extract_first_movement_times(wheel_moves, trials, min_qt=None)

Extracts the time of the first sufficiently large wheel movement for each trial. To be counted, the movement must occur between go cue / stim on and before feedback / response time. The movement onset is sometimes just before the cue (occurring in the gap between quiescence end and cue start, or during the quiescence period but sub- threshold). The movement is sufficiently large if it is greater than or equal to THRESH :param wheel_moves: dictionary of detected wheel movement onsets and peak amplitudes for use in extracting each trial’s time of first movement. :param trials: dictionary of trial data :param min_qt: the minimum quiescence period, if None a default is used :return: numpy array of first movement times, bool array indicating whether movement crossed response threshold, and array of indices for wheel_moves arrays

ibllib.io.extractors.training_wheel.extract_wheel_moves(re_ts, re_pos, display=False)

Extract wheel positions and times from sync fronts dictionary :param re_ts: numpy array of rotary encoder timestamps :param re_pos: numpy array of rotary encoder positions :param display: bool: show the wheel position and velocity for full session with detected movements highlighted :return: wheel_moves dictionary

ibllib.io.extractors.training_wheel.get_wheel_position(session_path, bp_data=None, display=False)

Gets wheel timestamps and position. Position is in radian (constant above for radius is 1) mathematical convention. :param session_path: :param bp_data (optional): bpod trials read from jsonable file :param display (optional): (bool) :return: timestamps (np.array) :return: positions (np.array)