frites.utils.get_closest_sample#

frites.utils.get_closest_sample(ref, values, precision=None, return_precision=False)[source]#

Get the sample of closest value in a reference time vector.

Parameters
refnumpy:array_like

Reference vector

valuesnumpy:array_like

Values to seek in the reference vector

precisionpython:float | python:None

Minimum precision to achieve.

return_precision{python:True, python:False}

If true, the precision of length (n_values,) is also returned

Returns
samplenumpy:array_like

Array of length (n_values,) containing the sample of closest values in the reference vector

precisionsnumpy:array_like

If return_precision, the vector of precisions of length (n_values,) is also returned