neurodsp.utils.data.compute_cycle_nseconds

neurodsp.utils.data.compute_cycle_nseconds(freq, fs=None)[source]

Compute the length, in seconds, for a single cycle at a particular frequency.

Parameters
freqfloat

Oscillation frequency, in Hz.

fsfloat, optional

Sampling rate, in Hz. If provided, this is used to get a cycle length optimized for the sampling rate.

Returns
n_secondsfloat

The number of seconds of a single cycle at the specified frequency.

Notes

The rounding is used to get a value that works with the sampling rate.