neurodsp.sim.sim_cycle¶

neurodsp.sim.
sim_cycle
(n_seconds, fs, cycle_type, **cycle_params)[source]¶ Simulate a single cycle of a periodic pattern.
 Parameters
 n_secondsfloat
Length of cycle window in seconds. This is NOT the period of the cycle, but the length of the returned array of the cycle.
 fsfloat
Sampling frequency of the cycle simulation.
 cycle_type{‘sine’, ‘asine’, ‘sawtooth’, ‘gaussian’, ‘exp’, ‘2exp’}
What type of cycle to simulate. Options:
sine: a sine wave cycle
asine: an asymmetric sine wave
sawtooth: a sawtooth wave
gaussian: a gaussian cycle
exp: a cycle with exponential decay
2exp: a cycle with exponential rise and decay
 **cycle_params
Keyword arguments for parameters of the cycle, all as float:
sine: None
asine: rdsym, risedecay symmetry, from 01
sawtooth: width, width of the rising ramp as a proportion of the total cycle
gaussian: std, standard deviation of the gaussian kernel, in seconds
exp: tau_d, decay time, in seconds
2exp: tau_r & tau_d rise time, and decay time, in seconds
 Returns
 cycle: 1d array
Simulated cycle.
Notes
Any function defined in sim.cycles as sim_label_cycle(n_seconds, fs, **params), is accessible by this function. The cycle_type input must match the label.
Examples
Simulate a half second sinusoid, corresponding to a 2 Hz cycle (frequency=1/n_seconds):
>>> cycle = sim_cycle(n_seconds=0.5, fs=500, cycle_type='sine')
Simulate a sawtooth cycle, corresponding to a 10 Hz cycle:
>>> cycle = sim_cycle(n_seconds=0.1, fs=500, cycle_type='sawtooth', width=0.3)