frites.utils.time_to_sample#

frites.utils.time_to_sample(values, sf=None, times=None, round='closer', verbose=None)[source]#

Convert values from time to sample space.

Parameters
valuesnumpy:array_like

Array of values to convert.

sfpython:float | python:None

Sampling frequency. If None, the time vector can also be supplied to infer it.

timesnumpy:array_like | python:None

Time vector used to infer the sampling frequency.

round{‘lower’, ‘closer’, ‘upper’}

Use either lower, closer or upper rounding. Default is closer

Returns
valuesnumpy:array_like

Values converted to sample space.