bycycle.utils.limit_signal

bycycle.utils.limit_signal(times, sig, start=None, stop=None)[source]

Restrict signal and times to be within time limits.

Parameters:
times1d array

Time definition for the time series.

sig1d array

Time series.

startfloat

The lower time limit, in seconds, to restrict the signal.

stopfloat

The upper time limit, in seconds, to restrict the signal.

Returns:
sig1d array

A limited time series.

times1d array

A limited time definition.

Examples

Restrict a signal and times to the first second:

>>> from neurodsp.sim import sim_bursty_oscillation
>>> from neurodsp.utils import create_times
>>> sig = sim_bursty_oscillation(n_seconds=10, fs=500, freq=10)
>>> times = create_times(n_seconds=10, fs=500)
>>> sig, times = limit_signal(times, sig, start=0, stop=1)