ibllib.io.extractors.passive

functions used in passive_script

Functions

check_n_ttl_between

Check number of TTL pulses found in between 2 timestamps.

check_polarity

Check polarity of stimulus, and remove values as necessary :param pol: polarity values (-1 or 1) :param key_stim: key (visual stim.

ephysCW_end

Return time (second) at which ephysCW ends :param session_path: path to session :return: time (s) at which ephysCW ends

find_between

Find times and index of TTL pulses happening in between 2 timestamps (s).

get_id_raisefall_from_analogttl

Get index of raise/fall from analog continuous TTL signal (0-1 values) :param ttl_01: analog continuous TTL signal (0-1 values) :return: index up (0>1), index down (1>0), number of ttl transition

get_spacer_times

Find timestamps of spacer signal.

get_times_between

Get times of TTL pulse in between 2 timestamps :param ttl: dict containing times (s) of rising/falling pulses :param t_start_search: time (s) of start search (non inclusive) :param t_end_search: time (s) of end search (non inclusive) :return: times_between: times (s) of TTL pulses found (N adjusted)

interpolate_rf_mapping_stimulus

Interpolate stimulus presentation times to screen refresh rate to match frames :param ttl_01: :type ttl_01: array-like :param times: array of stimulus switch times :type times: array-like :param Xq: number of times (found in frames) :type frames: array-like :param t_bin: period of screen refresh rate :type t_bin: float :return: tuple of (stim_times, stim_frames)

key_value_search

Search key for value in dict key.

key_vis_stim

Appends key to string once key is found.

reshape_RF

Reshape Receptive Field (RF) matrix.

test_interpolate_rf_mapping_stimulus

test_key_value_search

test_key_vis_stim

truncate_ttl_signal

param ttl

dict with 2 keys (polarities and times), values in times in (s)

get_spacer_times(spacer_template, jitter, ttl_signal, t_quiet)[source]

Find timestamps of spacer signal. :param spacer_template: list of indices where ttl signal changes :type spacer_template: array-like :param jitter: jitter (in seconds) for matching ttl_signal with spacer_template :type jitter: float :param ttl_signal: :type ttl_signal: array-like :param t_quiet: seconds between spacer and next stim :type t_quiet: float :return: times of spacer onset/offset :rtype: n_spacer x 2 np.ndarray; first col onset times, second col offset

get_id_raisefall_from_analogttl(ttl_01)[source]

Get index of raise/fall from analog continuous TTL signal (0-1 values) :param ttl_01: analog continuous TTL signal (0-1 values) :return: index up (0>1), index down (1>0), number of ttl transition

reshape_RF(RF_file, meta_stim)[source]

Reshape Receptive Field (RF) matrix. Take data associated to corner where frame2ttl placed to create TTL trace. :param RF_file: vector to be reshaped, containing RF info :param meta_stim: variable containing metadata information on RF :return: frames (reshaped RF), analog trace (0-1 values)

ephysCW_end(session_path)[source]

Return time (second) at which ephysCW ends :param session_path: path to session :return: time (s) at which ephysCW ends

truncate_ttl_signal(ttl, time_cutoff)[source]
Parameters
  • ttl – dict with 2 keys (polarities and times), values in times in (s)

  • time_cutoff – time of cutoff in (s)

Returns

dict with 2 keys (polarities and times), values in times in (s)

find_between(ttl, t_start_search, t_end_search)[source]

Find times and index of TTL pulses happening in between 2 timestamps (s). :param ttl: dict containing times (s) of rising/falling pulses :param t_start_search: time (s) of start search (non inclusive) :param t_end_search: time (s) of end search (non inclusive) :return: times (s) and index

check_polarity(pol, key_stim, times_between)[source]

Check polarity of stimulus, and remove values as necessary :param pol: polarity values (-1 or 1) :param key_stim: key (visual stim. label) :param times_between: times (s) of TTL pulses found (N adjusted) :return:

get_times_between(ttl, t_start_search, t_end_search, key_stim)[source]

Get times of TTL pulse in between 2 timestamps :param ttl: dict containing times (s) of rising/falling pulses :param t_start_search: time (s) of start search (non inclusive) :param t_end_search: time (s) of end search (non inclusive) :return: times_between: times (s) of TTL pulses found (N adjusted)

check_n_ttl_between(n_exp, key_stim, t_start_search, t_end_search, ttl)[source]

Check number of TTL pulses found in between 2 timestamps. :param n_exp: number of TTL expected :param key_stim: key (visual stim. label) :param t_start_search: time (s) of start search (non inclusive) :param t_end_search: time (s) of end search (non inclusive) :param ttl: dict containing times (s) of rising/falling pulses :return: times_between: times (s) of TTL pulses found (N adjusted)

Search key for value in dict key. :param dict_vis: dictionary of labels :param value_search: string to find in dict key :return: key found

key_vis_stim(text_append, dict_vis, value_search)[source]

Appends key to string once key is found. :param text_append: :param dict_vis: dictionary of labels :param value_search: string to find in dict key :return: key in dict with appended string

interpolate_rf_mapping_stimulus(idxs_up, idxs_dn, times, Xq, t_bin)[source]

Interpolate stimulus presentation times to screen refresh rate to match frames :param ttl_01: :type ttl_01: array-like :param times: array of stimulus switch times :type times: array-like :param Xq: number of times (found in frames) :type frames: array-like :param t_bin: period of screen refresh rate :type t_bin: float :return: tuple of (stim_times, stim_frames)

test_key_vis_stim()[source]
test_interpolate_rf_mapping_stimulus()[source]