SpikeDerivedCurrentMixin

class SpikeDerivedCurrentMixin(spikes: Tensor, to_currents: Callable[[InfernoSynapse, dtype, device, Tensor], Tensor], interp: Interpolation, interp_kwargs: dict[str, Any], current_overbound: float | None, spike_overbound: bool | None, tolerance: float)[source]

Bases: SpikeMixin

Mixin for synapses with spikes and currents derived therefrom.

Parameters:
  • spikes (torch.Tensor) – initial input spikes.

  • to_currents (Callable[[InfernoSynapse, torch.dtype, torch.device, torch.Tensor], torch.Tensor]) – function which takes the synapse, data type, device, and a tensor of spikes, and returns the corresponding current.

  • interp (Interpolation) – interpolation function used when selecting prior spikes and currents derived therefrom.

  • interp_kwargs (dict[str, Any]) – keyword arguments passed into the interpolation function.

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

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

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

property current: Tensor

Currents of the synapses at present, in nanoamperes.

Parameters:

value (torch.Tensor) – new synapse currents.

Returns:

present synaptic currents.

Return type:

torch.Tensor

Note

The setter does nothing as currents are derived from spikes.

current_at(selector: Tensor) Tensor[source]

Retrieves previous synaptic currents, in nanoamperes.

Parameters:

selector (torch.Tensor) – time before present for which synaptic currents should be retrieved, in \(\text{ms}\).

Returns:

selected synaptic currents.

Return type:

torch.Tensor

Shape

selector:

\(B \times N_0 \times \cdots \times [D]\)

return:

\(B \times N_0 \times \cdots \times [D]\)

Where:
  • \(B\) is the batch size.

  • \(N_0 \times \cdots\) is the shape of the synapse.

  • \(D\) is the number of selectors per synapse.