Skip to content

generators.spiking

Data - Generators - Spiking¤

SpikingEventParams dataclass ¤

Bases: StepperParams

Parameters for spiking events.

:param spike: the spiking process, e.g., Poisson process using [PoissonEvents][eerily.generators.utils.events.PoissonEvents]. :param spike_level: the level of spikes, e.g. [GaussianNoise][eerily.generators.utils.noise.GaussianNoise] with some positve mean. This parameter determines the height of the spikes. :param background: the stochastic noise level, e.g. [GaussianNoise][eerily.generators.utils.noise.GaussianNoise].

Source code in eerily/generators/spiking.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
@dataclass(frozen=True)
class SpikingEventParams(StepperParams):
    """
    Parameters for spiking events.

    :param spike: the spiking process, e.g., Poisson process using
        [`PoissonEvents`][eerily.generators.utils.events.PoissonEvents].
    :param spike_level: the level of spikes, e.g.
        [`GaussianNoise`][eerily.generators.utils.noise.GaussianNoise]
        with some positve mean. This parameter determines the height of the spikes.
    :param background: the stochastic noise level, e.g.
        [`GaussianNoise`][eerily.generators.utils.noise.GaussianNoise].
    """

    spike: Iterator
    spike_level: Iterator
    background: Iterator

    def __post_init__(self):
        if self.initial_state is None:
            self.initial_state = 0
        if self.variable_names is None:
            self.variable_names = ["event"]

SpikingEventStepper ¤

Bases: BaseStepper

Calculates the next step in a spiking event.

:param model_params: a dataclass that contains the necessary parameters for the model. e.g., SpikingEventParams

Source code in eerily/generators/spiking.py
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
class SpikingEventStepper(BaseStepper):
    """Calculates the next step in a spiking event.

    :param model_params: a dataclass that contains the necessary parameters for the model.
        e.g., [`SpikingEventParams`][eerily.generators.spiking.SpikingEventParams]
    """

    def compute_step(self) -> Dict[str, float]:
        background = next(self.model_params.background)  # type: ignore
        spike = next(self.model_params.spike)  # type: ignore
        spike_level = next(self.model_params.spike_level)  # type: ignore

        v_next = background + spike * spike_level

        self.current_state = v_next

        return copy.deepcopy(self.current_state)