to_samples

to_samples(time_length: str | int, sfreq: float) int[source][source]

Convert a time length to a number of samples.

Parameters:
  • time_length (str | int) – The time length to convert. If a string, it must be a human-readable time, e.g. “10s”.

  • sfreq (float) – The sampling frequency.

Returns:

samples – The number of samples.

Return type:

int