calix.spiking.neuron_threshold.LeakOverThresholdCalib
-
class
calix.spiking.neuron_threshold.
LeakOverThresholdCalib
(target: quantities.quantity.Quantity = array(100.) * kHz) Bases:
calix.spiking.neuron_threshold._SpikeCounterCalib
Calibrate the neurons’ spike threshold such that the given spike rate is achieved in a leak over threshold setup, without any synaptic input.
Requirements: * The leak potential is set sufficiently high and the reset potential
is set sufficiently low, such that there is some range for the threshold potential in between the two.
While the target spike rates can be different between neurons, their dynamic range is limited to roughly a factor of 10 (i.e. the maximum target should not be more than 10 times the minimum target). This is due to the precision of the spike counter: Slowly spiking neurons would spike only a few times during the accumulation time, while quickly spiking neurons would almost saturate the counter. You can work around this by running the calibration multiple times and cherry-picking from the results.
- Variables
threshold_at_reset – Threshold parameters calibrated at the reset potential. Will be used as a lower boundary during the calibration to spike rates.
parameters – Latest threshold parameters configured on the chip, saved during configure_parameters and reused during measure_results. There, we compare them against threshold_at_reset in order to keep the threshold potential above the reset potential.
-
__init__
(target: quantities.quantity.Quantity = array(100.) * kHz) - Parameters
target – Target spike rate in leak over threshold setup.
Neurons with a target of 0 are calibrated to an arbitrary firing rate between the maximum and minimum requested value. :raises ValueError: if the target is negative or all zero.
Methods
__init__
([target])- param target
Target spike rate in leak over threshold setup.
configure_parameters
(builder, parameters)Configure the given spike threshold potentials in the given builder.
measure_results
(connection, builder)Measures the spike rate without synaptic input.
prelude
(connection)Measure reset potential and store it as a lower boundary for the parameter space.
-
configure_parameters
(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder, parameters: numpy.ndarray) → calix.common.base.WriteRecordingPlaybackProgramBuilder Configure the given spike threshold potentials in the given builder.
Also saves the parameters in an ivar, so we can check them against the minimum feasible range (at the reset potential) later.
Note: Saving the parameters is part of working around a bug in the digital neuron backend. On HICANN-X v3, it may be possible to use the base function if the bug is fixed.
- Parameters
builder – Builder to append configuration instructions to.
parameters – Threshold potential for each neuron.
- Returns
Builder with configuration appended.
-
measure_results
(connection: pyhxcomm_vx.ConnectionHandle, builder: calix.common.base.WriteRecordingPlaybackProgramBuilder) → numpy.ndarray Measures the spike rate without synaptic input.
Measure number of spikes with spike counters. Also, the previously configured parameters are inspected: If they indicate the threshold is set below the reset potential, a high spike count is returned, in order to have the threshold potential be increased by the algorithm.
Note: The replacing low spike counts with high numbers works around a bug in the digital neuron backend. On HICANN-X v3, it may be possible to just use the base function, if the bug is fixed.
- Parameters
connection – Connection to a chip.
builder – Builder to append read instructions to.
- Returns
Array with the number of spikes during the accumulation time. If the counter has overflown, the value is set to a high value.
-
prelude
(connection: pyhxcomm_vx.ConnectionHandle) Measure reset potential and store it as a lower boundary for the parameter space.
Since the spike rate will be zero both if the threshold is too high (above the leak) or too low (below the reset), we calibrate the threshold at reset potential and will later use these value as a lower boundary for feasible parameters.
Note: This is likely caused by a bug in the digital neuron backend. Starting with HICANN-X v3, it may be possible to drop this entire prelude, as spike rates should then be highest if the threshold is lower than the reset.
- Parameters
connection – Connection to the chip to run on.