SinStimulus

class spikeometric.stimulus.SinStimulus(amplitude: float, period: float, duration: int, stimulus_masks: torch.Tensor, batch_size: int = 1, phase: float = 0.0, baseline: float = 0, start: float = 0.0, dt: float = 1.0)[source]

Bases: spikeometric.stimulus.base_stimulus.BaseStimulus

Sinusoidal stimulus of neurons.

The stimulus is a sinusoidal function with amplitude \(A\), period \(T\), and phase \(\phi\). The stimulus starts at time \(t_0\) and lasts for a duration \(\tau\).

Parameters
  • amplitude (float) – Amplitude \(A\) of stimulus.

  • period (float) – Period \(T\) of stimulus

  • duration (int) – Duration \(\tau\) stimulus in total

  • stimulus_masks – A mask of shape (n_neurons,) indicating which neurons to stimulate.

  • batch_size (int) – The number of networks to stimulate in parallel.

  • phase (float) – Phase of stimulus \(\phi\)

  • baseline (float) – The constant baseline of the stimulus.

  • start (float) – Start time \(t_0\) of stimulus.

  • dt (float) – Time step \(\Delta t\) of the simulation in ms.

__call__(t: Union[float, torch.Tensor]) torch.Tensor[source]

Computes stimulus at time t by applying a sinusoidal function.

Between the start time \(t_0\) and the end time \(t_0 + \tau\), the stimulus is given by

\[f(t) = A \sin \left( \frac{2 \pi}{T} (t - t_0)\Delta t + \phi \right)\]