DoubleExponentialCurrent¶
- class DoubleExponentialCurrent(shape: Sequence[int] | int, step_time: float, *, spike_charge: float, tc_decay: float, tc_rise: 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:
SpikeMixin,InfernoSynapseExponentially applied exponentially decaying current-based synapse.
\[\begin{split}\begin{align*} I(t) &= I_d(t) - I_r(t) \\ I_d(t + \Delta t) &= I_d(t) \exp \left(-\frac{\Delta t}{\tau_d}\right) + \frac{Q}{\tau_d - \tau_r} \left[t = t_f\right] \\ I_r(t + \Delta t) &= I_r(t) \exp \left(-\frac{\Delta t}{\tau_r}\right) + \frac{Q}{\tau_d - \tau_r} \left[t = t_f\right] \end{align*}\end{split}\]- spike_¶
RecordTensorinterface for spikes.
- pos_current_¶
RecordTensorinterface for added currents.
- neg_current_¶
RecordTensorinterface for subtracted 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}\).
tc_decay (float) – exponential time constant for current decay, \(\tau_d\), in \(\text{ms}\).
tc_rise (float) – exponential time constant for current rise, \(\tau_r\), 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 to0.0.spike_overbound (bool | None, optional) – value to replace spikes out of bounds, uses values at observation limits if
None. Defaults toFalse.batch_size (int, optional) – size of input batches for simulation. Defaults to
1.inplace (bool) – if write operations on
RecordTensorattributes should be performed with in-place operations. Defaults toFalse.
See also
For more details and references, visit Double Exponential in the zoo.
- property current: Tensor¶
Currents of the synapses at present, in nanoamperes.
- Parameters:
value (torch.Tensor) – new synapse currents.
- Returns:
present synaptic currents.
- Return type:
Important
The setter for this property does nothing as current is a derived value. Use the
pos_currentandneg_currentsetters for this instead.
- 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:
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.
- 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:
- property neg_current: Tensor¶
Negative component of currents of the synapses at present, in nanoamperes.
- Parameters:
value (torch.Tensor) – new negative component of synapse currents.
- Returns:
present negative component of synaptic currents.
- Return type:
- neg_current_at(selector: Tensor) Tensor[source]¶
Retrieves negative component of previous synaptic currents, in nanoamperes.
- Parameters:
selector (torch.Tensor) – time before present for which negative component of synaptic currents should be retrieved, in \(\text{ms}\).
- Returns:
selected negative component of synaptic currents.
- Return type:
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.
- classmethod partialconstructor(spike_charge: float, tc_decay: float, tc_rise: 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}\).
tc_decay (float) – exponential time constant for current decay, in \(\text{ms}\).
tc_rise (float) – exponential time constant for current rise, 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 to0.0.spike_overbound (bool | None, optional) – value to replace spikes out of bounds, uses values at observation limits if
None. Defaults toFalse.inplace (bool) – if write operations on
RecordTensorattributes should be performed with in-place operations. Defaults toFalse.
- Returns:
partial constructor for synapse.
- Return type:
- property pos_current: Tensor¶
Positive component of currents of the synapses at present, in nanoamperes.
- Parameters:
value (torch.Tensor) – new positive component of synapse currents.
- Returns:
present positive component of synaptic currents.
- Return type:
- pos_current_at(selector: Tensor) Tensor[source]¶
Retrieves positive component of previous synaptic currents, in nanoamperes.
- Parameters:
selector (torch.Tensor) – time before present for which positive component of synaptic currents should be retrieved, in \(\text{ms}\).
- Returns:
selected positive component of synaptic currents.
- Return type:
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.