spiketools.utils.timestamps.infer_time_unit

spiketools.utils.timestamps.infer_time_unit(time_values)[source]

Infer the time unit of given time values.

Parameters:
time_values1d array

Time values.

Returns:
time_unit{‘seconds’, ‘milliseconds’}

The inferred time unit of the input data.

Examples

Infer the time unit of an array of time values:

>>> time_values = np.array([0.002, 0.01, 0.05, 0.1, 2])
>>> infer_time_unit(time_values)
'seconds'