spiketools.utils.timestamps.convert_nsamples_to_time

spiketools.utils.timestamps.convert_nsamples_to_time(n_samples, fs)[source]

Convert a number of samples into the corresponding time length.

Parameters:
n_samplesint

Number of samples.

fsint

Sampling rate.

Returns:
timefloat

Time duration.

Examples

Convert a number of samples to a time length:

>>> convert_nsamples_to_time(5, fs=1000)
0.005