neurodsp.utils.data.compute_nsamples

neurodsp.utils.data.compute_nsamples(n_seconds, fs)[source]

Calculate the number of samples for a given time definition.

Parameters
n_secondsfloat

Signal duration, in seconds.

fsfloat

Signal sampling rate, in Hz.

Returns
n_samplesint

The number of samples.

Notes

The result has to be rounded, in order to ensure that the number of samples is a whole number. By convention, this rounds up, which is needed to ensure that cycles don’t end up being shorter than expected, which can lead to shorter than expected signals, after concatenation.