SingleExponentialCurrent

class SingleExponentialCurrent(shape: Sequence[int] | int, step_time: float, *, spike_charge: float, time_constant: float, delay: float = 0.0, spike_interp_mode: Literal['nearest', 'previous'] = 'previous', interp_tol: float = 0.0, current_overbound: float | None = 0.0, spike_overbound: bool | None = False, batch_size: int = 1, inplace: bool = False)[source]

Bases: SpikeCurrentMixin, InfernoSynapse

Instantly applied exponentially decaying current-based synapse.

\[I(t + \Delta t) = I(t) \exp\left(-\frac{\Delta t}{\tau}\right) + \frac{Q}{\tau} [t = t_f]\]
spike_

RecordTensor interface for spikes.

current_

RecordTensor interface for currents.

Parameters:
  • shape (Sequence[int] | int) – shape of the group of synapses being simulated.

  • step_time (float) – length of a simulation time step, \(\Delta t\), in \(\text{ms}\).

  • spike_charge (float) – charge carried by each presynaptic spike, \(Q\), in \(\text{pC}\).

  • time_constant (float) – exponential time constant for current decay, \(\tau\), in \(\text{ms}\).

  • delay (float, optional) – maximum supported delay, in \(\text{ms}\). Defaults to 0.0.

  • spike_interp_mode (Literal["nearest", "previous"], optional) – interpolation mode for spike selectors between observations. Defaults to "nearest".

  • interp_tol (float, optional) – maximum difference in time from an observation to treat as co-occurring, in \(\text{ms}\). Defaults to 0.0.

  • current_overbound (float | None, optional) – value to replace currents out of bounds, uses values at observation limits if None. Defaults to 0.0.

  • spike_overbound (bool | None, optional) – value to replace spikes out of bounds, uses values at observation limits if None. Defaults to False.

  • batch_size (int, optional) – size of input batches for simulation. Defaults to 1.

  • inplace (bool) – if write operations on RecordTensor attributes should be performed with in-place operations. Defaults to False.

See also

For more details and references, visit Single Exponential in the zoo.

clear(**kwargs) None[source]

Resets synapses to their resting state.

forward(*inputs: Tensor, **kwargs) Tensor[source]

Runs a simulation step of the synaptic dynamics.

Parameters:

*inputs (torch.Tensor) – input spikes to the synapse.

Returns:

synaptic currents after simulation step.

Return type:

torch.Tensor

classmethod partialconstructor(spike_charge: float, time_constant: float, spike_interp_mode: Literal['nearest', 'previous'] = 'previous', interp_tol: float = 0.0, current_overbound: float | None = 0.0, spike_overbound: bool | None = False, inplace: bool = False)[source]

Returns a function with a common signature for synapse construction.

Parameters:
  • spike_charge (float) – charge carried by each presynaptic spike, in \(\text{pC}\).

  • time_constant (float) – exponential time constant for current decay, in \(\text{ms}\).

  • spike_interp_mode (Literal["nearest", "previous"], optional) – interpolation mode for spike selectors between observations. Defaults to "nearest".

  • interp_tol (float, optional) – maximum difference in time from an observation to treat as co-occurring, in \(\text{ms}\). Defaults to 0.0.

  • current_overbound (float | None, optional) – value to replace currents out of bounds, uses values at observation limits if None. Defaults to 0.0.

  • spike_overbound (bool | None, optional) – value to replace spikes out of bounds, uses values at observation limits if None. Defaults to False.

  • inplace (bool) – if write operations on RecordTensor attributes should be performed with in-place operations. Defaults to False.

Returns:

partial constructor for synapse.

Return type:

SynapseConstructor