spiketools.utils.timestamps.convert_time_to_nsamples

spiketools.utils.timestamps.convert_time_to_nsamples(time, fs)[source]

Convert a time length into the corresponding number of samples.

Parameters:
timefloat

Time duration.

fsint

Sampling rate.

Returns:
n_samplesint

Number of samples.

Examples

Convert a time length to a number of samples:

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