API Reference: calix

calix.spiking.neuron._CalibResultInternal : public neuron_dataclasses.CalibResultInternal

Class providing array-like access to calibrated parameters.

Used internally during calibration.

Public Functions

set_neuron_configs_default(self, Union[hal.NeuronConfig.MembraneCapacitorSize, np.ndarray] membrane_capacitance, pq.Quantity tau_syn, Optional[halco.AtomicNeuronOnDLS] readout_neuron=None, Optional[np.ndarray] e_coba_reversal=None)

Fill neuron configs with the given membrane capacitances, but otherwise default values.

:param membrane_capacitance: Desired membrane capacitance (in LSB). :param tau_syn: Synaptic input time constant. Used to decide whether the high resistance mode is enabled. :param readout_neuron: Neuron to enable readout for. :param e_coba_reversal: COBA-mode reversal potential. Used to decide whether to enable COBA mode on a per-neuron basis: If the reversal potential is [+ infinite, - infinite], for excitatory and inhibitory input respectively, CUBA mode will be used. The array can be of shape (2,) providing global values for inhibitory/excitatory synapses or of shape (2, 512) setting the reversal potential for each neuron individually.

to_atomic_neuron(self, halco.AtomicNeuronOnDLS neuron_coord)

Returns an AtomicNeuron with calibration applied.

:param neuron_coord: Coordinate of requirested neuron.

:return: Complete AtomicNeuron configuration.

to_neuron_calib_result(self, NeuronCalibTarget target, NeuronCalibOptions options)

Conversion to NeuronCalibResult.

The numpy arrays get merged into lola AtomicNeurons.

:param target: Target parameters for calibration. :param options: Further options for calibration.

:return: Equivalent NeuronCalibResult.

Public Members

neuron_configs

Public Static Attributes

bool
dtype
ndarray
size
calix.spiking.neuron_threshold._SpikeCounterCalib : public base.Calib

Base class for threshold calibrations that will use the spike counters in order to determine the spike rate of all neurons.

:ivar accumulation_time: Time to record spikes for during calibration. :ivar target: Target number of spikes during accumulation time. Has to be non-zero as the spike threshold would otherwise drift upwards.

Subclassed by calix.spiking.neuron_threshold.LeakOverThresholdCalib, calix.spiking.neuron_threshold.NeuronThresholdCalib

Public Functions

__init__(self)
configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Configure the given spike threshold potentials in the given builder.

:param builder: Builder to append configuration instructions to. :param parameters: Threshold potential for each neuron.

:return: Builder with configuration appended.

measure_results(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

Resets the spike counters, waits for a suitable amount of time, and reads the spike counters.

:param connection: Connection to a chip. :param builder: Builder to append read instructions to.

:return: Array with the number of spikes during the accumulation time. If the counter has overflown, the value is set to a high value.

class calix.hagen.synapse_driver._SynapseDriverResultInternal

Internal result object of a synapse driver calibration.

Holds numpy arrays containing STP ramp currents for each CapMem block, comparator offsets for every driver and their calibration success.

Public Functions

to_synapse_driver_calib_result(self, SynapseDriverCalibOptions options)

Conversion to SynapseDriverCalibResult.

The numpy arrays get transformed to dicts.

:ivar options: Further options for calibration.

:return: Equivalent SynapseDriverCalibResult.

Public Static Attributes

dtype
ndarray
size
calix.common.base.Algorithm : public ABC

Base class for calibration Algorithms.

From here, algorithms are derived, which implement a run() method.

:ivar calibration: Calib instance that contains important parameters and functions for the Algorithm to run.

Subclassed by calix.common.algorithms.BinarySearch, calix.common.algorithms.LinearSearch, calix.common.algorithms.PredictiveModel

Public Functions

__init__(self)
hook_to_calibration(self, Calib calibration)

Make an instance of a calibration known to the algorithm, allowing to use parameters set there.

:param calibration: Instance of calibration class that will be run with this algorithm.

run(self, hxcomm.ConnectionHandle connection, Union[float, int, np.ndarray] target_result)

Function that iterates setting parameters up, testing the results, comparing them to the target result(s) and changing the parameters.

The specifics are implemented in the derived algorithms. Generally, the run function also configures the optimum parameters on hardware, in addition to returning them.

:param connection: Connection that will be used when setting up parameters and measuring results. :param target_result: Target for the calibration. The parameters will be set up such that the results match the target as close as possible. The target can be either a single value that will be used for all instances of parameters or an array containing a specific target for each instance. When using an array, its length has to match n_instances.

:return: Best suited parameters to reach given targets.

unhook_from_calibration(self)

Clear a calibration instance previously hooked to this algorithm.

Public Members

calibration
calix.common.exceptions.AlgorithmError : public Exception

Base class for Exceptions raised from Algorithms.

Subclassed by calix.common.exceptions.ExcessiveNoiseError

calix.spiking.correlation.AmplitudeCalib : public base.Calib

Calibrate the correlation amplitude at delay zero.

Correlation traces are measured in a few quads in all CapMem quadrants. The median amplitude, extrapolated at a delay of zero, is estimated and the CapMem bias currents are tweaked accordingly.

Requirements:

  • CADCs are enabled and calibrated.

  • External correlation voltages (v_res_meas, v_reset) are set.

:ivar measurement: Instance of the correlation measurement class, used for measuring results. :ivar quads: List of synapse quad column coordinates. Measurements from all rows in those quads are taken as an estimate for the characteristics of the whole quadrant. All quads in the list are located in quadrant 0, the measurement is repeated in the other quadrants using corresponding offsets to the coordinates. :ivar log: Logger used to log outputs. :ivar branches: Correlation branch to consider. Choose from causal, acausal or both, using the Enum CorrelationBranches. :ivar parameters: Last configured CapMem parameters.

Public Functions

__init__(self, Optional[Union[float, np.ndarray]] target=0.5, *CorrelationBranches branches=CorrelationBranches.CAUSAL, int amp_calib=0, int time_calib=0)

:param target: Target amplitude per correlated event.

:param amp_calib: Amplitude calibration setting to use in all synapses during measurement. :param time_calib: Time constant calibration setting to use in all synapses during measurement. :param capmem_current_low: Threshold to consider a current generated by the CapMem low. During calibration, the current will be increased in case amplitudes cannot be measured as expected. If the result contains low currents, a warning will be logged.

configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Configure the given store bias currents in the given builder.

:param builder: Builder to append configuration instructions to. :param parameters: Correlation store bias current for each quadrant.

:return: Builder with configuration appended.

measure_results(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

Estimate correlation parameters of each quadrant.

:param connection: Connection to the chip to run on. :param builder: Builder to run before measurements.

:return: Array of each quadrant’s amplitudes.

postlude(self, hxcomm.ConnectionHandle connection)

Log a warning in case resulting CapMem currents are low.

:param connection: Connection to the chip to be calibrated.

prelude(self, hxcomm.ConnectionHandle connection)

Preconfigure the chip for correlation measurements.

:param connection: Connection to the chip to run on.

Public Members

branches
capmem_current_low
log
measurement
parameters
quads
target
calix.hagen.neuron_potentials.BaselineCalib : public cadc.ChannelOffsetCalib

Calibrate all CADC channels offsets such that the neurons read a given value shortly after reset.

Requirements:

  • Neuron membrane readout is connected to the CADCs (causal and acausal).

  • The potential shortly after a neuron reset is stable and does not quickly drift away. Also, it has to be in a suitable range for the CADCs, ideally near the middle of their dynamic range.

Public Functions

__init__(self)
measure_results(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

Read all CADC channels at the neuron’s baseline voltage.

This read is executed multiple times to get a more accurate result.

:param connection: Connection to the chip to run on. :param builder: Builder to append read instructions to.

:return: Array of read values for both synrams.

postlude(self, hxcomm.ConnectionHandle connection)
prelude(self, hxcomm.ConnectionHandle connection)

Public Members

target
calix.common.algorithms.BinarySearch : public calix.common.base.Algorithm

Perform a binary search within the parameter range of a calibration.

Using the class requires basic settings, which come from an instance of a Calib class. Therefore it is required to hook the algorithm to a calibration before calling run(). Calling run(connection, target_result) then performs the calibration. The algorithm starts with the usual binary search algorithms and adds two additional steps in the end. This aims to explore the value above as well as below the last tested value of the normal binary search algorithm. The best-suited parameter tested during the last few steps is returned.

:ivar calibration: Class derived from base class Calib implementing functions for configuring parameters and measuring results as well as yielding important parameters for the algorithm to run. :ivar n_steps: Number of steps to use during calibration. :ivar step_increments: Amount to change parameter with each step. :ivar initial_parameters: Parameters to start calibration with.

:cvar n_steps_best: Number of steps (counted from last) to take into account when finding the best parameters in the end.

Subclassed by calix.common.algorithms.NoisyBinarySearch

Public Functions

__init__(self)
hook_to_calibration(self, base.Calib calibration)

Make an instance of a calibration known to the algorithm, allowing to use parameters set there.

:param calibration: Instance of calibration class that will be run with this algorithm.

run(self, hxcomm.ConnectionHandle connection, Union[int, float, np.ndarray] target_result)

Perform a binary search within given parameter range.

In the end, the parameter is moved by 1 additionally. This way, the result of the binary search and the two neighboring settings are tested and the best-suitable parameter is returned.

:param connection: Connection that will be used when setting up parameters and measuring results. :param target_result: Target for the calibration. The parameters will be set up such that the results match the target as close as possible. The target can be either a single value that will be used for all instances of parameters or an array containing a specific target for each instance. When using an array, its length has to match n_instances.

:return: Best suited parameters to reach given targets.

:raises ValueError: if the measure_parameters() function of the provided calibration class returns an array with bad length. :raises ValueError: if the number of steps to take into account when finding the best parameters in the end is smaller than 3. A value of 3 is required for the additional step to make sense.

Public Members

initial_parameters
n_steps
step_increments
class BoundaryCheckResult

Result object for boundary checks.

Contains:

  • Parameters clipped to a desired parameter range.

  • Boolean mask of parameters which initially exceeded the desired parameter range. Values of True indicate reaching the boundaries.

  • List of strings containing error messages. May be empty, as messages are only returned if errors are given.

calix.common.cadc.CADCCalibOptions : public calix.common.base.CalibOptions

Further configuration parameters for the CADC calibration, that are not directly calibration targets.

:ivar calibrate_offsets: Decide whether the individual channel offsets are calibrated. For standard usecases, including neuron and correlation measurements, this should be enabled (default). Only in case the auto-calibrating correlation reset (cf. hal.CommonCorrelationConfig) is used, this should be disabled.

Public Static Attributes

bool
calix.common.cadc.CADCCalibResult : public calix.common.base.CalibResult

Result object for the CADC calibration.

Contains:

  • Calibrated values for cadc_v_ramp_offset. One per quadrant.

  • Calibrated values for cadc_i_ramp_slope. One per quadrant.

  • Calibrated digital channel offsets. One per channel.

  • Success mask for calibration. Successfully calibrated channels are indicated by True, for any failure the channels will be flagged False. Failing quadrants result in all channels on that quadrant being flagged False.

Public Functions

apply(self, Union[sta.PlaybackProgramBuilder, sta.PlaybackProgramBuilderDumper, base.WriteRecordingPlaybackProgramBuilder] builder)

Apply the calibration into the given builder.

Applying configures and enables the CADC so that it is ready for usage, just like after running the calibration.

:param builder: Builder or dumper to append configuration instructions to.

Public Static Attributes

default_factory
ndarray
calix.common.cadc.CADCCalibTarget : public calix.common.base.CalibTarget

Target parameters for the CADC calibration.

:ivar dynamic_range: CapMem settings (LSB) at the minimum and maximum of the desired dynamic range. By default, the full dynamic range of the CADC is used, which corresponds to some 0.15 to 1.05 V. The voltages are configured as stp_v_charge_0, which gets connected to the CADCs via the CapMem debug readout. :ivar read_range: Target CADC reads at the lower and upper end of the dynamic range.

Public Functions

check_values(self)

Check whether the given parameters are possible within the CapMem and CADC value ranges.

Public Static Attributes

feasible_ranges = {"dynamic_range": base.ParameterRange(70, 550),"read_range": base.ParameterRange(20, 220)}
ParameterRange
calix.hagen.neuron_helpers.CADCReadNeurons : public sta.PlaybackGenerator

Read CADC channels in both synrams, and return a Result object, which interprets the reads as neuron results.

Note that the CADCs have to be connected to the neurons for this to make sense. After the builder has been run, the Result can be evaluated.

Public Functions

generate(cls)

Generate a builder with CADC read instructions for both synrams.

:return: Tuple containing:

  • Builder containing the read instructions.

  • Result object that can be processed.

calix.common.base.Calib : public ABC

Base class for calibration applications.

Accepts parameter range and other generally important settings. From here, Calibrations can be derived, implementing functions for at least measuring results and configuring parameters. Only one-dimensional calibrations are supported, i.e. only one variable is adjusted to move towards a desired target value.

:ivar parameter_range: Allowed range for parameter. :ivar inverted: Invert calibration, i.e. expect a higher parameter returning a lower result. Defaults to False. :ivar n_instances: Number of objects (e.g. neurons) to calibrate. :ivar errors: Error messages to be logged when instances of the calibration have reached the parameter_range boundaries. If None, nothing will be logged. The first (second) error message is used when the lower (upper) bound is reached. Error messages are expected to support the .format() operation. As parameter {0}, the indices of failed instances are inserted, as parameter {1}, the respective boundary value is inserted. :ivar target: Target read for calibration. Can be found during prelude, otherwise needs to be supplied to the run() method. :ivar result: List: Calibrated parameters and success mask. Only available after run() has been called.

:raises ValueError: if parameter_range has a bad shape or is too small.

Subclassed by calix.common.cadc.ChannelOffsetCalib, calix.common.cadc.RampOffsetCalib, calix.common.cadc.RampSlopeCalib, calix.common.madc_base.Calib, calix.common.synapse.DACBiasCalibCADC

Public Functions

__init__(self, ParameterRange parameter_range, int n_instances, bool inverted=False, Optional[List[str]] errors=None)
configure_parameters(self, WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Function to set up parameters for testing.

Use the provided builder to append instructions that configure the provided parameters. Then return the builder again. If one needs to wait between configuring the parameters and measuring, e.g. after setting a new CapMem value, this should be done here.

:param builder: Program Builder to which configuration instructions can be appended. :param parameters: Array of parameters that should be set up. Only integer parameters will be used.

:return: The Program Builder with instructions to set up the given parameters appended.

measure_results(self, hxcomm.ConnectionHandle connection, WriteRecordingPlaybackProgramBuilder builder)

Function to measure the observable.

Typically this will read the CADC channels and return an array of the obtained reads. Use the provided builder to append read instructions, run it using the provided connection. If necessary, treat the results in any way, e.g. calculate statistics per quadrant if calibrating global settings. Then return an array that fits the number of parameters to update.

:param connection: Connection where builder can be executed in order to measure results. :param builder: Builder where instructions to read something can be appended.

:return: An array with the measurement results in a shape that corresponds to the calibration instances. Any type that allows comparison to a calibration target using an operator < is allowed, in particular int and float.

postlude(self, hxcomm.ConnectionHandle connection)

Function to do necessary postconfiguring of the chip.

If not overwritten, this function does nothing.

:param connection: Connection to the chip to be calibrated.

prelude(self, hxcomm.ConnectionHandle connection)

Function to do necessary pre-configuration or other things that are required during the actual calibration, like finding the target values.

If not overwritten, this function does nothing.

:param connection: Connection to the chip to be calibrated.

run(self, hxcomm.ConnectionHandle connection, Algorithm algorithm, Union[numbers.Integral, np.ndarray, None] target=None)

Use the provided algorithm to find optimal parameters.

Calls prelude function, calls algorithm.run(), calls postlude function. If self.target is not defined after the prelude function, the calibration target is required as a parameter to this function.

:param connection: Connection to the chip to calibrate. :param algorithm: Instance of an algorithm to be used for calibration. Will be hooked to the calibration during running and unhooked afterwards. :param target: Target result to be aimed for. If given, this target is used. If None, the attribute self.target is used.

:raises TypeError: If neither the target parameter or the attribute self.target are defined.

:return: ParameterCalibResult, containing the optimal parameters.

Public Members

errors
inverted
n_instances
parameter_range
result
target
calix.common.madc_base.Calib : public calix.common.base.Calib , public calix.common.madc_base.Recorder

Abstract base class for neuron calibrations using the MADC.

During prelude, the MADC is enabled and the current readout section config is saved. During calibration, the readout config is changed continuously to measure one neuron’s properties after another. The stimuli during measurement have to be implemented as well as the evaluation of samples. Also, the recording timing per neuron can be set.

Subclassed by calix.common.synapse.DACBiasCalibMADC

Public Functions

__init__(self, base.ParameterRange parameter_range, bool inverted, Optional[List[str]] errors=None, int n_instances=halco.NeuronConfigOnDLS.size)
evaluate(self, List[np.ndarray] samples)

Process the given array of samples and return an array of results.

The given samples are a list of samples for each neuron. Evaluation will typically involve fitting some parameters. The relevant obtained result is to be returned.

:param samples: MADC samples received per neuron.

:return: Array containing results per neuron.

measure_results(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

Measure and evaluate the results.

Calls record_traces() to acquire an MADC trace per neuron, and calls evaluate() to get an array of results from, e.g., fits.

:param connection: Connection to the chip to calibrate. :param builder: Builder to append measurement program to.

:return: Numpy array, containing evaluated results.

postlude(self, hxcomm.ConnectionHandle connection)

Restore original readout and neuron configuration.

:param connection: Connection to the chip to calibrate.

prelude(self, hxcomm.ConnectionHandle connection)

Prepares chip for the experiment.

Configures the MADC and sets necessary bias currents. Reads and saves readout config and neuron config to restore original state after the experiment.

:param connection: Connection to the chip.

calix_generate_default_calibration.CalibDumper : public metaclass , public ABCMeta

Dumper for calibration data into various formats, e.g.

calix internal, write instructions etc.

Subclassed by calix_generate_default_calibration.CalixFormatDumper, calix_generate_default_calibration.CocoListJsonFormatDumper, calix_generate_default_calibration.CocoListPortableBinaryFormatDumper

Public Functions

dump_calibration(self, CalibResult calibration_result, Path target_file)

Read a calibration result and serialize it to a given file.

:param calibration_result: Calib result to be serialized. :param target_file: Path to the file the result is written to.

format_extension(self)

File extension for the dumped data format, including a leading ‘.

‘.

format_name(self)

Identifier for the dumped data format.

calix.common.exceptions.CalibError : public Exception

Base class for Exceptions raised from Calibs.

Subclassed by calix.common.exceptions.CalibNotSuccessful, calix.common.exceptions.CalibNotSupported, calix.common.exceptions.TooFewSamplesError

calix.common.exceptions.CalibNotSuccessful : public calix.common.exceptions.CalibError

Raised if a calibration fails to run successfully.

This may happen if actions during the prelude fail, which may be a result of not satisfying the calibration’s requirements.

calix.common.exceptions.CalibNotSupported : public calix.common.exceptions.CalibError

Raised if a calibration is not possible with the given algorithm or calibration routine.

calix.common.base.CalibOptions : public ABC

Data structure for collecting other configuration parameters for higher-level calibration functions.

These options are not targets in the sense that they are more technical parameters. They may still affect the result, though.

The available choices (ranges) will be clear from the expected data types. For example, boolean switches can allow to perform the calibration differently, or a priority setting can be applied to some targets, at the cost of accuracy at other targets.

Subclassed by calix.common.cadc.CADCCalibOptions

calix_generate_default_calibration.CalibRecorder : public metaclass , public ABCMeta

Recorder for various calibration results, to be implemented for HAGEN, Spiking etc.

Subclassed by calix_generate_default_calibration.HagenCalibRecorder, calix_generate_default_calibration.HagenSyninCalibRecorder, calix_generate_default_calibration.SpikingCalibRecorder, calix_generate_default_calibration.SpikingCalibRecorder2

Public Functions

calibration_options(self)

Further options for calibration.

calibration_target(self)

Calibration target to be calibrated for.

calibration_type(self)

Identifier for the acquired calibration data.

calix.common.base.CalibResult : public ABC

Data structure for higher-level calibration results, that combine multiple parameters into a logal unit.

Used as base type for hagen and spiking calibration results.

:ivar target: Target parameters that were used to achieve these results. :ivar options: Further options for calibration, that also may affect the results.

Subclassed by calix.common.cadc.CADCCalibResult

Public Functions

apply(self, Union[sta.PlaybackProgramBuilder, sta.PlaybackProgramBuilderDumper] builder)

Apply the saved calib result to the chip.

This function should work with either a builder or a dumper.

:param builder: Builder or dumper to append instructions to.

to_chip(self, Optional[sta.PlaybackProgramBuilderDumper] initial_config=None, Optional[lola.Chip] chip=None)

Apply the calibration into a lola.chip object.

:param initial_config: Optional dumper filled with configuration instructions that have been run before creating the calibration. :param chip: Chip object to merge the calibration into. Defaults to a default-constructed lola.Chip().

:return: Chip object with calibration applied.

class calix.hagen.neuron_dataclasses.CalibResultInternal

Class providing numpy-array access to calibrated parameters.

Used internally during calibration.

Public Functions

to_atomic_neuron(self, halco.AtomicNeuronOnDLS neuron_coord)

Returns an AtomicNeuron with calibration applied.

:param neuron_coord: Coordinate of requested neuron.

:return: Complete AtomicNeuron configuration.

to_neuron_calib_result(self, NeuronCalibTarget target, NeuronCalibOptions options)

Conversion to NeuronCalibResult.

The numpy arrays get merged into lola AtomicNeurons.

:param target: Target parameters for calibration. :param options: Further options for calibration.

:return: Equivalent NeuronCalibResult.

Public Static Attributes

bool
dtype
ndarray
size
calix.common.base.CalibTarget : public ABC

Data structure for collecting targets for higher-level calibration functions into one logical unit.

Targets are parameters that directly affect how a circuit is configured. They have a standard range, where the circuits will work well. Exceeding the standard range may work better for some instances (e.g., neurons) than others.

:cvar feasible_ranges: Dict of feasible ranges for each parameter. Warnings will be logged in case they are exceeded.

Subclassed by calix.common.base.TopLevelCalibTarget, calix.common.cadc.CADCCalibTarget

Public Functions

check(self)

Check types and values of parameters.

check_types(self)

Check whether the given types and shapes of arrays are suitable.

check_values(self)

Check whether the provided target parameters are feasible for calibration.

calix_generate_default_calibration.CalixFormatDumper : public calix_generate_default_calibration.CalibDumper

Dumper for the calix-internal data format.

Public Functions

dump_calibration(self, CalibResult calibration_result, Path target_file)

Read a calibration result and serialize it to a given file.

:param calibration_result: Calib result to be serialized. :param target_file: Path to the file the result is written to.

Public Static Attributes

format_extension = ".pkl"
format_name = "calix-native"
calix.common.cadc.ChannelOffsetCalib : public calix.common.base.Calib

CADC Calibration part 3: Calibrating digital offsets of individual channels.

This is done by setting an intermediate voltage at the CADC debug line and setting the offsets such that all channels read the same result.

As one measurement at constant voltage for all channels suffices, the LinearPrediction algorithm can be used for calibration.

Requirements:

:ivar dynamic_range_mid: Mean of dynamic range min and max. The CADC channels should read medium results (around 120-128) there, if the range and read targets in the previous parts are set up sensible. The voltage is configured as stp_v_charge_0, which has to be connected to the CADCs via the CapMem debug readout. :ivar initial_results: CADC reads before calibrating the offsets. Stored to print statistics after calibration.

Public Functions

__init__(self, hal.CapMemCell.Value dynamic_range_mid=hal.CapMemCell.Value(310))
configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Set up the given CADC channel offsets.

Expects the given parameter array to be ordered like the iter_all of CADCChannelConfigOnDLS.

:param builder: Builder to append configuration instructions to. :param parameters: CADC channel offsets to set.

:return: Builder with configuration instructions appended.

measure_results(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

Read all CADC channels on chip.

:param connection: Connection to the chip to calibrate. :param builder: Builder to append read instructions to.

:return: Array containing integer results for each channel. The order is top causal, top acausal, bottom causal, bottom acausal; within these blocks the channels are ordered from left to right. The order of returned results corresponds to the enums of halco.CADCChannelConfigOnDLS.

postlude(self, hxcomm.ConnectionHandle connection)

Print statistics about the CADC reads before and after calibration.

Data after calibration is measured using the connection.

:param connection: Connection to the chip to run on.

prelude(self, hxcomm.ConnectionHandle connection)

Configure debug readout cell to roughly the middle of the desired dynamic CADC range.

Measure the target read to aim for when calculating the offsets.

:param connection: Connection to the chip to calibrate.

Public Members

dynamic_range_mid
initial_results
target

Public Static Functions

find_target_read(np.ndarray reads)

Inspect a given array of CADC Samples and return the median read of all CADC channels.

This will be used as target read when calculating the individual channel offsets.

If the median of all CADC channels is far off the expected value, a warning is logged.

:param reads: Array of CADC Samples for both synrams obtained at a constant common voltage.

:return: Calib target for individual CADC channel offsets.

calix.hagen.neuron_synin_coba.COBABiasCalib : public base.Calib

Calibration for the COBA synaptic input modulation strength.

To perform this calibration, we first calibrate the leak potential at the target reference potential and measure the CUBA amplitudes. We then calibrate the COBA bias current such that the amplitudes reach zero at the given reversal potential, and remain unchanged at the given reference potential.

To determine the size of the amplitudes at the reversal potential, we need a second voltage where we measure the amplitudes of the synaptic input. We then estimate the amplitude at the reversal potential by a linear extrapolation. This second voltage is normally chosen in between the reference voltage and the reversal potential, close to the latter. In case the distance between reference and this second voltage is too small, or the measurement would fall outside the reliable CADC range, it is chosen differently, compare the doc-string of too_little_separation_mask.

During the calibration, the COBA OTA’s reference potential is re-calibrated each time its bias current was changed. A member coba_reference_calib is used to handle this sub-calibration.

Requirements:

  • CADCs are calibrated and neuron membranes are connected to the CADCs.

  • Synaptic inputs are enabled and calibrated (in CUBA mode) to the paramters desired at e_coba_reference.

:ivar e_coba_reference: Reference potential for COBA mode, where there is no modulation, i.e. the original CUBA amplitude is present. Given in CADC units. May be different than the neurons’ desired leak potential, but must be reachable via the leak term, and allow for some headroom in the reliable CADC range in order to measure synaptic input amplitudes. :ivar e_coba_reversal: Desired COBA reversal potential, i.e. the potential where the amplitude has decreased to 0. Given in CADC units. May exceed the valid range of leak or CADC. :ivar leak_parameters_reference: Calibrated parameters for achieving a leak potential at the target e_coba_reference. :ivar cuba_bias_calib: Instance of the calibration for CUBA synaptic input bias current. Used for measuring synaptic input amplitudes. :ivar coba_reference_calib: Instance of the calibration for the COBA reference potential. Used to re-calibrate the reference each time when touching the bias current. :ivar too_little_separation_mask: Mask containing instances where the measurement that is normally taken near the reversal potential is taken on the other side of the reference potential due to insufficient space in the leak potential range. :ivar max_leak_target: Maximum value of feasible leak potential where synaptic input amplitudes can be measured, i.e. limited by the CADC’s dynamic range. Used as the start point for interpolation of e_coba_reversal. :ivar min_leak_target: Minimum value of feasible leak potential where synaptic input amplitudes can be measured, i.e. limited by the CADC’s dynamic range. Used as the start point for interpolation of e_coba_reversal. :ivar leak_target_reversal: Target for resting potential close to the reversal potential. If there is not enough separation to the reference potential, this target may be at the other side of the reference potential: cf. too_little_separation_mask. :ivar reliable_amplitudes: Target amplitude for CADC-based measurement of syn. input amplitude at COBA reference potential. Also affects the measurement point for the reversal potential as we ensure enough separation. :ivar allowed_deviation: Maximum deviation from resting potential near reversal potential from the intended target. If the deviation is exceeded, the COBA bias current is reduced. :ivar log: Logger used for output.

Subclassed by calix.hagen.neuron_synin_coba.ExcCOBABiasCalib, calix.hagen.neuron_synin_coba.InhCOBABiasCalib

Public Functions

__init__(self, Union[int, np.ndarray] e_coba_reference, Union[int, np.ndarray] e_coba_reversal)
configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Configure the given bias currents on the chip.

:param builder: Builder to append instructions to. :param parameters: Array of CapMem parameters to configure.

:return: Builder with instructions appended.

measure_results(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

Measure the synaptic input amplitudes close to the reversal potential.

Before measurement, the reference potential is re-calibrated.

:param connection: Connection to the chip to run on. :param builder: Builder to be run before measurement.

:return: Array of synaptic input amplitudes when measured near the target reversal potential.

postlude(self, hxcomm.ConnectionHandle connection)

Re-calibrate the reference potentials again after the bias currents have reached their final parameters.

:param connection: Connection to the chip to run on.

prelude(self, hxcomm.ConnectionHandle connection)

Interpolate given potentials to set calibration targets.

Since several events are used to determine the strength of the synaptic inputs, the COBA modulation has to be taken into account when setting the reference potential (compare the documentation of COBAReferenceCalib). We set the integration start potential such that the desired reference potential is at roughly half the expected integrated amplitudes. The obtained leak parameters are saved in order to later switch between this setting and a measurement close to the reversal potential quickly.

We calibrate leak potentials shortly below (above) the desired reference potentials for excitatory (inhibitory) mode. This ensures that the changed membrane potential by integrating amplitudes does not cause a modulating effect already. The desired reference potential is centered within the expected range of integrated amplitudes. The obtained leak parameters are saved in order to later switch between this setting and a measurement close to the reversal potential quickly.

The currently visible (CUBA) amplitude is measured and used for interpolation of the target amplitude at the maximum (or minimum) reachable leak potentials.

:param connection: Connection to the chip to run on.

Public Members

allowed_deviation
coba_reference_calib
cuba_bias_calib
e_coba_reference
e_coba_reversal
leak_parameters_reference
leak_target_reversal
log
max_leak_target
min_leak_target
reliable_amplitudes
target
too_little_separation_mask

Private Functions

_capmem_coord(self)

Coordinate of the capmem COBA bias current to calibrate.

_coba_reference_calib_type(self)

Type of the calibration to use for the COBA reference potential.

_cuba_bias_calib_type(self)

Type of the calibration to use for measuring the synaptic input amplitudes.

_sign(self)

Expected sign of amplitudes, +1 or -1 for excitatory and inhibitory case, respectively.

class calix.spiking.neuron_calib_parts.COBAParameters

Collection of parameters for COBA synaptic input calibration.

:ivar e_coba_reversal: COBA reversal potentials, adjusted in shape as necessary. :ivar e_coba_reference: COBA reference potentials, adjusted in shape and filled with default values where necessary. :ivar calibrate_coba: Decide whether conductance-based calibration routines for the synaptic input are to be called.

Public Functions

__init__(self, neuron.NeuronCalibTarget target)

:param target: Neuron calibration target parameters.

Public Members

calibrate_coba
e_coba_reference
e_coba_reversal
calix.hagen.neuron_synin_coba.COBAReferenceCalib : public base.Calib

Calibrates the COBA reference potential.

The COBA OTA compares the membrane potential with its reference potential and modulates the CUBA bias current accordingly. We calibrate the reference potential such that the COBA OTA does not generate an output current and therefore the original CUBA synaptic amplitude is not modulated.

This calibration needs to be supplied with the original CUBA amplitude as a target and the corresponding parameters how the amplitude was measured. It then adjusts the COBA reference potential such that the original CUBA amplitude is observed. Since the COBA OTA has this reference potential and the membrane potential (here: leak potential) as inputs, the reference potential equals the leak potential after successful calibration.

Requirements:

  • CADC is calibrated and neuron membrane potential is connected to the CADCs.

  • Leak potential is calibrated at the potential where the original CUBA amplitudes should be unchanged. Note that if you use more than one event (n_events > 1) to measure amplitudes, consider setting the leak potential slightly below/above the potential where you want the same strength for a single synaptic event, such that the potential is roughly at half the amplitude of the synaptic events. This will counter the effect of the amplitude modulation due to the COBA circuit.

  • The original CUBA amplitude is supplied as target.

:ivar cuba_bias_calib: Instance of the calibration for CUBA synaptic input bias current. Used for measuring synaptic input amplitudes. :ivar target_potential: Target reference potential in CADC units. :ivar expected_leak_parameters: Leak parameters found at target reference potential with COBA modulation disabled. :ivar allowed_deviation: Allowed deviation of resting potential from given target_potential after COBA modulation is enabled. A high deviation indicates a strong offset current generated from the CUBA synaptic input OTA, which in turn means a strong change in its bias current, i.e. a COBA modulation. Since the COBA modulation should be zero at the reference potential, we counter this state by adjusting the reference parameters. We try to measure the correct direction of parameter update by testing higher and lower parameters. In case the change in resting potential is not significant, which can happen if the reference potential is far off the target, we update the parameters in the direction of the expected leak parameters - which match the expected reference potentials apart from the individual OTA’s offsets. :ivar parameters: Currently configured reference potential parameters. Saved to correct them towards the expected leak parameters if necessary, cf. allowed_deviation. :ivar log: Logger used to log outputs.

Subclassed by calix.hagen.neuron_synin_coba.ExcCOBAReferenceCalib, calix.hagen.neuron_synin_coba.InhCOBAReferenceCalib

Public Functions

__init__(self, int n_events, Union[int, np.ndarray] target_potential, Union[int, np.ndarray] expected_leak_parameters)

:param n_events: Number of events to use during measurement of synaptic input amplitudes.

Has to correspond to how the given target was measured.

configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Configure the given COBA reference potentials.

:param builder: Builder to append instructions to. :param parameters: Array of CapMem parameters to configure.

:return: Builder with instructions appended.

measure_results(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

Measure synaptic input amplitudes.

We reuse the measure_amplitudes function of the CUBA bias calib for this purpose, but skip recalibrating the CUBA OTA’s reference potentials, as its bias is unchanged.

:param connection: Connection to the chip to run on. :param builder: Builder to execute before measuring amplitudes.

:return: Array of measured synaptic input amplitudes.

measure_slope(self, hxcomm.ConnectionHandle connection, int slope_estimation_distance=80)

Measure the change in resting potential with COBA modulation enabled, depending on the COBA reference potential setting.

For two different reference potential settings (one above and one below the currently set reference potentials), the resting potentials are measured. The slope is calculated as the change in resting potential divided by the difference in reference potential settings.

:param connection: Connection to the chip to run on. :param slope_estimation_distance: Amount to decrease (increase) COBA reference potential below (above) the previously configured parameters, in order to estimate the slope. Given in CapMem LSB, used for the lower (upper) measurement.

prelude(self, hxcomm.ConnectionHandle connection)

Calls prelude of CUBA bias calib, which is used for measurements.

:param connection: Connection to the chip to run on.

Public Members

allowed_deviation
cuba_bias_calib
expected_leak_parameters
log
parameters
target_potential

Private Functions

_capmem_coord(self)

Coordinate of the capmem reference voltage to calibrate.

_cuba_bias_calib_type(self)

Type of the calibration to use for measuring the synaptic input amplitudes.

_inverted(self)

Select whether the parameter change needs to be inverted.

calix_generate_default_calibration.CocoListJsonFormatDumper : public calix_generate_default_calibration.CalibDumper

Dumper for the Coordinate-Container-List data in json format with gzip compression.

Public Functions

dump_calibration(self, CalibResult calibration_result, Path target_file)

Read a calibration result and serialize it to a given file.

:param calibration_result: Calib result to be serialized. :param target_file: Path to the file the result is written to.

Public Static Attributes

format_extension = ".json.gz"
format_name = "cocolist"
calix_generate_default_calibration.CocoListPortableBinaryFormatDumper : public calix_generate_default_calibration.CalibDumper

Dumper for the Coordinate-Container-List data in portable binary format.

Public Functions

dump_calibration(self, CalibResult calibration_result, Path target_file)

Read a calibration result and serialize it to a given file.

:param calibration_result: Calib result to be serialized. :param target_file: Path to the file the result is written to.

Public Static Attributes

format_extension = ".pbin"
format_name = "cocolist"
calix.spiking.correlation.CorrelationBranches : public Enum

Select branches of correlation: causal, acausal or both.

Public Functions

axes(self)

Return the appropriate slice to apply to the result data in order to select the respective correlation branches.

:return: Slice to apply along correlation branch dimension of result array.

Public Static Attributes

ACAUSAL = auto()
BOTH = auto()
CAUSAL = auto()
calix_generate_weekly_calibration.CorrelationCalib : public RecorderAndDumper

Public Static Attributes

dumpers = [CalixFormatDumper(),CocoListPortableBinaryFormatDumper(),CocoListJsonFormatDumper()]
recorder = CorrelationCalibRecorder()
calix.spiking.correlation.CorrelationCalibOptions : public base.CalibOptions

Further options for correlation calibration.

:ivar calibrate_synapses: Decide whether individual synapses’ calibration bits shall be calibrated. This requires hours of runtime and may not improve the usability singificantly. :ivar time_constant_priority: Priority given to time constant during individual calibration of synapses. Has to be in the range from 0 to 1, the remaining priority is given to the amplitude. :ivar branches: Correlation traces to consider during calibration. Use the Enum type CorrelationBranches to select from causal, acausal or both. :ivar v_res_meas: Reset voltage for the measurement capacitors. Affects the achievable amplitudes: In case your desired amplitudes cannot be reached at sensible CapMem currents, consider increasing v_res_meas. However, this also increases problems observed on some synapses, like traces no longer behaving exponentially. Generally, you should set this as low as possible - we recommend some 0.9 V. :ivar v_reset: Reset voltage for the accumulation capacitors in each synapse. Controls the baseline measurement when the sensors’ accumulation capacitors were reset and no correlated events were recorded. The baseline read should be near the upper end of the reliable range of the CADC, which is the case when v_reset is set to some 1.85 V. (There’s a source follower circuit in the correlation readout.) :ivar default_amp_calib: Amplitude calibration setting used for all synapses when calibrating CapMem bias currents. Should allow headroom for adjusting amplitudes in both directions if individual synapses are to be calibrated. Otherwise, a value of 0 is recommended. Set sensibly by default. :ivar default_time_calib: Time constant calibration setting used for all synapses when calibrating CapMem bias currents. Should allow headroom for adjusting amplitudes in both directions if individual synapses are to be calibrated. Set sensibly by default.

Public Functions

__post_init__(self)
check(self)

Check if given parameters are in a valid range.

Public Members

default_amp_calib
default_time_calib

Public Static Attributes

bool
CorrelationBranches
float
Quantity
calix_generate_weekly_calibration.CorrelationCalibRecorder : public CalibRecorder

Recorder for a spiking neuron calibration with correlation sensors calibrated.

Public Static Attributes

calibration_options = calix.spiking.SpikingCalibOptions(correlation_options=correlation.CorrelationCalibOptions(calibrate_synapses=True,branches=correlation.CorrelationBranches.CAUSAL,default_amp_calib=1, v_res_meas=0.95 * pq.V))
calibration_target = calix.spiking.SpikingCalibTarget(neuron_target=calix.spiking.neuron.NeuronCalibTarget(tau_syn=5 * pq.us,tau_mem=20 * pq.us,reset=80,leak=100,threshold=130,synapse_dac_bias=1000,i_synin_gm=400),correlation_target=correlation.CorrelationCalibTarget(amplitude=1.5, time_constant=30 * pq.us))
calibration_type = "correlation"
calix.spiking.correlation.CorrelationCalibResult : public base.CalibResult

Result of a synapse correlation sensor calibration.

Holds CapMem bias currents and individual calibration bits.

Public Functions

__post_init__(self)
apply(self, base.WriteRecordingPlaybackProgramBuilder builder)

Apply the calibration in the given builder.

:param builder: Builder or dumper to append configuration instructions to.

Public Static Attributes

default_factory
ndarray
calix.spiking.correlation.CorrelationCalibTarget : public base.CalibTarget

Target parameters for correlation calibration.

:ivar amplitude: Target correlation amplitude (at delay 0) for all synapses, per correlated event. Feasible targets range from some 0.2 to 2.0, higher amplitudes will likely require adjusting v_res_meas. :ivar time_constant: Target correlation time constant for all synapses. Feasible targets range from some 2 to 30 us.

Public Static Attributes

feasible_ranges = {"amplitude": base.ParameterRange(0.2, 2),"time_constant": base.ParameterRange(2 * pq.us, 30 * pq.us)}
float
Quantity
class calix.spiking.correlation_measurement.CorrelationMeasurement

Measurement and evaluation of correlation traces.

Provides functions to measure correlation traces on some quads or the whole chip, and to analyze these traces in order to obtain amplitude and time constant parameters, using fits or calculations.

Requirements:

  • CADCs are enabled and calibrated.

  • External correlation voltages (v_res_meas, v_reset) are set.

:ivar delays: Delay between pre- and postspike for correlated spike pairs. Use negative numbers for anticausal spike pairs. :ivar n_events: Number of correlated events in one measurement. :ivar amp_calib: Amplitude calibration bits for synapses. :ivar time_calib: Time constant calibration bits for synapses. :ivar i_ramp: Correlation time constant calibration CapMem current. :ivar i_store: Correlation amplitude calibration CapMem current. :ivar address: Address to use for presynaptic events. :ivar wait_between_pairs: Wait time between the individual correlated spike pairs. Should be an order of magnitude greater than the largest delay. :ivar log: Logger used to log outputs.

Public Functions

__init__(self, pq.Quantity delays, *int n_events=100, Union[int, np.ndarray] amp_calib=0, Union[int, np.ndarray] time_calib=0, Union[int, np.ndarray] i_ramp=80, Union[int, np.ndarray] i_store=70)
configure_all(self, base.WriteRecordingPlaybackProgramBuilder builder)

Preconfigure the chip for correlation measurements.

:param builder: Builder to append configuration instructions to.

configure_capmem(self, base.WriteRecordingPlaybackProgramBuilder builder)

Configure synapse bias currents for the correlation sensors.

:param builder: Builder to append the configuration to.

configure_synapses(self, base.WriteRecordingPlaybackProgramBuilder builder, halco.SynapseQuadColumnOnDLS quad)

Set the columns of synapses in the given column quad to the given address.

The other synapses are set to address 0. All weights are set to 0. The individual correlation calib bits are set according to the respective ivars.

:param builder: Builder to append configuration instructions to. :param quad: Coordinate of synapse quad column to be set to address.

estimate_fit(self, np.ndarray results)

Guess fit parameters for exponential traces.

The given results are analyzed to estimate amplitude and time constants, without actually running an optimization function. Time constants are calculated by the ratio of decay between successive results, amplitudes are extrapolated as results at zero delay.

This function saves lots of runtime compared to performing the actual exponential fits.

:param results: Measured correlation amplitudes. The data is assumed to be shaped (delays, n_cols, n_rows, causal/acausal), as returned by the measure_quad or measure_chip functions.

:return: Tuple containing two arrays, i.e. the fitted amplitudes per event and time constants. The returned arrays have the same shape as the input, i.e. (n_cols, n_rows, causal/acausal). Values of numpy.nan indicate that the parameters could not be estimated, either as a result of too small amplitudes in the given result array, or in case the amplitudes were equal at different delays.

fit(self, np.ndarray results)

Fit exponential traces to the given correlation data.

The obtained amplitude per correlated event and the time constant are returned.

:param results: Measured correlation amplitudes. The data is assumed to be shaped (delays, n_cols, n_rows, causal/acausal), as returned by the measure_quad or measure_chip functions.

:return: Tuple containing two arrays, i.e. the fitted amplitudes per event and time constants. The returned arrays have the same shape as the input, i.e. (n_cols, n_rows, causal/acausal). Values of numpy.nan indicate that the fitting routine failed and parameters could not be estimated.

measure_chip(self, hxcomm.ConnectionHandle connection)

Measure correlation data for all synapses on chip.

:param connection: Connection to the chip to run on.

:return: Array of correlation measurements, i.e. difference between baseline and result reads. Shaped (len(delays), 512, 256, 2) for the given delays, all columns on chip (following the enumeration of neurons), the synapse rows, and causal/acausal correlation.

measure_quad(self, hxcomm.ConnectionHandle connection, halco.SynapseQuadColumnOnDLS quad, halco.SynramOnDLS synram)

Measure correlation data for the given quad.

:param connection: Connection to the chip to run on. :param quad: Synapse quad column coordinate to measure correlation on. :param synram: Synapse array coordinate to measure correlation on.

:return: Array of correlation measurements, i.e. difference between baseline and result reads. Shaped (len(delays), 4, 256, 2) for the given delays, entries in a quad, the synapse rows, and causal/acausal correlation. Note that the enumeration of entries in a quad is reversed with respect to the enumeration of neurons.

:raises HardwareError: If the observed baseline reads are lower than expected. This can be the case if the hardware setup is not equipped with the v_reset fix and therefore does not receive a high enough voltage to reset the correaltion accumulation capacitors. The fix is explained in [1]. [1]: https://brainscales-r.kip.uni-heidelberg.de/projects/symap2ic/wiki/xboard#putting-a-new-board-into-service # pylint: disable=line-too-long

prelude(self, hxcomm.ConnectionHandle connection)

Preconfigure the chip for correlation measurements.

:param connection: Connection to the chip to run on.

Public Members

address
amp_calib
delays
i_ramp
i_store
log
n_events
time_calib
wait_between_pairs

Public Static Functions

configure_base(base.WriteRecordingPlaybackProgramBuilder builder)

Basic config for reading correlation.

Connect correlation readout to the CADC and configure forwarding of post-pulses to the synapses.

:param builder: Builder to append configuration instructions to.

configure_input(base.WriteRecordingPlaybackProgramBuilder builder)

Configures PADI bus and synapse drivers such that pre-pulses can be sent to all synapse rows.

:param builder: Builder to append configuration instructions to.

fitfunc(float delay, float amplitude, float time_constant, float offset)

Exponential fit function for correlation traces.

calix.common.synapse.DACBiasCalibCADC : public calix.common.base.Calib

Calibrates synapse DAC bias currents such that the amplitudes received at all neurons match those of the weakest quadrant.

The voltage drop on the synapse lines is measured using the CADC. The synaptic inputs are disabled and the synaptic time constant is set maximum. The initial value of the synaptic time constant and input strength are not restored. The digital configuration of the neuron is restored at the end of the calibration.

Requirements:

  • CADCs are connected to the neuron readout.

  • Bias currents are set such that synaptic input lines can be observed on the neuron readout: The neurons’ readout amplifiers and the source followers in the neurons’ synaptic inputs need to be biased.

:ivar original_neuron_config: Neuron configs before calibration, read during prelude, restored in postlude.

Public Functions

__init__(self)
configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Configures the given array of synapse DAC bias currents.

:param builder: Builder to append configuration instructions to. :param parameters: Array of bias currents to set up.

:return: Builder with configuration appended.

measure_results(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

Measures the drop in synaptic input potentials for all synapse columns.

:param connection: Connection to a chip. :param builder: Builder to append read instructions to.

:return: Array containing the median drop in synaptic input potential per quadrant.

postlude(self, hxcomm.ConnectionHandle connection)

Restore original neuron configuration.

:param connection: Connection to the chip to calibrate.

prelude(self, hxcomm.ConnectionHandle connection)

Prepares chip for calibration.

Reads the current neuron configuration which will be restored at the end of the calibration. After that synaptic inputs are disabled. Configures synapse drivers to stimulate the necessary input.

Measures the amplitudes of synapses per quadrant once, calculates the median amplitude per quadrant, and sets the ivar target to the minimum of these median amplitudes (which ensures the target can be reached, in case the maximum bias current of 1022 was used before).

:param connection: Connection to the chip to calibrate.

:raises CalibNotSuccessful: If amplitudes can not be brought into a reliable range by adjusting the number of enabled synapse rows. :raises AssertionError: If the number of enabled synapse rows is not updated in a given iteration. This indicates a bug and should not happen.

Public Members

original_neuron_config
target
calix.common.synapse.DACBiasCalibMADC : public calix.common.madc_base.Calib

Calibrates synapse DAC bias currents such that the amplitudes received at all neurons match those of the weakest quadrant.

The voltage drop on the synapse lines is measured using the MADC. The synaptic inputs are disabled and the synaptic time constant is set maximum. The initial value of the synaptic time constant and input strength are not restored. The digital configuration of the neuron is restored at the end of the calibration.

:ivar neuron_configs: List of neuron configs that will be used as basis for the neuron_config_disabled and neuron_config_readout functions.

Public Functions

__init__(self)
configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Configures the given array of synapse DAC bias currents.

:param builder: Builder to append configuration instructions to. :param parameters: Array of bias currents to set up.

:return: Builder with configuration appended.

evaluate(self, List[np.ndarray] samples)

Evaluates the obtained MADC samples.

Calculates for each trace the peak amplitude (maximum - minimum) and returns the median value of these amplitudes for each quadrant.

:param samples: MADC samples obtained for each neuron.

:return: Median peak amplitude per quadrant.

neuron_config_disabled(self, neuron_coord)

Return a neuron config with readout disabled.

:return: Neuron config with readout disabled.

neuron_config_readout(self, neuron_coord)

Return a neuron config with readout enabled.

:return: Neuron config with readout enabled.

postlude(self, hxcomm.ConnectionHandle connection)

Restore original readout and neuron configuration.

:param connection: Connection to the chip to calibrate.

prelude(self, hxcomm.ConnectionHandle connection)

Prepares chip for calibration.

Disables synaptic inputs. Configures synapse drivers to stimulate the necessary input.

Measures the amplitudes of synapses per quadrant once, calculates the median amplitude per quadrant, and sets the ivar target to the minimum of these median amplitudes (which ensures the target can be reached by all quadrants in case some are already configured to the maximum bias current).

:param connection: Connection to the chip to calibrate.

stimulate(self, base.WriteRecordingPlaybackProgramBuilder builder, halco.NeuronConfigOnDLS neuron_coord, hal.Timer.Value stimulation_time)

Send some PADI events to the synaptic input in order to drop the potential.

:param builder: Builder to append PADI events to. :param neuron_coord: Coordinate of neuron which is currently recorded. :param stimulation_time: Timer value at beginning of stimulation.

:return: Builder with PADI events appended.

Public Members

neuron_configs
sampling_time
target
wait_between_neurons

Private Members

_wait_before_stimulation
calix.hagen.neuron_synin_coba.ExcCOBABiasCalib : public calix.hagen.neuron_synin_coba.COBABiasCalib

Private Static Attributes

_capmem_coord = halco.CapMemRowOnCapMemBlock.i_bias_synin_exc_coba
_coba_reference_calib_type = ExcCOBAReferenceCalib
_cuba_bias_calib_type = neuron_synin.ExcSynBiasCalib
_sign = 1
calix.hagen.neuron_synin_coba.ExcCOBAReferenceCalib : public calix.hagen.neuron_synin_coba.COBAReferenceCalib

Private Static Attributes

_capmem_coord = halco.CapMemRowOnCapMemBlock.e_synin_exc_rev
_cuba_bias_calib_type = neuron_synin.ExcSynBiasCalib
_inverted = False
calix.common.exceptions.ExcessiveNoiseError : public calix.common.exceptions.AlgorithmError

Raised if an algorithm that starts with noise is used with an excessive amount of noise requested on the initial parameters.

If the amount of noise requested leads to hitting the boundaries of the dynamic range of the calibration within the first step, we raise this error as applying this amount of noise is not sensible.

calix.hagen.neuron_synin.ExcSynBiasCalib : public calix.hagen.neuron_synin.SynBiasCalib

Class for calibrating the excitatory synaptic input bias current.

Private Static Attributes

_bias_current_coord = halco.CapMemRowOnCapMemBlock.i_bias_synin_exc_gm
_expected_sign = 1
_log_abbreviation = "exc"
_reference_calib_type = ExcSynReferenceCalib
_row_mode = hal.SynapseDriverConfig.RowMode.excitatory
calix.hagen.neuron_synin.ExcSynReferenceCalib : public calix.hagen.neuron_synin.SynReferenceCalib

Class for calibrating the excitatory synaptic input reference potential.

Private Static Attributes

_bias_current_keyword = "excitatory_biases"
_capmem_parameter_coord = \
_inverted = True
_log_abbreviation = "exc"
calix.hagen.neuron_synin.ExcSynReferenceCalibMADC : public calix.hagen.neuron_synin.SynReferenceCalibMADC

Calibrate excitatory synaptic input reference potential.

Private Static Attributes

_inverted = True
_reference_potential_coord = \
calix.hagen.neuron_synin.ExcSynTimeConstantCalib : public calix.hagen.neuron_synin.SynTimeConstantCalib

Calibrate excitatory synaptic input time constant.

Private Static Attributes

_bias_current_coord = halco.CapMemRowOnCapMemBlock.i_bias_synin_exc_tau
_readout_source = hal.NeuronConfig.ReadoutSource.exc_synin
_row_mode = hal.SynapseDriverConfig.RowMode.excitatory
calix_generate_default_calibration.HagenCalib : public calix_generate_default_calibration.RecorderAndDumper

Public Static Attributes

dumpers = [CalixFormatDumper(),                CocoListPortableBinaryFormatDumper(),                CocoListJsonFormatDumper()]
recorder = HagenCalibRecorder()
calix.hagen.HagenCalibOptions : public base.CalibOptions

Dataclass collecting further options for Hagen-mode calibrations with integration on membranes.

:ivar cadc_options: Further options for CADC calibration. :ivar neuron_options: Further options for neuron calibration. :ivar neuron_disable_leakage: Decide whether the neuron leak bias currents are set to zero after calibration. This is done by default, which disables leakage entirely. Note that even if the leak bias is set to zero, some pseudo-leakage may occur through the synaptic input OTAs. :ivar synapse_driver_options: Further options for synapse driver calibration.

Public Static Attributes

bool
CADCCalibOptions
default_factory
NeuronCalibOptions
calix_generate_default_calibration.HagenCalibRecorder : public calix_generate_default_calibration.CalibRecorder

Recorder for a canonical Hagen-Mode calibration.

Public Static Attributes

calibration_target = HagenCalibTarget()
calibration_type = "hagen"
calix.hagen.HagenCalibResult : public base.CalibResult

Data class containing results of cadc, neuron and synapse driver calibration, all what is necessary for operation in hagen mode when using integration on the neurons’ membranes.

Refer to the documentation of :class:calix.hagen.cadc.CADCCalibResult, :class:calix.hagen.neuron.NeuronCalibResult and :class:calix.hagen.synapse_driver.SynapseDriverCalibResult for details about the contained result objects.

Public Functions

apply(self, base.WriteRecordingPlaybackProgramBuilder builder)

Apply the calib to the chip.

Assumes the chip to be initialized already, which can be done using the stadls ExperimentInit().

:param builder: Builder or dumper to append instructions to.

to_hagen_synin_result(self, hxcomm.ConnectionHandle connection, *Optional[cadc.CADCCalibTarget] cadc_target=None, Optional[cadc.CADCCalibOptions] cadc_options=None, Optional[int] synapse_dac_bias=None)

Reconfigure calibration result for integration on synaptic input lines.

The new result is applied to the chip.

Only the missing parts are recalibrated, which should only take seconds to run. Note that the neuron calibration is dropped as it is not required for integration on synaptic inputs.

:param connection: Connection to the chip to calibrate. :param cadc_target: Target parameters for CADC calibration. :param cadc_options: Further options for CADC calibration. :param synapse_dac_bias: Target value for the synapse DAC bias calibration.

:return: Hagen-mode calibration result for integration on synaptic input lines.

calix.hagen.HagenCalibTarget : public base.TopLevelCalibTarget

Dataclass collecting target parameters for Hagen-mode calibrations with integration on membranes.

:ivar cadc_target: Target parameters for CADC calibration. :ivar neuron_target: Target parameters for neuron calibration.

Public Functions

calibrate(self, hxcomm.ConnectionHandle connection, Optional[HagenCalibOptions] options=None)

Public Static Attributes

CADCCalibTarget
default_factory
NeuronCalibTarget
calix.hagen.synapse_driver.HagenDACOffsetCalib : public base.Calib

Search Hagen-mode DAC offset settings such that drivers yield the same pulse lengths.

Initially, amplitudes at a high STP ramp current and a low hagen-mode DAC potential are measured, corresponding to the maximum available pulse length. We select the DAC offset such that with the desired ramp current, the amplitude starts decreasing from this maximum at a low, but non-zero DAC value (which equals a high, but non-maximum activation). Hence, this alignes the start points of the STP ramps to the start point of the DAC’s dynamic range.

Requirements:

:ivar test_activation: Hagen-mode activation to use when determining the ramp start. Should be high, close but not equal to the maximum activation. :ivar n_parallel_measurements: Number of parallel measurements to execute when measuring results. :ivar maximum_amplitudes: Maximum amplitudes per driver, measured at a high ramp current and high activation. If not supplied otherwise, it will be measured during the prelude. :ivar log: Logger used for printing outputs.

Public Functions

__init__(self)
configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Configure the synapse drivers to the given offsets.

:param builder: Builder to append configuration to. :param parameters: Synapse driver offset settings to configure.

:return: Builder with configuration instructions appended.

measure_maximum_amplitudes(self, hxcomm.ConnectionHandle connection)

Measure the maximum output amplitudes available per driver.

We configure a high ramp current and measure amplitudes at a low address in order to achieve the full pulse length, i.e. the maximum amplitude for each driver.

:param connection: Connection to the chip to be measured.

:return: Array of maximum amplitudes per driver.

measure_results(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

Read output amplitudes of synapse drivers.

:param connection: Connection to the chip to run on. :param builder: Builder that is run before measuring.

:return: Array of synapse drivers’ output amplitudes.

postlude(self, hxcomm.ConnectionHandle connection)

Print the calibrated DAC offsets.

:param connection: Connection to the chip to run on.

prelude(self, hxcomm.ConnectionHandle connection)

Configure synapse array and measure calibration target.

Measure target: median amplitude of all drivers.

:param connection: Connection to the chip to run on.

Public Members

log
maximum_amplitudes
n_parallel_measurements
target
test_activation
calix_generate_default_calibration.HagenSyninCalib : public calix_generate_default_calibration.RecorderAndDumper

Public Static Attributes

dumpers = [CalixFormatDumper(),                CocoListPortableBinaryFormatDumper(),                CocoListJsonFormatDumper()]
recorder = HagenSyninCalibRecorder()
calix.hagen.HagenSyninCalibOptions : public base.CalibOptions

Dataclass collecting further options for Hagen-mode calibrations with integration on synaptic input lines.

:ivar cadc_options: Further options for CADC calibration. :ivar synapse_driver_options: Further options for synapse driver calibration.

Public Static Attributes

CADCCalibOptions
default_factory
calix_generate_default_calibration.HagenSyninCalibRecorder : public calix_generate_default_calibration.CalibRecorder

Recorder for a Hagen-Mode calibration with integration on the synaptic input lines, as opposed to neuron membranes.

Public Static Attributes

calibration_target = HagenSyninCalibTarget()
calibration_type = "hagen_synin"
calix.hagen.HagenSyninCalibResult : public base.CalibResult

Calib results needed for hagen mode integration on the synaptic inputs.

Contains synapse driver calibration, CADC calibration and calibrated bias currents of the synapse DAC.

Refer to the documentation of :class:calix.hagen.cadc.CADCCalibResult and :class:calix.hagen.synapse_driver.SynapseDriverCalibResult for details about the contained result objects.

Public Functions

apply(self, base.WriteRecordingPlaybackProgramBuilder builder)

Apply the calib to the chip.

Assumes the chip to be initialized already, which can be done using the stadls ExperimentInit().

:param builder: Builder or dumper to append instructions to.

calix.hagen.HagenSyninCalibTarget : public base.TopLevelCalibTarget

Dataclass collecting target parameters for Hagen-mode calibrations.

with integration on synaptic input lines.

:ivar cadc_target: Target parameters for CADC calibration. :ivar synapse_dac_bias: Target synapse DAC bias current. Controls the charge emitted to the synaptic input line by a multiplication.

Public Functions

calibrate(self, hxcomm.ConnectionHandle connection, Optional[HagenSyninCalibOptions] options=None)

Public Static Attributes

CADCCalibTarget
default_factory
feasible_ranges = {"synapse_dac_bias": base.ParameterRange(30, hal.CapMemCell.Value.max)}
int
calix.common.exceptions.HardwareError : public Exception

Raised in case the hardware behaves unexpectedly.

neuron_icc_bias.ICCMADCCalib : public madc_base.Calib

Calibrate the inter-compartment conductance time constant of all neurons to the provided target value.

Two neighboring, unconnected neuron circuits are set to different leak potentials. Then the two neurons are connected using the inter-compartment conductance. During that connection process the membrane of the neuron of interest is recorded with the MADC. Throughout this process the leak potential of the neighboring neurons approach one another exponentially. An exponential is fitted to the recorded trace and the bias current responsible for the inter-compartment conductance is tweaked such that the desired value for the time constant is reached.

The membrane potentials decay with a time constant tau_total, which is given by: tau_total = 1 / (2 / tau_icc + 1 / tau_leak) <=> tau_icc = 2 * tau_leak * tau_total / (tau_leak - tau_total)

If the membrane time constant (tau_leak) is large compared to tau_icc, tau_total is approximately half of tau_icc (the factor 2 in the equation above originates from the two membrane time constants of the two involved neurons). For that reason the leak conductance is set minimal during calibration.

This calibration decides whether inter-compartment conductance bias current division or multiplication is required during prelude. The given neuron configs are therefore altered. To be able to measure the total time constant some requirements have to be fulfilled which are set by calling prepare_for_measurement().

Note:

  • Leak potentials should be set alternatingly with a difference of a few 10 LSB (in CADC reads) between even and odd neurons. As the conductance between the compartments depends on the base voltages, it is recommended to choose a range, which will later also be used for experiments.

:ivar neuron_configs: List of desired neuron configurations. Necessary to enable inter-compartment conductance bias division/multiplication. :ivar v_leak: List of target leak potentials. When calibrating the icc the leak potential will be calibrated to the provided leak potentials in the prelude.

Public Functions

__init__(self, pq.quantity.Quantity target=2 *pq.us, np.ndarray v_leak=np.tile([80, 110], int(halco.NeuronConfigOnDLS.size/2)), Optional[List[hal.NeuronConfig]] neuron_configs=None)

:param target: Calib target for the inter-compartment conductance.

Note that we measure the total time constant tau_total. Please refer to the class doc-string for further reading. :param v_leak: Target for the leak potentials. :param neuron_configs: List of neuron configurations. If None, the hagen-mode default neuron config is used for all neurons.

configure_parameters(self, builder, np.ndarray parameters)

Configure the given array of inter-compartment conductance bias currents.

:param builder: Builder to append configuration instructions to. :param parameters: Array of nmda bias currents to set up.

:return: Builder with configuration appended.

evaluate(self, List[np.ndarray] samples)

Evaluates the obtained MADC samples.

To each neuron’s MADC samples, an exponential decay is fitted and the resulting time constant is returned.

:param samples: MADC samples obtained for each neuron.

:return: Array of the fitted total time constants as quantity.

neuron_config_disabled(self, halco.NeuronConfigOnDLS neuron_coord)

Return a neuron config with readout disabled.

:param neuron_coord: Coordinate of neuron to get config for.

:return: Neuron config with readout disabled.

neuron_config_readout(self, halco.NeuronConfigOnDLS neuron_coord)

Return a neuron config with readout active and connected to the readout lines.

:param neuron_coord: Coordinate of neuron to get config for.

:return: Neuron config with readout enabled.

prelude(self, hxcomm.ConnectionHandle connection)

Prepares chip for calibration.

Disable all multicompartment related switches, which are required to be turned off initially during the calibration.

Also measures the inter-compartment conductance time constant at low and high bias currents to decide whether multiplication or division of the bias is required to reach the given targets.

:param connection: Connection to the chip to calibrate.

prepare_for_measurement(self, hxcomm.ConnectionHandle connection, Optional[np.ndarray] v_leak=None)

Set all necessary chip parameters such that a calibration of the inter- compartment conductance can be executed.

In order to calibrate the inter compartment conductance the leak conductance is set to a small value, while preventing the membrane to float. Furthermore, the threshold comparator is disabled as well as the synaptic input. Note: The leak potential between two neighboring neurons on the same hemisphere should be calibrated some 10 LSB apart to ensure a gap large enough for a recordable decay.

:param connection: Connection to the chip to calibrate. :param v_leak: List of targets for the leak potential calibration. If None is given the ivar v_leak will be used.

stimulate(self, builder, halco.NeuronConfigOnDLS neuron_coord, hal.Timer.Value stimulation_wait)

Enables the inter-compartment conductance (ICC) between the compartments resulting in an approach of their membrane potentials.

A multicompartment neuron will be created by connecting two neurons via the somatic line with one ICC enabled. If neuron_coord is even the neuron will be connected with its right neighbor otherwise it will be connected with its left neighbor.

:param builder: Builder to append instructions to. :param neuron_coord: Coordinate of neuron which is currently recorded. :param stimulation_wait: Timer value at beginning of stimulation.

:return: Builder with instructions appended.

Public Members

neuron_configs
sampling_time
target
v_leak
wait_between_neurons

Private Members

_dead_time
_wait_before_stimulation
calix.hagen.neuron_synin_coba.InhCOBABiasCalib : public calix.hagen.neuron_synin_coba.COBABiasCalib

Private Static Attributes

_capmem_coord = halco.CapMemRowOnCapMemBlock.i_bias_synin_inh_coba
_coba_reference_calib_type = InhCOBAReferenceCalib
_cuba_bias_calib_type = neuron_synin.InhSynBiasCalib
_sign = -1
calix.hagen.neuron_synin_coba.InhCOBAReferenceCalib : public calix.hagen.neuron_synin_coba.COBAReferenceCalib

Private Static Attributes

_capmem_coord = halco.CapMemRowOnCapMemBlock.e_synin_inh_rev
_cuba_bias_calib_type = neuron_synin.InhSynBiasCalib
_inverted = True
calix.hagen.neuron_synin.InhSynBiasCalib : public calix.hagen.neuron_synin.SynBiasCalib

Class for calibrating the inhibitory synaptic input bias current.

Private Static Attributes

_bias_current_coord = halco.CapMemRowOnCapMemBlock.i_bias_synin_inh_gm
_expected_sign = -1
_log_abbreviation = "inh"
_reference_calib_type = InhSynReferenceCalib
_row_mode = hal.SynapseDriverConfig.RowMode.inhibitory
calix.hagen.neuron_synin.InhSynReferenceCalib : public calix.hagen.neuron_synin.SynReferenceCalib

Class for calibrating the inhibitory synaptic input reference potential.

Private Static Attributes

_bias_current_keyword = "inhibitory_biases"
_capmem_parameter_coord = \
_inverted = False
_log_abbreviation = "inh"
calix.hagen.neuron_synin.InhSynReferenceCalibMADC : public calix.hagen.neuron_synin.SynReferenceCalibMADC

Calibrate inhibitory synaptic input reference potential.

Private Static Attributes

_inverted = False
_reference_potential_coord = \
calix.hagen.neuron_synin.InhSynTimeConstantCalib : public calix.hagen.neuron_synin.SynTimeConstantCalib

Calibrate inhibitory synaptic input time constant.

Private Static Attributes

_bias_current_coord = halco.CapMemRowOnCapMemBlock.i_bias_synin_inh_tau
_readout_source = hal.NeuronConfig.ReadoutSource.inh_synin
_row_mode = hal.SynapseDriverConfig.RowMode.inhibitory
calix.hagen.neuron_leak_bias.LeakBiasCalib : public base.Calib

Set leak bias currents as low as possible while preventing the membrane voltage from floating and preventing too high membrane noise.

Search all neurons’ leak OTA bias current settings such that the potential does not float away, i.e. the noise in successive CADC reads is close to the given target noise and the resting potential is not far from the expected leak potential CADC value. The leak current is set as low as possible fulfilling this requirement.

When integrating inputs on the neuron, a low leak conductivity is desired. However, some neurons show strong variations on the membrane potential when the leak conductivity is set very low, as the voltage now floats. Some neurons may require a higher leak setting in order to keep the membrane potential from floating.

The noise on the membrane is quantified by reading the CADCs multiple times. The leak current is set such that the target noise is achieved. This yields a minimum leak conductivity while keeping the membrane from floating.

Calling the run() function returns this tuple of parameters:

  • Array of calibrated leak OTA bias current settings

  • Mask of too noisy neurons. False for neurons exceeding the masking_threshold.

Requirements:

  • Neuron membrane readout is connected to the CADCs (causal and acausal).

  • Reset potential is equal to the leak potential.

  • Synaptic inputs are calibrated such that the membrane potential is not affected by constant currents.

:ivar masking_threshold: Threshold for noise to set calibration success to False. Should be higher than the target noise. By default, target + 0.8 is used, as the default noise target is only 1.2 LSB. Note that besides the pure statistical noise, a penalty is added to the “noise” result in case the mean resting potential is far from the expected value, i.e., the potential drifts too far. This pentalty is also considered when finding calibration success. See the function optimization_objective() in measure_results() for the specific penalty conditions. :ivar target_leak_read: Expected CADC reads at leak potential. Used to decide whether the membrane potential is floating.

Public Functions

__init__(self, Union[numbers.Number, np.ndarray] target=1.2, Optional[Union[numbers.Number, np.ndarray]] target_leak_read=None, Optional[Union[numbers.Number, np.ndarray]] masking_threshold=None)

:param target: Noise on each neuron’s CADC reads (standard deviation of successive CADC reads).

configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Configure leak OTA bias currents to the given parameters.

:param builder: Builder to append configuration to. :param parameters: Leak OTA bias current settings for each neuron.

:return: Builder with configuration commands appended.

measure_results(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

Measure the noise on each neuron’s membrane.

To do that, successive CADC reads are done. These happen a small amount of time after a reset. The reset - wait - read scheme is what we will use in hagen mode, therefore we measure the noise in the same fashion. The standard deviation of these reads is treated as noise.

If the resting potential is far from the potential after reset, or the potential after reset is far from the expected leak potential, the membrane potential is assumed to be floating; therefore, the result is artificially increased in order to have the leak bias current increased for these neurons.

:param connection: Connection to the chip to run on. :param builder: Builder to append read instructions to.

:return: Array with standard deviations of CADC reads of each neuron.

postlude(self, hxcomm.ConnectionHandle connection)

Logs warnings for neurons with higher noise and statistics.

Change mask of calibration success to False for neurons with noise significantly higher than the target.

:param connection: Connection to the chip to run on.

prelude(self, hxcomm.ConnectionHandle connection)

Measure the current resting potentials and use them as target_leak_read, if the parameter was not provided.

:param connection: Connection to the chip to run on.

Public Members

masking_threshold
target
target_leak_read
calix.spiking.neuron_threshold.LeakOverThresholdCalib : public 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.

:ivar threshold_at_reset: Threshold parameters calibrated at the reset potential. Will be used as a lower boundary during the calibration to spike rates. :ivar 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.

Public Functions

__init__(self, pq.Quantity target=100 *pq.kHz)

:param 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.

configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

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.

:param builder: Builder to append configuration instructions to. :param parameters: Threshold potential for each neuron.

:return: Builder with configuration appended.

measure_results(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

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.

:param connection: Connection to a chip. :param builder: Builder to append read instructions to.

:return: Array with the number of spikes during the accumulation time. If the counter has overflown, the value is set to a high value.

prelude(self, hxcomm.ConnectionHandle connection)

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.

:param connection: Connection to the chip to run on.

Public Members

accumulation_time
parameters
target
threshold_at_reset
calix.hagen.neuron_potentials.LeakPotentialCalib : public base.Calib

Calibrate the neurons’ leak potentials to match specified CADC reads.

The leak potential parameter is varied until all CADC channels match the median of the original reads or the provided target values.

Requirements:

  • Neuron membrane readout is connected to the CADCs (causal and acausal).

  • Leak bias current is set not too low, such that the resting potential is affected by the leak potential. Note that this calibration has to be re-run after the leak bias current was changed, due to the OTA’s characteristics.

Public Functions

__init__(self, Union[int, np.ndarray] target=None)
configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Configure the given parameters (leak potential settings) in the given builder.

:param builder: Builder to append configuration instructions to. :param parameters: v_leak setting for each neuron.

:return: Builder with configuration appended.

measure_results(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

Measures the membrane potentials of all neurons.

We use the CADCs to take only one measurement of the resting potential and assume this is an accurate representation of the leak potential.

:param connection: Connection to a chip. :param builder: Builder to append read instructions to.

:return: Array containing membrane potential CADC reads.

postlude(self, hxcomm.ConnectionHandle connection)

Print statistics of the neurons’ resting potentials.

:Param connection: Connection to the chip to run on.

prelude(self, hxcomm.ConnectionHandle connection)

If no calibration target was provided during initialization, the current median resting potential is measured and used as a target.

:param connection: Connection to the chip to run on.

Public Members

target
calix.common.algorithms.LinearPrediction : public calix.common.algorithms.PolynomialPrediction

Class implementing a first degree polynomial.

Public Functions

__init__(self, Union[int, np.ndarray] probe_parameters, float offset=0, float slope=1)

:param probe_parameters: Parameter at which a measurement was or will be taken in order to determine the offsets for each calibration instance.

Refer to PolynomialPrediction._predict for details. :param offset: Offset (zeroth-degree) term of the linar function. :param slope: Slope (first-degree) term of the linear function.

calix.common.algorithms.LinearSearch : public calix.common.base.Algorithm

Perform a linear search within the given parameter range to calibrate.

From an initial guess, the parameter is moved in constant steps until the calibration target is crossed.

Initializing the class requires basic settings, which come from an instance of a Calib class. Calling run(connection, target_result) then performs the calibration. The parameters are sweeped until the results crosses the target, or the maximum number of steps is exceeded.

:ivar calibration: Instance of calibration class used to provide settings and functions. :ivar max_steps: Maximum number of steps to use. If set too low, it can limit the available range if the step_size during the calibration is set low. When having reached the target value with all instances, the calibration stops early. :ivar initial_parameters: Initial (guessed) parameters to start algorithm with. :ivar step_size: Amount by which the parameters are moved in every step.

:raises ValueError: If step_size is not a positive number.

Public Functions

__init__(self, Optional[Union[int, np.ndarray]] initial_parameters=None, int step_size=1, int max_steps=50)
run(self, hxcomm.ConnectionHandle connection, Union[float, int, np.ndarray] target_result)

Performs the calibration sweeping the parameter by step_size.

The algorithm starts with the parameters supplied in the argument as a guess. It then moves in steps of step_size towards the target until the result crosses the target. The calibration then stops and returns the parameter that yields the results closest to the target in the last 2 steps, i.e. while testing the values around crossing the threshold.

Note that this function can be called multiple times with different step_sizes in order to approach the target step-wise. Doing so it is important to supply the results of the previous run as parameters.

:param connection: Connection to use during configuring and measuring. :param target_result: Target result for calibration.

:return: Best suited parameters to reach given targets.

:raises TypeError: if step_size does not allow addition. :raises ValueError: if the measure_parameters() function of the provided calibration class returns an array with bad length.

Public Members

initial_parameters
max_steps
step_size
calix.common.madc_base.MembraneRecorder : public calix.common.madc_base.Recorder

Record, plot and save a trace of each neuron via the MADC.

Note that here, the neuron is recorded without any stimuli. You may want to derive a class for your experiment setup and configure a suitable stimulate() function.

Example usage:

Public Functions

neuron_config_disabled(self, halco.NeuronConfigOnDLS neuron_coord)

Return a neuron config in silent state, i.e.

disconnected from the common readout lines.

:param neuron_coord: Coordinate of neuron to get config for.

:return: Neuron config with readout disabled.

neuron_config_readout(self, halco.NeuronConfigOnDLS neuron_coord)

Return a neuron config with readout active and connected to the readout lines.

:param neuron_coord: Coordinate of neuron to get config for.

:return: Neuron config with readout enabled.

stimulate(self, base.WriteRecordingPlaybackProgramBuilder builder, halco.NeuronConfigOnDLS neuron_coord, hal.Timer.Value stimulation_time)

Send no stimuli to the observed neuron.

.. note:: Overwrite this function in order to send arbitrary stimuli during the MADC recording.

E.g., synaptic inputs could be sent to observe their shape.

:param builder: Builder to append stimulation instructions to. :param neuron_coord: Coordinate of neuron which is currently recorded. :param stimulation_time: Timer value at beginning of stimulation.

:return: Builder with stimulation instructions appended.

Public Static Functions

plot_traces(List[np.ndarray] samples)

Plot recorded traces, and save them as png figures.

Each neurons’ trace is plotted in its own figure, saved postfixed with the neuron id from enumerating the list. You may slice the original samples in order to save runtime while plotting.

:param samples: List of recorded MADC samples, as returned by the record_traces() function.

calix.hagen.neuron_leak_bias.MembraneTimeConstCalibCADC : public base.Calib

Find the leak conductivity by resetting the neuron’s membrane to a potential significantly below the leak potential.

The reset potential v_reset is set below the leak potential v_leak. After a reset the membrane voltage rises towards the leak potential v_leak. As the membrane voltage rises, the CADCs are used to read the voltage at a specified time after the reset. The leak bias current gets calibrated such that the voltage after the desired time has risen to v_leak - (v_leak - v_reset)/e. Therefore, the specified time should be roughly the membrane time constant.

The leak potential gets recalibrated every time the bias current is changed, as changing the OTA bias current also changes the required offset between its inputs. The target CADC reads at leak potential are acquired at the beginning of the calibration with the existing neuron configuration. The median of all reads is taken as target.

This class provides functions for configuring leak bias currents and reading the potentials of neurons a specific time after reset.

Requirements:

  • Neuron membrane readout is connected to the CADCs (causal and acausal).

  • The currently selected leak potential is not too low, such that the target_amplitude can still be subtracted from the CADC reads at leak potential without leaving the desired operating range of the leak OTA or the dynamic range of the CADCs.

  • The target membrane time constant is long, above some 30 us.

:ivar target_amplitude: Target amplitude for (v_leak - v_reset), given in CADC reads. :ivar target_time_const: Target membrane time constant. :ivar target_leak_read: Target CADC read at leak potential. :ivar leak_calibration: LeakPotentialCalib class instance used for recalibration of leak potential after changing the bias current.

:raises ValueError: if target_time_constant is not a single value.

Public Functions

__init__(self, pq.quantity.Quantity target_time_const=60 *pq.us, Union[int, np.ndarray] target_amplitude=50)
configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Configure the leak OTA bias currents of all neurons to the given values.

:param builder: Builder to append configuration instructions to. :param parameters: Array of leak OTA bias current settings to configure the CapMem cells to.

:return: Builder with configuration appended.

measure_results(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

Calibrate the leak potentials such that the CADC reads match the read targets.

Reset the neurons and wait for the target time constant. Measure the membrane potentials using the CADCs.

:param connection: Connection to the chip to run on. :param builder: Builder to run.

:return: Array of CADC reads after reset and wait.

postlude(self, hxcomm.ConnectionHandle connection)
prelude(self, hxcomm.ConnectionHandle connection)

Read leak potentials, calibrate reset potential to leak - amplitude.

:param connection: Connection to the chip to run on.

:raises CalibNotSuccessful: If the target CADC read at reset potential is below the reliable range of the CADC for more than 5% of the neurons.

Public Members

leak_calibration
target
target_amplitude
target_leak_read
target_time_const

Private Functions

_reset_wait_read(self, hxcomm.ConnectionHandle connection, int runs_per_builder=100)

Reset neuron, wait for the target time constant, read the neuron’s membrane potentials using the CADCs.

This is done separately for all neurons on the chip. An array of the individual neurons’ reads is returned.

:param connection: Connection to chip to run on. :param runs_per_builder: How many runs to execute in one builder. Choosing too many runs can result in host/FPGA timeouts, as the FPGA program buffer will get full and waiting on chip then prevents the FPGA from accepting new instructions.

:return: Array of all neurons’ CADC reads.

calix.hagen.neuron_leak_bias.MembraneTimeConstCalibOffset : public madc_base.Calib

Measure response to step current with MADC to calibrate the membrane time constant.

Due to the MADC’s high sample rate, an exponential fit on the decaying potential after a step current stimulus is used to determine the membrane time constant. Leak bias currents are tweaked to reach the desired membrane time constant.

This calibration decides whether leak division is required during prelude. The given neuron configs are therefore altered. The original neuron config (configured on chip before running the calibration) is not restored, instead we stay with the config used (and altered) during calibration.

Requirements:

  • Leak potential is calibrated to the desired value. This is useful since the time constant is then calibrated at and above this selected potential.

  • The desired membrane time constant is larger than some 3 us, since leak multiplication is not supported by this calibration.

  • The synaptic input should be on; it should be calibrated or the bias currents should be set to 0. The reason is an effect on the membrane dynamics for some neurons, which looks similar to leakage. We recommend the synaptic input to be enabled and calibrated.

:ivar neuron_configs: List of desired neuron configurations. Necessary to enable leak division. :ivar adjust_bias_range: Enable/disable adjustment of leak division to extend the dynamic range of calibration. By default, this setting is enabled and we select appropriate settings during the prelude.

Public Functions

__init__(self, pq.quantity.Quantity target, Optional[List[hal.NeuronConfig]] neuron_configs=None)

:param neuron_configs: List of neuron configurations.

If None, the hagen-mode default neuron config is used for all neurons.

configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Configure the given array of leak bias currents.

:param builder: Builder to append configuration instructions to. :param parameters: Array of bias currents to set up.

:return: Builder with configuration appended.

evaluate(self, List[np.ndarray] samples)

Evaluates the obtained MADC samples.

To each neuron’s MADC samples, an exponential decay is fitted, and the resulting time constant is returned.

:param samples: MADC samples obtained for each neuron.

:return: Numpy array of fitted synaptic input time constants.

neuron_config_disabled(self, halco.NeuronConfigOnDLS neuron_coord)

Return a neuron config with readout disabled.

:param neuron_coord: Coordinate of neuron to get config for.

:return: Neuron config with readout disabled.

neuron_config_readout(self, halco.NeuronConfigOnDLS neuron_coord)

Return a neuron config with readout enabled.

The step current is alredy enabled here and will be disabled as the stimulus.

:param neuron_coord: Coordinate of neuron to get config for.

:return: Neuron config with readout enabled.

postlude(self, hxcomm.ConnectionHandle connection)

Restore original readout configuration.

The base class postlude is overwritten to not restore the original neuron configuration, as leak division may be altered by this routine.

:param connection: Connection to the chip to calibrate.

prelude(self, hxcomm.ConnectionHandle connection)

Prepares chip for calibration.

Sets a high offset current in all neurons.

Also measures the membrane time constant at low leak bias currents to decide whether leak division is required to reach the given targets.

Leak multiplication is not supported by this calibration: The offset current is too weak to stimulate the membrane significantly if multiplication gets enabled. The calibration can therefore only be used if the target membrane time constant is larger than some 3 us.

:param connection: Connection to the chip to calibrate.

stimulate(self, base.WriteRecordingPlaybackProgramBuilder builder, halco.NeuronConfigOnDLS neuron_coord, hal.Timer.Value stimulation_time)

Disable the membrane offset current.

This results in a decaying potential back to the leak.

:param builder: Builder to append instructions to. :param neuron_coord: Coordinate of neuron which is currently recorded. :param stimulation_time: Timer value at beginning of stimulation.

:return: Builder with neuron resets appended.

Public Members

neuron_configs
sampling_time
target
wait_between_neurons

Private Members

_wait_before_stimulation
calix.hagen.neuron_leak_bias.MembraneTimeConstCalibReset : public madc_base.Calib

Measure neuron reset with the MADC to calibrate the membrane time constant.

Due to the MADC’s high sample rate, an exponential fit on the decaying potential after a reset is used to determine the membrane time constant. Leak bias currents are tweaked to reach the desired value.

The leak and reset potentials are altered to ensure a good amplitude for the fit between the two potentials. The membrane time constant at a (different) desired leak potential may be slightly different. For target membrane time constants above some 3 us, a step current stimulus can be used instead of a reset, therefore not changing the potentials. See MembraneTimeConstCalibOffset for this method.

This calibration decides whether leak division or multiplication is required during prelude. The given neuron configs are therefore altered.

Requirements:

  • None -

:ivar neuron_configs: List of desired neuron configurations. Necessary to enable leak division/multiplication.

Public Functions

__init__(self, pq.quantity.Quantity target=60 *pq.us, Optional[List[hal.NeuronConfig]] neuron_configs=None)

:param neuron_configs: List of neuron configurations.

If None, the hagen-mode default neuron config is used for all neurons.

configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Configure the given array of leak bias currents.

:param builder: Builder to append configuration instructions to. :param parameters: Array of bias currents to set up.

:return: Builder with configuration appended.

evaluate(self, List[np.ndarray] samples)

Evaluates the obtained MADC samples.

To each neuron’s MADC samples, an exponential decay is fitted, and the resulting time constant is returned. This should make for a very precise measurement.

:param samples: MADC samples obtained for each neuron.

:return: Numpy array of fitted synaptic input time constants.

neuron_config_disabled(self, halco.NeuronConfigOnDLS neuron_coord)

Return a neuron config with readout disabled.

:param neuron_coord: Coordinate of neuron to get config for.

:return: Neuron config with readout disabled.

neuron_config_readout(self, halco.NeuronConfigOnDLS neuron_coord)

Return a neuron config with readout enabled.

:param neuron_coord: Coordinate of neuron to get config for.

:return: Neuron config with readout enabled.

postlude(self, hxcomm.ConnectionHandle connection)

Restore original readout configuration.

The base class postlude is overwritten to not restore the original neuron configuration, as leak division and multiplication may be altered by this routine.

:param connection: Connection to the chip to calibrate.

prelude(self, hxcomm.ConnectionHandle connection)

Prepares chip for calibration.

Sets reset potential low and leak high in order to observe a large decay back to the leak potential.

Also measures the membrane time constant at low and high bias currents to decide whether leak multiplication or division is required to reach the given targets.

:param connection: Connection to the chip to calibrate.

stimulate(self, base.WriteRecordingPlaybackProgramBuilder builder, halco.NeuronConfigOnDLS neuron_coord, hal.Timer.Value stimulation_time)

Reset the neuron membrane potential to a low voltage.

:param builder: Builder to append reset instructions to. :param neuron_coord: Coordinate of neuron which is currently recorded. :param stimulation_time: Timer value at beginning of stimulation.

:return: Builder with neuron resets appended.

Public Members

neuron_configs
sampling_time
target
wait_between_neurons

Private Members

_wait_before_stimulation
class calix.hagen.multiplication.Multiplication

Handles multiplication of vector and matrix with integration on the synaptic input lines.

Requirements:

:cvar synram_selection_bit: Position of bit in event label that selects whether an SPL1 event reaches the top or bottom synram. You can choose one of bits 11 to 13 (default).

:ivar _synram_coord: Coordinate of synapse array to use. :ivar num_sends: Number of sends of the vector, values greater than one indicate repetitions of the input events. :ivar wait_period: Number of clock cycles to wait between events. :ivar signed_mode: Decide whether the multiplication is using signed weights. This affects the shape of the matrix: in unsigned mode, i.e. signed_mode = False, weights are shaped (256, 256). If using signed weights, the shape is reduced to (128, 256), i.e. 256 inputs are mapped to 128 results. :ivar cached_reset_synin: Cached builder containing instructions to reset synaptic input lines. Contains a call to reset_synin().

Public Functions

__init__(self, halco.SynramOnDLS synram=halco.SynramOnDLS(), *int num_sends=1, int wait_period=4, bool signed_mode=True)
auto_multiply(self, hxcomm.ConnectionHandle connection, np.ndarray vectors, np.ndarray matrix, *Union[int, str] n_row_repeats=1)

Multiply given vectors with the given matrix.

Handle input shape of the matrix automatically, i.e. split large matrices (containing many inputs) up into multiple runs or repeat small matrices multiple times in order to increase signal. The outer dimension (i.e. number of outputs) has to fit on the width of the synapse array, it is not handled here.

:param connection: Connection to the chip to run on. :param vectors: Array of vectors to be multiplied. We expect row vectors, with the inner dimension (columns) holding the individual entries of each vector. :param matrix: Weight matrix to be multiplied. :param n_row_repeats: Number of repetitions of the weight matrix. In contrast to vector resends, the matrix rows are repeated, which also compensates fixed-pattern noise. Defaults to 1. Select “auto” to fill up the synapse array with a small matrix.

:return: Numpy array with the result of multiplication.

get_synapse_matrix(self, np.ndarray matrix)

Return a suitable lola SynapseMatrix depending on the requested weights.

:param matrix: Weight matrix as a numpy array. :return: lola.SynapseMatrix with addresses and weights set.

multiply(self, hxcomm.ConnectionHandle connection, np.ndarray vectors, np.ndarray matrix)

Multiply given vectors with the given matrix, return results.

The matrix shape has to match the synapse array exactly, there is no splitting or merging of matrix shapes.

:param connection: Connection to the chip to run on. :param vectors: Array of vectors to be multiplied. We expect row vectors, with the inner dimension (columns) holding the individual entries of each vector. :param matrix: Array of weights.

:return: Array of results of the MAC operation.

preconfigure(self, hxcomm.ConnectionHandle connection)

Configure synapse drivers, neurons, crossbar and external DAC.

The previously configured hagen dac offsets and STP ramp offsets are kept unchanged.

:param connection: Connection to the chip to run on.

preconfigure_crossbar(cls, base.WriteRecordingPlaybackProgramBuilder builder)

Configure the crossbar such that the upper bits in an event label select target hemisphere and PADI bus.

Also enable SPL1 events in the PADI buses.

:param builder: Builder to append instructions to.

reset_synin(self, base.WriteRecordingPlaybackProgramBuilder builder)

Connect synapse lines to the debug lines shortly.

The switches for excitatory and inhibitory synaptic currents are enabled.

:param builder: Builder to append instructions to.

synram_coord(self)

Get the synram to perform MAC operations on.

synram_coord(self, value)

Update the synram to perform MAC operations on.

Public Members

cached_reset_synin
num_sends
signed_mode
wait_period

Public Static Functions

configure_for_integration(lola.AtomicNeuron config)

Set static configuration for integration on excitatory synaptic input lines.

:param config: Configuration container to be altered.

preconfigure_dac(base.WriteRecordingPlaybackProgramBuilder builder)

Connect the external DAC to the synapse debug lines, supplying a voltage of 1.2 V.

The potential will be used for resetting potentials on the synapse lines before integration.

:param builder: Builder to append instructions to.

Public Static Attributes

synram_selection_bit = 13

Private Functions

_check_shape(self, np.ndarray vectors, np.ndarray matrix)

Asserts the vecotrs and matrix fit on a synapse array.

:raises ValueError: If the vector or matrix shapres are bad or contain entries outside the feasible range.

_send_vectors(self, np.ndarray vectors)

Send given vectors and multiply them with the previously configured synapse matrix.

Return a list of CADC sample rows containing accumulated results.

:param vectors: Array of vectors to be multiplied. We expect row vectors, with the inner dimension (columns) holding the individual entries of each vector. :return: Tuple containing:

  • Program builder with instructions to send vectors and read results

  • List of CADC sample row tickets, contianing results

Private Members

_synram_coord
calix.hagen.neuron_dataclasses.NeuronCalibOptions : public base.CalibOptions

Further options for the neuron calibration.

:ivar readout_neuron: Coordinate of the neuron to be connected to a readout pad, i.e. can be observed using an oscilloscope. The selected neuron is connected to the upper pad (channel 0), the lower pad (channel 1) always shows the CADC ramp of quadrant 0. The pads are connected via halco.SourceMultiplexerOnReadoutSourceSelection(0) for the neuron and mux 1 for the CADC ramps. When using the internal MADC for recording, these multiplexers can be selected directly. If None is given, the readout is not configured. :ivar initial_configuration: Additional function which is called before starting the calibration. Called with connection, such that the hardware is available within the function. If None (default), no additional configuration gets applied.

calix.spiking.neuron.NeuronCalibOptions : public base.CalibOptions

Further configuration parameters for neuron calibration.

:ivar readout_neuron: Coordinate of the neuron to be connected to a readout pad, i.e. can be observed using an oscilloscope. The selected neuron is connected to the upper pad (channel 0), the lower pad (channel 1) always shows the CADC ramp of quadrant 0. When using the MADC, select halco.SourceMultiplexerOnReadoutSourceSelection(0) for the neuron and mux 1 for the CADC ramps. If None is given, the readout is not configured.

calix.hagen.neuron_dataclasses.NeuronCalibResult : public base.CalibResult

Result object of a neuron calibration.

Holds calibrated parameters for all neurons and their calibration success.

Public Functions

apply(self, base.WriteRecordingPlaybackProgramBuilder builder)

Apply the calibration in the given builder.

Configures neurons in a “default-working” state with calibration applied, just like after the calibration.

:param builder: Builder or dumper to append configuration instructions to.

success_mask(self)

Convert the success dict to a boolean numpy mask.

:return: Numpy array containing neuron calibration success, ordered matching the AtomicNeuronOnDLS enum.

calix.hagen.neuron_dataclasses.NeuronCalibTarget : public base.CalibTarget

Target parameters for the neuron calibration.

:ivar target_leak_read: Target CADC read at resting potential of the membrane. Due to the low leak bias currents, the spread of resting potentials may be high even after calibration. :ivar tau_mem: Targeted membrane time constant while calibrating the synaptic inputs. Too short values can not be achieved with this calibration routine. The default value of 60 us should work. If a target_noise is given (default), this setting does not affect the final leak bias currents, as those are determined by reaching the target noise. :ivar tau_syn: Controls the synaptic input time constant. If set to 0 us, the minimum synaptic input time constant will be used, which means different synaptic input time constants per neuron. If a single different Quantity is given, it is used for all synaptic inputs of all neurons, excitatory and inhibitory. If an array of Quantities is given, it can be shaped (2, 512) for the excitatory and inhibitory synaptic input of each neuron. It can also be shaped (2,) for the excitatory and inhibitory synaptic input of all neurons, or shaped (512,) for both inputs per neuron. :ivar i_synin_gm: Target synaptic input OTA bias current. The amplitudes of excitatory inputs using this target current are measured, and the median of all neurons’ amplitudes is taken as target for calibration of the synaptic input strengths. The inhibitory synaptic input gets calibrated to match the excitatory. Some 300 LSB are proposed here. Choosing high values yields higher noise and lower time constants on the neurons, choosing low values yields less gain in a multiplication. :ivar target_noise: Noise amplitude in an integration process to aim for when searching the optimum leak OTA bias current, given as the standard deviation of successive reads in CADC LSB. Higher noise settings mean longer membrane time constants but impact reproducibility. Set target_noise to None to skip optimization of noise amplitudes entirely. In this case, the original membrane time constant calibration is used for leak bias currents. :ivar synapse_dac_bias: Synapse DAC bias current that is desired. Can be lowered in order to reduce the amplitude of a spike at the input of the synaptic input OTA. This can be useful to avoid saturation when using larger synaptic time constants.

Public Functions

check_types(self)

Check whether the correct types are given.

:raises TypeError: If time constants are not given with a unit from the quantities package.

check_values(self)

Check whether calibration targets are feasible.

Log warnings if the parameters are out of the typical range which can be calibrated and raise an error if the time constants exceed the range which can be handled by the calibration routine.

:raises ValueError: If target parameters are outside the allowed range for hagen neuron calibration.

Public Static Attributes

feasible_ranges = {"target_leak_read": base.ParameterRange(100, 140),"tau_syn": base.ParameterRange(0.3 * pq.us, 20 * pq.us),"tau_mem": base.ParameterRange(20 * pq.us, 100 * pq.us),"i_synin_gm": base.ParameterRange(30, 600),"target_noise": base.ParameterRange(1.0, 2.5),"synapse_dac_bias": base.ParameterRange(30, hal.CapMemCell.Value.max)}
int
Quantity
calix.spiking.neuron.NeuronCalibTarget : public base.CalibTarget

Target parameters for the neuron calibration.

Calib target parameters: :ivar leak: Target CADC read at leak (resting) potential. :ivar reset: Target CADC read at reset potential. :ivar threshold: Target CADC read near spike threshold. :ivar tau_mem: Membrane time constant. :ivar tau_syn: Synaptic input time constant. If a single float value is given, it is used for all synaptic inputs on all neurons, excitatory and inhibitory. If a numpy array of floats is given, it can be shaped (2, 512) for the excitatory and inhibitory synaptic input of each neuron. It can also be shaped (2,) for the excitatory and inhibitory synaptic input of all neurons, or shaped (512,) for both inputs per neuron. :ivar i_synin_gm: Synaptic input strength as CapMem bias current. Here, if a single value is given, both excitatory and inhibitory synaptic inputs are calibrated to a target measured as the median of all neurons at this setting. If an array shaped (2,) is given, the values are used as excitatory and inhibitory target values, respectively. If an array (512,) or (2, 512) is given, the synaptic input strength is NOT calibrated, as this array would already be the result of calibration. Instead, the values are set up per neuron and used during the later parts, i.e. synaptic input reference calibration. :ivar e_coba_reversal: COBA synaptic input reversal potential. At this potential, the synaptic input strength will be zero. The distance between COBA reversal and reference potential determines the strength of the amplitude modulation. Note that in biological context, the difference between reference and reversal potentials is a scaling factor for the conductance achieved by an input event. Optional: If None, the synaptic input will use CUBA mode for all neurons. Given as an array (2,) for excitatory and inhibitory synaptic input, respectively; or an array (2, 512) for individual targets per neuron. Given in CADC units. The values may exceed the dynamic range of leak and CADC. In this case, the calibration is performed at a lower, linearly interpolated value. You can also disable COBA modulation per neuron by setting np.inf or -np.inf as reversal potentials for excitatory and inhibitory synaptic inputs, respectively. :ivar e_coba_reference: COBA synaptic input reference potential: At this potential, the original CUBA synaptic input strength, given via i_synin_gm, is not modified by COBA modulation. Optional: If None or numpy.nan, the midpoint between leak and threshold will be used. Given as an array (2,) for excitatory and inhibitory synaptic input, respectively; or an array (2, 512) for individual targets per neuron. Given in CADC units. The values must be reachable by the leak term, and the dynamic range of the CADC must allow for measurement of synaptic input amplitudes on top of this potential. We recommend choosing a value between the leak and threshold. :ivar membrane_capacitance: Selected membrane capacitance. The available range is 0 to approximately 2.2 pF, represented as 0 to 63 LSB. :ivar refractory_time: Refractory time, given with a unit as quantities.quantity.Quantity. :ivar synapse_dac_bias: Synapse DAC bias current that is desired. Can be lowered in order to reduce the amplitude of a spike at the input of the synaptic input OTA. This can be useful to avoid saturation when using larger synaptic time constants. :ivar holdoff_time: Target length of the holdoff period. The holdoff period is the time at the end of the refractory period in which the clamping to the reset voltage is already released but new spikes can still not be generated.

Public Functions

check_types(self)

Check whether parameters have the right types and shapes.

:raises TypeError: If time constants are not given with a unit from the quantities package. :raises ValueError: If shape of parameters is bad.

check_values(self)

Check whether calibration targets are feasible.

Log warnings if the parameters are out of the typical range which can be calibrated and raise an error if the time constants exceed the range which can be handled by the calibration routine.

:raises ValueError: If target parameters are outside the allowed range for spiking neuron calibration.

Public Static Attributes

DenseDefault
e_coba_reference
e_coba_reversal
feasible_ranges = {"leak": base.ParameterRange(50, 160),"reset": base.ParameterRange(50, 160),"threshold": base.ParameterRange(50, 220),"tau_mem": base.ParameterRange(0.5 * pq.us, 60 * pq.us),"tau_syn": base.ParameterRange(0.3 * pq.us, 30 * pq.us),"i_synin_gm": base.ParameterRange(30, 800),"e_coba_reversal": base.ParameterRange(-np.inf, np.inf),"e_coba_reference": base.ParameterRange(60, 160),"membrane_capacitance": base.ParameterRange(hal.NeuronConfig.MembraneCapacitorSize.min,hal.NeuronConfig.MembraneCapacitorSize.max),"refractory_time": base.ParameterRange(40 * pq.ns, 32 * pq.us),"synapse_dac_bias": base.ParameterRange(30, hal.CapMemCell.Value.max),"holdoff_time": base.ParameterRange(0 * pq.ns, 4 * pq.us)}
holdoff_time
i_synin_gm
int
leak
membrane_capacitance
Quantity
refractory_time
reset
synapse_dac_bias
tau_mem
tau_syn
threshold
calix.spiking.neuron_threshold.NeuronThresholdCalib : public calix.spiking.neuron_threshold._SpikeCounterCalib

Calibrate the spike threshold of all neurons to be slightly above the resting potential, such that even small inputs can trigger spikes.

During calibration, a low spike rate is desired, indicating the spike threshold roughly matching the resting potential. After a spike, the membrane potential is set as low as possible, and the next spike should only happen after multiple membrane time constants.

To prevent self-induced spiking (without excitatory input), the spike threshold is increased by a safe_margin after calibration. In this state, a single input of medium weight should trigger spikes in most neurons, while most neurons should not spike on their own. Decreasing the safe_margin allows smaller inputs to trigger spikes, at the cost of having more neurons spike without input.

Requirements:

  • The leak potential is currently set at the desired threshold potential.

Caution:

  • The reset potential is set to the minimum after calibration.

:ivar safe_margin: Amount to increase spike threshold after the calibration. Given in CapMem LSB. The default value of 40 seems to work for inputs of weight 32, for a hagen-mode-like calibration on HICANN-X v2.

Public Functions

__init__(self, int safe_margin=40)
postlude(self, hxcomm.ConnectionHandle connection)

Increase parameters found during calibration by safe margin.

Measure spikes for one second and log data for neurons which still spike frequently if safe_margin is at least 10 (otherwise we assume frequent spiking is expected).

:param connection: Connection to the chip to calibrate.

prelude(self, hxcomm.ConnectionHandle connection)

Configure neurons for easy spiking.

The membrane capacitance is set low to have a short membrane time constant and easily reach the leak potential after a reset. The reset potential is set to the minimum as it must be below the spike threshold, which is not yet known.

:param connection: Connection to the chip to configure.

Public Members

accumulation_time
safe_margin
calix.common.algorithms.NoisyBinarySearch : public calix.common.algorithms.BinarySearch

Perform binary search with noisy start parameters.

The start of the search is not the middle of the range, but some integer noise given by noise_amplitude is added beforehand. This is useful to avoid issues that arise from setting many CapMem cells to the same value (CapMem crosstalk, issue 2654). The binary search takes an extra step to compensate for the initial offsets.

The NoisyBinarySearch algorithm is typically used to prevent that many CapMem cells are set to the same value. Since a binary search could theoretically drive many cells to the same CapMem value in the final steps, more steps are taken into account in the end to find an optimal value.

:ivar noise_amplitude: Amount of noise to add at the start of the calibration. Must be a positive integer; use the algorithm BinarySearch to work without noise.

Public Functions

__init__(self, int noise_amplitude=5)

:raises ValueError: if noise_amplitude is not greater than zero.

hook_to_calibration(self, base.Calib calibration)

Make an instance of a calibration known to the algorithm, allowing to use parameters set there.

:param calibration: Instance of calibration class that will be run with this algorithm.

:raises ExcessiveNoiseError: If the applied noise amplitude is more than a quarter of the calibration range, since that noise would lead to hitting the range boundaries instantly.

Public Members

initial_parameters
noise_amplitude
step_increments
class ParameterCalibResult

Data structure for calibration results of single parameters.

Contains an array of calibrated parameters and a mask indicating calibration success.

calix.common.algorithms.PolynomialPrediction : public calix.common.algorithms.PredictiveModel

Class implementing a polynomial predictive model.

Construction of this class requires an instance of numpy Polynomial which already contains suitable parameters, or measured data from characterization of the parameter/result pair to be calibrated (via from_data()). In the latter case, a fit to the data is performed to obtain the numpy polynomial.

:ivar polynomial: Instance of numpy polynomial, used as a model to map target values to parameters.

Subclassed by calix.common.algorithms.LinearPrediction

Public Functions

__init__(self, Union[int, np.ndarray] probe_parameters, np.polynomial.polynomial.Polynomial polynomial)

:param probe_parameters: Parameter at which a measurement was or will be taken in order to determine the offsets for each calibration instance.

Refer to _predict for details.

from_data(cls, np.ndarray parameters, np.ndarray results, int degree)

Construct the polynomial prediction from data.

A polynomial of given degree is fitted to the parameters and results. Refer to the documentation of numpy.polynomial.polynomial.Polynomial for details on how the fit is performed.

The median of the parameters used during characterization is used as probe point when determining the offset of each instance during prediction.

:param parameters: Array of parameters where values have been recored. :param results: Array of results obtained at parameters. :param degree: Degree of the fitted polynomial.

Public Members

polynomial

Private Functions

_predict(self, np.ndarray probe_results, Union[float, int, np.ndarray] target_result)

Predict parameters to obtain the given target results.

Evaluate the polynomial at probe parameters and compare with the results obtained there to determine the required offset of each instance. Evaluate the shifted polynomial at the target results to obtain the results predicted by the model.

:param probe_results: Array of results achieved using self.probe_parameters. :param target_result: Array or single value to aim results for.

:return: Array containing the parameters which are expected to yield results closest to the desired target results. Results are rounded to the nearest integer parameters.

calix.common.algorithms.PredictiveModel : public calix.common.base.Algorithm

Base class for predictive models, which calculate the ideal parameters to achieve a target result based on a model.

The models predict() function translates desired results into parameters. As there are differences between instances of the same thing on the chip, which is usually target of calibration, a shift of the model per instance is determined before calculating the optimal parameters. This means probe_parameters are configured and measured, used as shift, then the model prediction is calculated and returned. Running the algorithm, the shifts described above are measured at the probe parameters, then the parameters returned from the prediction are ensured to be in the allowed parameter range and set up on the chip before returning.

:ivar probe_parameters: Parameters to use when determining the shift each instance has with respect to the expected model.

Subclassed by calix.common.algorithms.PolynomialPrediction

Public Functions

__init__(self, Union[int, np.ndarray] probe_parameters)
run(self, hxcomm.ConnectionHandle connection, Union[float, int, np.ndarray] target_result)

Run the algorithm, i.e.

configure the probe parameters, measure results there, calculate optimal parameters based on this measurement and the model, and set these up.

:param connection: Connection connected to the chip to run on. :param target_result: Array or single value to be aimed for.

:return: Array containing the parameters which are expected to yield results closest to the desired target results. All parameters are in the allowed ParameterRange.

Public Members

probe_parameters

Private Functions

_predict(self, np.ndarray probe_results, Union[float, int, np.ndarray] target_result)

Predict parameters which need to be set to achieve the given target_result.

Use the probe_results at self.probe_parameters as baseline to determine offsets of individual instances.

:param probe_results: Array of results achieved using self.probe_parameters. :param target_result: Array or single value to aim results for.

:return: Array containing the parameters which are expected to yield results closest to the desired target results.

calix.common.cadc.RampOffsetCalib : public calix.common.base.Calib

CADC Calibration Part 1: Calibrate the ramp reset/start voltage.

This is done by setting the current onto the ramp high and searching the ramp start voltage such that the given minimum of the dynamic range reads the given target value at the CADCs.

This class implements configure and measure functions required by a calibration algorithm to run. Calling run on the calibration does the necessary preconfiguring and uses the given algorithm to find suitable parameters.

Requirements:

:ivar dynamic_range_min: Lower end of the desired dynamic range of the CADCs. Given in CapMem LSB. The voltage is configured as stp_v_charge_0, which is connected to the CADCs via the CapMem debug readout.

Public Functions

__init__(self, int target=20, int dynamic_range_min=70)

:param dynamic_range_min: Lower end of the desired dynamic range of the CADCs.

Given in LSB of a global CapMem cell.

configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Set CapMem cells cadc_v_ramp_offset of each quadrant to the values given in the array.

:param builder: Builder to append configuring instructions. :param parameters: Array of ramp start voltages to be configured.

:return: Builder with configuration instructions appended.

measure_results(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

Read all CADC channels.

Compute means of quadrants and return those.

:param connection: Connection to read CADCs with. :param builder: Builder to append read instructions to before executing it.

:return: Array with mean CADC reads of each quadrant.

prelude(self, hxcomm.ConnectionHandle connection)

Function to preconfigure CapMem parameters for the calibration runs.

Sets the ramp slope current high and the common voltage applied to all CADC channels to the lower end of the specified dynamic range. This reference voltage is set via the cell stp_v_charge_0 that has to be connected to the CapMem debug output.

:param connection: Connection to the chip to calibrate.

Public Members

dynamic_range_min
target
calix.common.cadc.RampSlopeCalib : public calix.common.base.Calib

CADC Calibration part 2: Calibrate the steepness of the ramp, i.e.

the current onto the ramp capacitor.

This is done by adjusting the value until the upper end of the given dynamic range reads a target value at the CADCs.

This class implements functions to configure the capmem cell that controls the ramp current and to measure the results. It also contains necessary preconfiguration of the CapMem.

Requirements:

:ivar dynamic_range_max: Upper end of the desired dynamic range of the CADCs. Given in LSB of a global CapMem cell. The voltage is configured as stp_v_charge_0, which has to be connected to the CADCs via the CapMem debug readout.

Public Functions

__init__(self, int target=220, int dynamic_range_max=550)
configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Set CapMem cells cadc_i_ramp_slope of each quadrant to the values given in the array.

:param builder: Builder to append configuring instructions. :param parameters: Array of ramp currents to be configured.

:return: Builder with configuration instructions appended.

measure_results(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

Read all CADC channels.

Compute means of quadrants and return those.

:param connection: Connection to read CADCs with. :param builder: Builder to append read instructions to.

:return: Array with mean CADC reads of each quadrant.

prelude(self, hxcomm.ConnectionHandle connection)

Function to preconfigure capmem parameters for the calibration runs.

Sets the the common voltage applied to all CADC channels to the upper end of the specified dynamic range.

:param connection: Connection to the chip to be calibrated.

Public Members

dynamic_range_max
target
calix.common.madc_base.Recorder : public ABC

Abstract base class for experiments/calibrations which use the MADC.

During prepare_recording(), the MADC is enabled and the current readout section config is saved. During recording, the readout config is changed continuously to measure one neuron’s properties after another. Furthermore, a stimuli can be injected during the measurement to observe the neurons’ responses and the recording timing per neuron can be set.

:ivar original_readout_config: Source selection mux config before start of the experiment. Used to restore state after the experiment has finished. :ivar original_neuron_configs: Neuron configs before start of the experiment. Used to restore state after the experiment. :ivar sampling_time: Time to record MADC samples for each neuron. The requested sampling time must be achievable with the maximum number of samples in the MADCConfig - without using continuous sampling. With default settings, this equals roughly 2.18 ms of recording time per neuron. :ivar _wait_before_stimulation: Time to wait after triggering MADC sampling before stimulation. Marked private since analyzing the trace is typically not robust against changing this number. :ivar dead_time: Time to wait before triggering the MADC sampling after the previous sampling period ended. Within this time, the neuron connections are changed. A minimum of 1 us is recommended. :ivar wait_between_neurons: Total time to wait for samples for each neuron. Has to be larger than the sum of sampling_time, wait_before_stimulation and dead_time. :ivar madc_input_frequency: Expected input clock frequency for the MADC, supplied by the PLL. Defaults to 500 MHz, which is present after the default stadls ExperimentInit. :ivar madc_config: Static configuration of the MADC. Written during prepare_recording() and used to obtain the sample rate. The number of samples is calculated automatically based on the sampling_time. :ivar invalid_samples_time: Timeframe in the beginning of a trace that is considered invalid. The MADC will start recording samples, but only after this time has elapsed, the sampling_time starts and samples are returned. This works around a bug, see issue 4008 for details.

Subclassed by calix.common.madc_base.Calib, calix.common.madc_base.MembraneRecorder

Public Functions

__init__(self)
build_measurement_program(self, base.WriteRecordingPlaybackProgramBuilder builder)

Builds a program to measure an arbitrary MADC trace for each neuron.

One neuron after another is connected to the MADC, the stimulate function is called and samples are recorded. The timing of each neuron is recorded, tickets containing the start and stop of the recording time are returned along with the builder.

:param builder: Builder to append instructions to.

:return: Tuple containing:

  • Builder with instructions appended.

  • List of read tickets marking start and end of the recording of each neuron.

neuron_config_disabled(self, halco.NeuronConfigOnDLS neuron_coord)

Return a neuron config in silent state, i.e.

disconnected from the common readout lines.

:param neuron_coord: Coordinate of neuron to get config for.

:return: Neuron config with readout disabled.

neuron_config_readout(self, halco.NeuronConfigOnDLS neuron_coord)

Return a neuron config with readout active and connected to the readout lines.

:param neuron_coord: Coordinate of neuron to get config for.

:return: Neuron config with readout enabled.

prepare_recording(self, hxcomm.ConnectionHandle connection)

Prepares chip for the experiment.

Configures the MADC and sets necessary bias currents. Reads and saves readout config and neuron config to restore original state after the experiment.

:param connection: Connection to the chip.

record_traces(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

Executes measurement on chip, returns samples per neuron.

:param connection: Connection to the chip to calibrate. :param builder: Builder to append measurement program to.

:return: List of numpy arrays, containing samples for each neuron.

:raises TooFewSamplesError: If the number of received MADC samples is significantly smaller than expected for at least one neuron. The evaluate function may fail in this case, thus the error is caught here.

restore_initial_state(self, hxcomm.ConnectionHandle connection)

Restore original readout and neuron configuration.

:param connection: Connection to the chip to calibrate.

stimulate(self, base.WriteRecordingPlaybackProgramBuilder builder, halco.NeuronConfigOnDLS neuron_coord, hal.Timer.Value stimulation_time)

Execute some commands after triggering MADC sampling.

E.g., synaptic inputs could be sent to observe their shape.

:param builder: Builder to append stimulation instructions to. :param neuron_coord: Coordinate of neuron which is currently recorded. :param stimulation_time: Timer value at beginning of stimulation.

:return: Builder with stimulation instructions appended.

Public Members

dead_time
invalid_samples_time
madc_config
madc_input_frequency
original_neuron_configs
original_readout_config
sampling_time
wait_between_neurons

Private Members

_wait_before_stimulation
calix_generate_default_calibration.RecorderAndDumper : public metaclass , public ABCMeta

Record and dump calibration data.

Subclassed by calix_generate_default_calibration.HagenCalib, calix_generate_default_calibration.HagenSyninCalib, calix_generate_default_calibration.SpikingCalib, calix_generate_default_calibration.SpikingCalib2

Public Functions

dumpers(self)

List of Dumpers used for serializing the calibration data.

All will serialize the data that has been acquired in a single calibration run.

record_and_dump(self, ConnectionHandle connection, Path deployment_folder)

Record calibration data and dump it to a file.

:param connection: Connection used to acquire the calibration data :param deployment_folder: Folder the file with serialized results is created in.

recorder(self)

Recorder used for acquiring the calibration data.

calix.hagen.neuron_potentials.ResetPotentialCalib : public base.Calib

Calibrate the neurons’ reset target voltage such that it matches the leak potential.

The refractory time is extended in order to measure the membrane potentials while the neuron is at reset potential. The CapMem settings which yield CADC reads which match the potential without reset are searched.

Requirements:

  • Neuron membrane readout is connected to the CADCs (causal and acausal).

  • Reset bias current is set not too low, such that a resting potential is reached during the refractory period. Note that this calibration has to be re-run after the reset bias current was changed, due to the OTA’s characteristics.

  • Target CADC read at reset potential is given, or membrane potential is not floating (i.e. the leak bias current is not too low). You may use the highnoise flag to indicate multiple measurements of the resting potential shall be taken in order to find the target reset potential.

:ivar highnoise: Decides whether to expect high noise on the membrane potential to be present. Setting this to True results in multiple reads of the resting potential when finding the calibration target value. :ivar backend_configs: List containing neuron backend configs as read in the prelude of the calibration. Used to restore the original config in the postlude. :ivar common_backend_configs: List containing common neuron backend configs as read during the prelude. Used to restore the original config in the postlude.

Public Functions

__init__(self, Union[int, np.ndarray] target=None, bool highnoise=False)

Initialize the ResetPotentialCalib class.

:param target: Target CADC reads during reset. If not given, they are measured during prelude. If given, the highnoise option has no effect.

configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Configure the reset potentials of all neurons to the values given in the parameter array.

:param builder: Builder to append configuration to. :param parameters: CapMem values of the reset potential.

:return: Builder with configuration appended.

measure_results(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

Test the configured settings.

The neurons are artificially reset and their membrane potentials are read using the CADCs.

:param connection: Connection to a chip to run on. :param builder: Builder to append read instructions.

:return: Membrane potentials of neurons during reset.

postlude(self, hxcomm.ConnectionHandle connection)

Log statistics of the results.

Restore original configuration of the neuron backends.

:param connection: Connection to the chip to run on.

prelude(self, hxcomm.ConnectionHandle connection)

Measure a calibration target (the leak reads) if not provided.

Select the slower clock in the digital neuron backend and set the refractory counter values in each neuron to keep the neuron refractory long enough so that the CADCs can read the potentials. The original neuron backend config is stored to be restored.

:param connection: Connection to the chip to run on.

Public Members

backend_configs
common_backend_configs
highnoise
target
class calix.hagen.neuron_helpers.CADCReadNeurons.Result

Result object holding membrane potentials of all neurons.

:ivar tickets: List of CADCSampleRow tickets containing the reads for top and bottom synram, respectively.

Public Functions

__init__(self, List[sta.ContainerTicket] tickets)
to_numpy(self)

Return a numpy array containing CADC reads interpreted as neuron results.

Note that the CADCs have to be connected to the neurons for this to make sense.

:return: Potential acquired from all neurons.

Public Members

tickets
class calix.spiking.refractory_period.Settings

Class providing array-like access to settings related to the refractory clock.

Public Functions

apply_to_chip(self, lola.Chip chip)

Apply refractory settings in the given chip object.

The settings have to cover a whole chip, i.e. 512 neurons.

:param chip: Chip object to reconfigure with refractory settings.

:raises ValueError: If array shapes do not match a whole chip.

Public Static Attributes

int
calix_generate_default_calibration.SpikingCalib : public calix_generate_default_calibration.RecorderAndDumper

Public Static Attributes

dumpers = [CalixFormatDumper(),                CocoListPortableBinaryFormatDumper(),                CocoListJsonFormatDumper()]
recorder = SpikingCalibRecorder()
calix_generate_default_calibration.SpikingCalib2 : public calix_generate_default_calibration.RecorderAndDumper

Public Static Attributes

dumpers = [CalixFormatDumper(),                CocoListPortableBinaryFormatDumper(),                CocoListJsonFormatDumper()]
recorder = SpikingCalibRecorder2()
calix.spiking.SpikingCalibOptions : public base.CalibOptions

Data class containing further options for spiking calibration.

:ivar cadc_options: Further options for CADC calibration. :ivar neuron_options: Further options for neuron calibration. :ivar correlation_options: Further options for correlation calibration. :ivar stp_options: Further options for STP calibration. :ivar refine_potentials: Switch whether after the neuron calibration, the CADCs and neuron potentials are calibrated again. This mitigates CapMem crosstalk effects. By default, refinement is only performed if COBA mode is disabled.

Public Static Attributes

CADCCalibOptions
CorrelationCalibOptions
default_factory
NeuronCalibOptions
STPCalibOptions
calix_generate_default_calibration.SpikingCalibRecorder : public calix_generate_default_calibration.CalibRecorder

Recorder for a default Spiking-Mode calibration.

Public Static Attributes

calibration_target = SpikingCalibTarget()
calibration_type = "spiking"
calix_generate_default_calibration.SpikingCalibRecorder2 : public calix_generate_default_calibration.CalibRecorder

Recorder for a second Spiking-Mode calibration.

In contrast to the default “spiking” calibration, we use smaller synaptic and membrane time constants, but stronger currents per event. Synaptic events should be shaprer in the sense that they are stronger, but decay more quickly. Also, the spike threshold is increased.

This calibration will, among other uses, be used in the demo notebooks, for the yin-yang example.

Public Static Attributes

calibration_target = SpikingCalibTarget(neuron_target=calix.spiking.neuron.NeuronCalibTarget(leak=80,reset=80,threshold=150,tau_mem=6 * pq.us,tau_syn=6 * pq.us,i_synin_gm=500,synapse_dac_bias=1000))
calibration_type = "spiking2"
calix.spiking.SpikingCalibResult : public base.CalibResult

Data class containing results of cadc and neuron calibration, all what is necessary for operation in spiking mode.

Refer to the documentation of :class:calix.common.cadc.CADCCalibResult, :class:calix.spiking.neuron.NeuronCalibResult, :class:calix.spiking.correlation.CorrelationCalibResult and :class:calix.spiking.synapse_driver.STPCalibResult for details about the contained result objects.

:ivar cadc_result: Result form CADC calibration. :ivar neuron_result: Result form neuron calibration. :ivar correlation_result: Result from correlation calibration. :ivar stp_result: Result from STP calibration.

Public Functions

apply(self, base.WriteRecordingPlaybackProgramBuilder builder)

Apply the calib to the chip.

Assumes the chip to be initialized already, which can be done using the stadls ExperimentInit().

:param builder: Builder to append instructions to.

calix.spiking.SpikingCalibTarget : public base.TopLevelCalibTarget

Data class containing targets for spiking neuron calibration.

:ivar cadc_target: Target parameters for CADC calibration. :ivar neuron_target: Target parameters for neuron calibration. :ivar correlation_target: Target parameters for calibration of correlation sensors. If None, they will not be calibrated. :ivar stp_target: Target for STP calibration.

Public Functions

calibrate(self, hxcomm.ConnectionHandle connection, Optional[SpikingCalibOptions] options=None)

Public Static Attributes

CADCCalibTarget
default_factory
NeuronCalibTarget
STPCalibTarget
class calix.common.base.StatefulConnection

Public Functions

__init__(self, hxcomm.ConnectionHandle connection, sta.ExperimentInit init=sta.ExperimentInit())
get_unique_identifier(self)
update_reinit(self, sta.DumperDone dumperdone)

Public Members

connection
dumper
init
reinit
calix.spiking.synapse_driver.STPCalibOptions : public base.CalibOptions

Set bias parameters for the STP circuitry.

All parameters can be configured per quadrant.

:param i_ramp: Ramp current for STP pulse width modulation, in CapMem LSB. :param v_stp: Voltage (STP state) where all drivers’ amplitudes are equalized at, in CapMem LSB. Should be chosen between v_charge and v_recover.

Public Static Attributes

i_ramp = 600
v_stp = 180
calix.spiking.synapse_driver.STPCalibResult : public base.CalibResult

Result from STP calibration.

Public Functions

apply(self, sta.PlaybackProgramBuilder builder)

Apply the result in the given builder.

Note that in the synapse driver config, no outputs are generated, and STP is disabled. Only the offset is configured by this calib. So STP is ready to be used, but disabled.

:param builder: Builder to append instructions to.

calix.spiking.synapse_driver.STPCalibTarget : public base.CalibTarget

Target for STP calibration.

The STP voltages, which affect the dynamic range of the amplitudes, are set here. They are currently not calibrated, but can be set per quadrant.

:param v_charge_0: STP v_charge (fully modulated state) for voltage set 0, in CapMem LSB. You can choose the two voltage sets to be, e.g., depressing and facilitating. By default, we select voltage set 0 to be facilitating and voltage set 1 to be depressing. :param v_recover_0: STP v_recover (fully recovered state) for voltage set 0, in CapMem LSB. Note that a utilization of some 0.2 happens before processing each event, so the voltage applied to the comparator never actually reaches v_recover. :param v_charge_1: STP v_charge (fully modulated state) for voltage set 1, in CapMem LSB. :param v_recover_1: STP v_recover (fully recovered state) for voltage set 1, in CapMem LSB.

Public Static Attributes

v_charge_0 = 100
v_charge_1 = 330
v_recover_0 = 400
v_recover_1 = 50
calix.spiking.synapse_driver.STPMultiplication : public multiplication.Multiplication

Perform vector-matrix multiplications, but without hagen-mode pulse length encoding.

The pulse length is instead determined by the STP voltage.

Note that we set a static voltage for both v_recover and v_charge and this way leave no dynamic range for modulation of amplitudes depending on their timing. We only set a medium amplitude with a suitable voltage v_stp := v_recover = v_charge.

Public Functions

preconfigure(self, hxcomm.ConnectionHandle connection)

Call preconfigure from parent class, but disable hagen-mode encoding (use STP voltages instead).

:param connection: Connection to the chip to run on.

calix.spiking.synapse_driver.STPOffsetCalib : public base.Calib

Calibrate synapse driver STP ramp offsets for usage in spiking mode.

Since the hagen-mode DAC is not involved now, the STP voltages can use a higher dynamic range determined by v_charge and v_recover. This usually means a different STP ramp current is used than in hagen mode.

Drivers connected to different CapMem instances are calibrated to different targets since deviations in STP voltages and ramp currents (which are set for each CapMem instance individually) have higher variations than can be compensated with the STP offset.

Note that this calibration measures synapse drivers’ outputs on the synaptic input lines, not on the neurons. The neurons are reconfigured for this purpose. If they were calibrated, you will need to re-apply their calibration after the STP offsets are calibrated.

Requirements:

  • CADCs and Synapse DAC biases are calibrated.

:ivar v_stp: STP voltage to use during amplitude measurement, reached by setting v_charge and v_recover to this value. If an array of values is given, they are configured per quadrant. :ivar i_ramp: STP ramp current. If an array of values is given, they are configured per quadrant. :ivar measurement: Instance of measurement class, in order to measure the characteristic output amplitudes of each synapse driver.

Public Functions

__init__(self, Union[int, np.ndarray] v_stp=180, Union[int, np.ndarray] i_ramp=600)
configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Configure the synapse drivers to the given offsets.

:param builder: Builder to append configuration to. :param parameters: Synapse driver offset settings to configure.

:return: Builder with configuration instructions appended.

measure_results(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

Read output amplitudes of synapse drivers.

:param connection: Connection to the chip to run on. :param builder: Builder that is run before measuring.

:return: Array of synapse drivers’ output amplitudes.

postlude(self, hxcomm.ConnectionHandle connection)

Log standard deviation of amplitudes after calibration.

:param connection: Connection to the chip to run on.

prelude(self, hxcomm.ConnectionHandle connection)

Set up STP voltages and currents.

Measure target values as median of drivers of a CapMem block.

Public Members

i_ramp
measurement
target
v_stp
calix.hagen.synapse_driver.STPRampCalib : public base.Calib

Search synapse driver STP ramp currents such that the mean amplitudes of drivers on different CapMem blocks are the same.

This is necessary as 64 drivers each, which are connected to the same CapMem block, receive the same bias current, but different instances of the CapMem can drive different currents at the same setting. This calibration counters systematic deviations in amplitudes between synapse drivers on different quadrants.

The amplitudes are measured with the neurons in integration mode. In order to obtain a representative result for a quadrant’s amplitudes with the STP offsets not calibrated yet, we select an “average” driver for each CapMem block during the prelude. The median of their amplitudes is used as calibration target.

Requirements:

  • Synapse DAC bias is calibrated.

  • Static synapse driver bias currents are set. This can be achieved using preconfigure_capmem().

:ivar test_activation: Hagen-mode activation to use when determining the ramp slope. Should be low, close but not equal to zero. Make sure to change the target amplitude accordingly when changing the test_activation. :ivar n_parallel_measurements: Number of parallel measurements to execute when measuring results. :ivar offset_calib: Instance of calibration used for Hagen DAC offset. This calibration is called each time after changing the STP ramp currents, before measuring results. :ivar log: Logger used to log outputs.

Public Functions

__init__(self)
configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Configure the given STP ramp currents to the CapMem quadrants.

The STP calibration current is set equal to this ramp current: The ramp offset calibration works by sinking part of the ramp current within the first 2 ns of the ramp generation phase. The calibration current controls the sinked current, therefore it is sensible to scale it with the sourced (ramp) current.

:param builder: Builder to append configuration to. :param parameters: STP ramp currents to set.

:return: Builder with configuration appended.

measure_results(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

Measure the amplitudes of all drivers at a low activation.

This corresponds to a high DAC voltage, i.e. the end of the ramp. We return the mean amplitude per quadrant.

:param connection: Connection to the chip to run on. :param builder: Builder to measure results with.

:return: Array of STP amplitudes per quadrant.

postlude(self, hxcomm.ConnectionHandle connection)

Print the calibrated ramp currents.

:param connection: Connection to the chip to run on.

prelude(self, hxcomm.ConnectionHandle connection)

Measure maximum amplitude per driver, using a high ramp bias current and a high activation.

:param connection: Connection to the chip to run on.

Public Members

log
n_parallel_measurements
offset_calib
target
test_activation

Public Static Functions

calculate_quadrant_means(np.ndarray results)

Calculate mean amplitudes per quadrant from an array of all drivers’ amplitudes.

:param results: Results from all synapse drivers on chip.

:return: Mean results of all drivers on a quadrant.

calix.hagen.synapse_driver.SynapseDriverCalibOptions : public base.CalibOptions

Further options for synapse driver calibration.

:ivar offset_test_activation: Hagen-mode activation where amplitudes between different drivers are aligned using the individual DAC offsets.

Public Static Attributes

default_factory
calix.hagen.synapse_driver.SynapseDriverCalibResult : public base.CalibResult

Result object of a synapse driver calibration.

Holds CapMem cells and synapse driver configs that result from calibration, as well as a success flag for each driver.

Public Functions

apply(self, base.WriteRecordingPlaybackProgramBuilder builder)

Apply the calibration result in the given builder.

:param builder: Builder or dumper to append instructions to.

class calix.hagen.synapse_driver.SynapseDriverMeasurement

Provides a function to measure output amplitudes of each synapse driver.

Each synapse driver is connected to at least 8 synapse columns, their median result is taken as the driver’s output amplitude. The requested number of parallel measurements determines how many synapse columns are used per driver: If only one driver is measured at a time, all 256 synapse columns are used.

When several synapse drivers are measured in parallel, events are sent to one synapse driver after another. Due to analog effects in the synapse array, earlier events will result in a lower activation than later events. Do not use more than one parallel measurement if you cannot cope with this effect.

:ivar n_parallel_measurements: Number of synapse drivers to be measured in one run. Only powers of 2 are supported, i.e. possible values are 1, 2, 4, 8, 16, 32. We do not support more than 32 parallel measurements since we require at least 8 synapse columns per driver, in order to take the median read from those as the driver’s output. :ivar multiplication: Multiplication class used for measurements. Each measurement run is a vector-matrix multiplication.

Public Functions

__init__(self, int n_parallel_measurements=1)
get_input_vectors(self, np.ndarray activations)

Create vectors that are multiplied with the synapse matrix in order to characterize all drivers’ outputs at the given activations.

In each vector, we send activations to a subset of drivers, that has different columns for their results. Hence, the unique activations of each driver can be obtained. Only in the next vector, we reuse the same columns in order to characterize each synapse driver.

:param activations: Array of activations, each is tested.

:return: Array of vectors, to be used as input for multiplication.

get_synapse_mapping(self, halco.SynapseDriverOnSynapseDriverBlock driver)

Return mask of synapses to enable in a row.

This function can be called for all synapse drivers and will return a synapse matrix that allows measuring amplitudes from a block of self.n_parallel_measurements drivers in parallel. The synapse matrix is configured such that the drivers which are measured in parallel do not use the same synapse columns. For the next block of synapse drivers which are measured in parallel, the same synapse columns as for the previous block can be used.

:param driver: Coordinate of the synapse driver which shall be connected to neurons.

:return: Boolean mask of enabled synapses within the synapse driver’s row.

get_synapse_matrix(self, hal.SynapseQuad.Weight weight=hal.SynapseQuad.Weight.max)

Return a mapping matrix using the given weight.

For the mapping, we use the function get_synapse_mapping, which yields a connection matrix between the drivers and neurons. This mapping is designed to create a non-overlapping synapse matrix that allows parallel measurement of multiple drivers.

:param weight: Weight to configure the enabled synapses to.

:return: Numpy array of weight matrix.

measure_syndrv_amplitudes(self, hxcomm.ConnectionHandle connection, Union[hal.PADIEvent.HagenActivation, np.ndarray] activations, *hal.SynapseQuad.Weight weight=hal.SynapseQuad.Weight.max, int n_runs=5, int num_sends=3)

Multiply the given activation with a suitable weight matrix to determine the output amplitudes of each driver.

Use the multiplication function with integration on the synaptic input lines. The weight matrix is configured using the function get_synapse_matrix(), and vectors equaling the positioning of drivers on PADI busses are used to characterize each drivers’ outputs. The parameter num_sends repeats the vector, i.e. sends multiple events per driver for getting suitable amplitudes. The experiment is repeated n_runs times.

For readout, we use at least 8 synapse columns per driver, determined by the number of parallel measurements, and return the median of each of those synapse blocks. The returned array of amplitudes has one entry for each synapse driver.

:param connection: Connection to the chip to run on. :param activations: Activation to use in input vector. If an array is given, each of the contained activations is tested. In this case, the returned result will have a second, outer dimension corresponding to the different activations. :param weight: Weight to use in synapse matrix. :param n_runs: Number of experiments to take mean from. :param num_sends: Number of events to send per driver in each measurement.

:return: Array of amplitudes of each synapse driver.

Public Members

multiplication
n_parallel_measurements
calix.hagen.neuron_synin.SynBiasCalib : public base.Calib

Calibrate the strength of synaptic inputs to match for all neurons.

This is done using inputs of multiple rows of synapses at medium weight, with STP disabled, as set during the prelude. With these longer pulses, the mismatch of synapses should be minimal. The bias currents of the synaptic input OTAs are tweaked such that the difference in CADC reads before and after sending inputs match.

Requirements:

  • Neuron membrane readout is connected to the CADCs (causal and acausal).

  • Synaptic currents can reach the neurons (hal.ColumnCurrentSwitch).

  • The membrane time constant is long, so that sucessive input events accumulate.

  • The selected synaptic time constant and synapse DAC bias current are not too large, so that the amplitudes resulting from a single stimulus don’t already saturate the usable dynamic range at the CADC.

:ivar syn_ref_calib: Instance of a SynReferenceCalib, configured with the given target_leak_read. The synaptic input reference potentials are recalibrated every time after changing the synaptic input OTA bias current. :ivar n_events: Number of events to send during integration of amplitudes in measure_results(). During prelude the number of events might be reduced if the measured amplitudes are too high. :ivar n_runs: Number of runs to average results from during measurement of amplitudes. :ivar wait_between_events: Wait time between two successive input events. :ivar reliable_amplitudes: Maximum amplitude that is reliably observable using the CADC. Used to find n_events during prelude. :ivar recalibrate_reference: Decide whether the OTA’s reference potential is recalibrated during prelude and each time the bias current is touched.

Subclassed by calix.hagen.neuron_synin.ExcSynBiasCalib, calix.hagen.neuron_synin.InhSynBiasCalib

Public Functions

__init__(self, Optional[np.ndarray] target_leak_read=None, base.ParameterRange parameter_range=base.ParameterRange(hal.CapMemCell.Value.min, hal.CapMemCell.Value.max), Optional[np.ndarray] target=None, bool recalibrate_reference=True)

:param target_leak_read: Target CADC read for synaptic input reference potential calibration, which is called after each change of the bias current.

This parameter must be given if recalibrate_reference is True (default), but can be left None otherwise. :param parameter_range: Allowed range of synaptic input OTA bias current. :param target: Target amplitudes for events. If given, the measurement of target amplitudes in prelude is skipped. This can be useful when calibrating inhibitory and excitatory synaptic inputs to the same amplitude targets. :param recalibrate_reference: Decide whether the OTA’s reference potential is recalibrated during prelude and each time the bias current is touched.

:raises ValueError: If target_leak_read is None while recalibrate_references is True.

configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Configure the bias current of the synaptic input OTA of all neurons to the given parameters.

The target can be the excitatory or the inhibitory synaptic input circuit depending on the class properties.

:param builder: Builder to append configuration instructions to. :param parameters: Synaptic input OTA bias current.

:return: Builder with configuration instructions appended.

measure_amplitudes(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder, Optional[bool] recalibrate_syn_ref=None)

Send stimuli to all neurons using a few rows of synapses (as set during the prelude).

The number of inputs in one run as well as the number of runs can be varied, the mean of all experiments is returned.

Returns the difference in CADC reads after and before stimulation. The result uses the appropriate sign depending on excitatory or inhibitory mode, i.e. is normally positive.

:param connection: Connection to the chip to run on. :param builder: Builder to append stimulate/read instructions, then gets executed. :param recalibrate_syn_ref: Switch if the synaptic input reference has to be recalibrated before measuring amplitudes.

:return: Array of amplitudes resulting from stimulation.

measure_results(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

Measure results of calibration.

Calls the measure_amplitudes function using the default setting to recalibrate the synaptic reference potentials before measuring. This function only exists to keep the same arguments as in the base calib class.

:param connection: Connection to the chip to run on. :param builder: Builder to append stimulate/read instructions, then gets executed.

:return: Array of amplitudes resulting from stimulation.

postlude(self, hxcomm.ConnectionHandle connection)

Log statistics of the event amplitudes after calibration.

:param connection: Connection to the chip to run on.

prelude(self, hxcomm.ConnectionHandle connection)

Preconfigure synapse drivers to send excitatory/inhibitory signals to all connected synapses.

Measure current amplitudes and use the median as target for calibration, which can be overwritten by providing a target to the run() method. If an amplitude higher than the reliable range is obtained, the parameter self.n_events is reduced and it is measured again.

:param connection: Connection to the chip to run on.

:raises CalibNotSuccessful: If obtained target amplitudes are still too high after reducing self.n_events.

Public Members

n_events
recalibrate_reference
reliable_amplitudes
syn_ref_calib
target

Private Functions

_bias_current_coord(self)

Coordinate of the capmem bias current cells for the synaptic input OTA to calibrate.

_expected_sign(self)

Expected sign of the amplitudes.

The measured amplitudes get multiplied with this sign.

_log_abbreviation(self)

Abbreviation of exc/inh synaptic input used for log messages.

_reference_calib_type(self)

Type of the sub-calibration to use for recalibrating the synaptic input reference potentials.

_row_mode(self)

Row mode (excitatory / inhibitory) of synapses to enable.

class calix.spiking.neuron_calib_parts.SyninParameters

Collection of parameters for synaptic input calibration.

Contains decisions that are set automatically based on the shape of targets for the calibration:

:ivar i_synin_gm: Target bias currents for synaptic input OTAs, with shapes modified to match the needs of the calibration routines. :ivar calibrate_synin: Decide whether synaptic input OTA strengths are calibrated. :ivar equalize_synin: Decide whether excitatory and inhibitory synaptic input strengths are equalized.

Public Functions

__init__(self, neuron.NeuronCalibTarget target)

:param target: Target parameters for neuron calib.

Public Members

calibrate_synin
equalize_synin
i_synin_gm
calix.hagen.neuron_synin.SynReferenceCalib : public base.Calib

Calibrate synaptic reference voltage such that no currents are generated from the OTA without input.

Calibrate the neuron’s synaptic input reference voltage such that the membrane potential after enabling the OTA is the same as before. The membrane potential without enabled OTA has to be supplied as a target. This calibration routine sets reference voltages to the corresponding CapMem value to meet this calibration target.

If bias_currents are supplied during initialization, the synaptic input to be calibrated gets turned on using these bias currents.

Requirements:

  • Neuron membrane readout is connected to the CADCs (causal and acausal).

  • The desired OTA bias currents are already set up and the synaptic input is enabled. Alternatively, the desired configuration can be supplied as bias_currents.

:ivar bias_currents: Synaptic input bias currents to configure for the synaptic input to be calibrated. If None, the configuration is unchanged.

Subclassed by calix.hagen.neuron_synin.ExcSynReferenceCalib, calix.hagen.neuron_synin.InhSynReferenceCalib

Public Functions

__init__(self, Optional[Union[int, np.ndarray]] bias_currents=None, Union[int, np.ndarray] target=120)

:param bias_currents: Synaptic input bias currents to configure for the synaptic input to be calibrated.

If None, the configuration is unchanged. :param target: Target CADC reads with synaptic input enabled. Optional, can also be supplied to the run() call. These reads need to be taken with the synaptic input disabled.

configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Configure the given parameters to the respective CapMem cell determined by whether the excitatory or inhibitory synaptic input is to be calibrated.

:param builder: Builder to append configuration to. :param parameters: Array of reference potential settings to configure.

:return: Builder with configuration instructions appended.

measure_results(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

Measure the membrane potentials of each neuron.

:param connection: Connection to chip to run measurement. :param builder: Builder to append read instructions to.

:return: Array with CADC reads of neuron membrane potentials.

postlude(self, hxcomm.ConnectionHandle connection)

Print statistics of the resting potentials with synaptic input enabled and reference potential calibrated.

:param connection: Connection to the chip to run on.

prelude(self, hxcomm.ConnectionHandle connection)

If desired, configure the synaptic input bias currents to the given values.

If no bias currents were given, the configuration is unchanged.

:param connection: Connection to the chip to calibrate.

Public Members

bias_currents
target

Private Functions

_bias_current_keyword(self)

String representation of the keyword required to preconfigure the synaptic inputs.

_capmem_parameter_coord(self)

Coordinate of CapMem parameters for the synaptic input reference potential.

_inverted(self)

Inversion property of the calibration, used to configure the base class.

For the excitatory input, we must not invert it, for the inhibitory input, we must invert it.

_log_abbreviation(self)

Abbreviation of exc/inh synaptic input used for log messages.

calix.hagen.neuron_synin.SynReferenceCalibMADC : public madc_base.Calib

Calibrate synaptic input reference potentials using the MADC.

This calibration requires the leak bias currents to be zero, which is set in the prelude. The leak bias currents are NOT restored, since the target use case is PPU-based hagen mode integration with leakage disabled.

As for all calibrations based on the MADC calibration, neuron configurations and readout configuration are changed during calibration and restored afterwards.

To measure the current output of the synaptic input OTA, the membrane potential is observed while floating (with the leak term disabled). Initially, the membrane is reset. Once the refractory period ends and the reset is released, we fit to the membrane potential: If a constant current flows onto the membrane, it increases or decreases linearly. We search the reference potential settings for minimum constant currents, i.e. such that the membrane potential stays constant after the reset is released.

Requirements:

  • The synaptic input is enabled and configured with the desired bias currents (i_bias_synin_{exc,inh}_gm).

  • The refractory time has to be set as expected_refractory_time. We use this parameter to select the start time of the fit.

:ivar n_runs: Take the average of multiple measurements in each step of the calibration. Defaults to 1 (no averaging). :ivar expected_refractory_time: Configured refractory time. Used to determine the start point of the linear fit, which should begin once the reset is released and the membrane potential starts drifting.

Subclassed by calix.hagen.neuron_synin.ExcSynReferenceCalibMADC, calix.hagen.neuron_synin.InhSynReferenceCalibMADC

Public Functions

__init__(self)
configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Configures the given array of synaptic input reference potentials.

:param builder: Builder to append configuration instructions to. :param parameters: Array of reference potentials to set up.

:return: Builder with configuration appended.

evaluate(self, List[np.ndarray] samples)

Evaluates the obtained MADC samples.

To each neuron’s MADC samples, a linear function is fitted, and the slope is returned.

:param samples: MADC samples obtained for each neuron.

:return: Numpy array of fitted slopes.

measure_results(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

Executes multiple measurements on chip, returns the mean result.

:param connection: Connection to the chip to calibrate. :param builder: Builder to append measurement program to.

:return: Numpy array of mean results.

neuron_config_disabled(self, neuron_coord)

Return a neuron config with readout disabled.

:return: Neuron config with readout disabled.

neuron_config_readout(self, neuron_coord)

Return a neuron config with readout enabled.

:return: Neuron config with readout enabled.

prelude(self, hxcomm.ConnectionHandle connection)

Prepares chip for calibration.

Enables the MADC and sets the leak bias currents to zero.

:param connection: Connection to the chip to calibrate.

stimulate(self, base.WriteRecordingPlaybackProgramBuilder builder, halco.NeuronConfigOnDLS neuron_coord, hal.Timer.Value stimulation_time)

Reset the neuron’s membrane potential.

:param builder: Builder to append resets to. :param neuron_coord: Coordinate of neuron which is currently recorded. :param stimulation_time: Timer value at beginning of stimulation.

:return: Builder with reset appended.

Public Members

expected_refractory_time
n_runs
sampling_time
target
wait_between_neurons

Private Functions

_inverted(self)

Select whether the parameter change needs to be inverted.

_reference_potential_coord(self)

Coordinate of the CapMem reference potential for the synaptic input OTA.

calix.hagen.neuron_synin.SynTimeConstantCalib : public madc_base.Calib

Calibrate synaptic input time constant using the MADC.

The sypantic input time constant is fitted to an MADC trace: after we send some stimuli to decrease the voltage on the synaptic input line, we fit to the exponential decay back to the baseline voltage.

During prelude, the MADC is enabled and the current readout section config is saved. During calibration, the readout config is changed continuously to calibrate one neuron’s synaptic input time constant after another.

Synaptic inputs need to be disabled during calibration, thus the synaptic input bias currents are written to zero in the prelude. Their state is not saved and restored as this calibration will normally run before they are calibrated, anyway.

Requirements:

  • Synaptic events can reach the neurons, i.e. the synapse DAC bias is set and the hal.ColumnCurrentSwitches allow currents from the synapses through.

:ivar neuron_config_default: List of desired neuron configurations. Necessary to enable high resistance mode.

Subclassed by calix.hagen.neuron_synin.ExcSynTimeConstantCalib, calix.hagen.neuron_synin.InhSynTimeConstantCalib

Public Functions

__init__(self, pq.quantity.Quantity target=1.2 *pq.us, Optional[List[hal.NeuronConfig]] neuron_configs=None)

:param neuron_configs: List of neuron configurations.

If None, the hagen-mode default neuron config is used. :param target: Target synaptic input time constant.

configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Configures the given array of synaptic input resistor bias currents.

:param builder: Builder to append configuration instructions to. :param parameters: Array of bias currents to set up.

:return: Builder with configuration appended.

evaluate(self, List[np.ndarray] samples)

Evaluates the obtained MADC samples.

To each neuron’s MADC samples, an exponential decay is fitted, and the resulting time constant is returned.

:param samples: MADC samples obtained for each neuron.

:return: Numpy array of fitted synaptic input time constants in microseconds.

neuron_config_disabled(self, neuron_coord)

Return a neuron config with readout disabled.

The synaptic input is also disabled, since the neurons’ readout multiplexer may leak if the membrane voltage rises above 1.2 V, impacting the syn. input measurement. Hence, the transmission gates between the OTAs and the membrane are disabled. Note that on Hicann-X v1, this does not suffice to disable the synaptic input, and also the OTA bias currents need to be set to zero, which is done during the prelude.

:return: Neuron config with readout disabled.

neuron_config_readout(self, neuron_coord)

Return a neuron config with readout enabled.

:return: Neuron config with readout enabled.

prelude(self, hxcomm.ConnectionHandle connection)

Prepares chip for calibration.

Disables synaptic inputs. Configures synapse drivers to stimulate the necessary input.

:param connection: Connection to the chip to calibrate.

stimulate(self, base.WriteRecordingPlaybackProgramBuilder builder, halco.NeuronConfigOnDLS neuron_coord, hal.Timer.Value stimulation_time)

Send some PADI events to the synaptic input in order to drop the potential.

:param builder: Builder to append PADI events to. :param neuron_coord: Coordinate of neuron which is currently recorded. :param stimulation_time: Timer value at beginning of stimulation.

:return: Builder with PADI events appended.

Public Members

neuron_config_default
sampling_time
target
wait_between_neurons

Private Functions

_bias_current_coord(self)

Coordinate of the CapMem bias current for the synaptic input resistor controlling the time constant.

_readout_source(self)

Readout source to select in neuron readout multiplexer.

_row_mode(self)

Row mode (excitatory / inhibitory) of synapses to enable.

Private Members

_wait_before_stimulation
calix.spiking.neuron_threshold.ThresholdCalibCADC : public base.Calib

Calibrate the neurons’ spike threshold potential using the CADC.

An offset current is injected onto the membranes, which results in regular spiking. The CADC samples all neurons at its maximum sample rate. The maximum read for each neuron is treated as the threshold potential, as it should be just below the threshold.

We use a high number of CADC samples to ensure we catch the neurons at a potential close to the threshold, even with the slow sampling rate of the CADC. As long as the sample rate and inter-spike-interval is not perfectly aligned, the low sample rate should not be an issue, and ultimately electrical noise should ensure the two will never stay perfectly synchronous.

Requirements:

  • Neuron membrane readout is connected to the CADCs (causal and acausal).

:ivar original_neuron_configs: List of neuron configs from before the calibration, used to restore them in the postlude.

Public Functions

__init__(self, Union[int, np.ndarray] target=125)
configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Configure the given array of threshold voltages.

:param builder: Builder to append configuration instructions to. :param parameters: Array of threshold voltages to set up.

:return: Builder with configuration appended.

measure_results(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

Samples the membrane repeatedly and returns the maximum obtained value as the voltage measurement closest to the threshold.

:param connection: Connection to the chip. :param builder: Builder to append measurement to.

:return: Array of near-threshold CADC reads.

postlude(self, hxcomm.ConnectionHandle connection)

Disable offset current CapMem cell again and restore original neuron configs.

:param connection: Connection to the chip to run on.

prelude(self, hxcomm.ConnectionHandle connection)

Prepares chip for calibration, reads original neuron config in order to restore it after calibration.

Disable leak, set a low reset voltage and the offset current. Note that only the amplitude of the current is set but it is not enabled.

:param connection: Connection to the chip to calibrate.

Public Members

original_neuron_configs
target
calix.spiking.neuron_threshold.ThresholdCalibMADC : public madc_base.Calib

Calibrate the neurons’ spike threshold potential using the MADC.

A constant current is injected onto the membrane, with the leak disabled and the reset potential set low. This means we observe regular spikes. The maximum recorded voltage at the MADC is just below the threshold potential, we use it as threshold measurement.

Requirements:

  • None -

:ivar neuron_configs: List of neuron configs that will be used as basis for the neuron_config_disabled and neuron_config_readout functions.

Public Functions

__init__(self, Union[int, np.ndarray] target=125)
configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Configure the given array of threshold voltages.

:param builder: Builder to append configuration instructions to. :param parameters: Array of threshold voltages to set up.

:return: Builder with configuration appended.

evaluate(self, List[np.ndarray] samples)

Evaluates the obtained MADC samples.

For each neuron’s MADC samples the maximum is determined which is assumed to be near the threshold voltage.

:param samples: MADC samples obtained for each neuron.

:return: Numpy array of measured threshold voltages.

neuron_config_disabled(self, halco.NeuronConfigOnDLS neuron_coord)

Return a neuron config with readout disabled.

The synaptic input and the offset current are disabled as well.

:param neuron_coord: Coordinate of neuron to get config for.

:return: Neuron config with readout disabled.

neuron_config_readout(self, halco.NeuronConfigOnDLS neuron_coord)

Return a neuron config with readout enabled.

Also, the offset current and threshold comparator are enabled for regular spiking.

:param neuron_coord: Coordinate of neuron to get config for.

:return: Neuron config with readout enabled.

postlude(self, hxcomm.ConnectionHandle connection)

Disable offset current CapMem cell again.

:param connection: Connection to the chip to run on.

prelude(self, hxcomm.ConnectionHandle connection)

Prepares chip for calibration.

Disable leak, set a low reset voltage and the offset current. Note that only the amplitude of the current is set but it is not enabled.

:param connection: Connection to the chip to calibrate.

stimulate(self, base.WriteRecordingPlaybackProgramBuilder builder, halco.NeuronConfigOnDLS neuron_coord, hal.Timer.Value stimulation_time)

Empty function.

The offset current is enabled already in the neuron_config_readout, therefore no stimuli are neccesary.

:param builder: Builder to append neuron resets to. :param neuron_coord: Coordinate of neuron which is currently recorded. :param stimulation_time: Timer value at beginning of stimulation.

:return: Builder with neuron resets appended.

Public Members

neuron_configs
sampling_time
target
wait_between_neurons

Private Members

_wait_before_stimulation
calix.spiking.correlation.TimeConstantCalib : public base.Calib

Calibrate the correlation time constant.

Correlation traces are measured in a few quads in all CapMem quadrants. The median time constant is estimated and the CapMem bias currents are tweaked accordingly.

Requirements:

  • CADCs are enabled and calibrated.

  • External correlation voltages (v_res_meas, v_reset) are set.

:ivar measurement: Instance of the correlation measurement class, used for measuring results. :ivar quads: List of synapse quad column coordinates. Measurements from all rows in those quads are taken as an estimate for the characteristics of the whole quadrant. All quads in the list are located in quadrant 0, the measurement is repeated in the other quadrants using corresponding offsets to the coordinates. :ivar log: Logger used to log outputs. :ivar branches: Correlation branch to consider. Choose from causal, acausal or both, using the Enum CorrelationBranches.

Public Functions

__init__(self, Optional[pq.Quantity] target=5 *pq.us, *CorrelationBranches branches=CorrelationBranches.CAUSAL, int amp_calib=0, int time_calib=0)

:param target: Target time constant for calibration.

:param amp_calib: Amplitude calibration setting to use in all synapses during measurement. :param time_calib: Time constant calibration setting to use in all synapses during measurement.

configure_parameters(self, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray parameters)

Configure the given ramp bias currents in the given builder.

:param builder: Builder to append configuration instructions to. :param parameters: Correlation ramp bias current for each quadrant.

:return: Builder with configuration appended.

measure_results(self, hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder)

Estimate correlation parameters of each quadrant.

:param connection: Connection to the chip to run on. :param builder: Builder to run before measurements.

:return: Array of each quadrant’s time constants.

prelude(self, hxcomm.ConnectionHandle connection)

Preconfigure the chip for correlation measurements.

:param connection: Connection to the chip to run on.

Public Members

branches
log
measurement
quads
target
calix.common.exceptions.TooFewSamplesError : public calix.common.exceptions.CalibError

The number of received MADC samples is significantly lower than expected.

This is likely an FPGA-related problem. A longer wait between neurons can help to mitigate the issue.

calix.common.base.TopLevelCalibTarget : public calix.common.base.CalibTarget

:class:CalibTarget that can be calibrated for as part of the public calix API via :func:calix.calibrate.

Public Functions

calibrate(self, hxcomm.ConnectionHandle connection, Optional[CalibOptions] options=None)

Execute a calibration for this target.

:param connection: Connection to be used :param options: Calibration options :return: Calibration result

class calix.common.base.WriteRecordingPlaybackProgramBuilder

Public Functions

__init__(self)
block_until(self, coord, config)
copy_back(self, other)
done(self)
empty(self)
merge_back(self, other)
read(self, coord, backend=None)
write(self, coord, config, backend=None)

Public Members

builder
cocos
dumper
namespace base
namespace cadc
module calix
module calix.calib_cache

Functions

calibrate(base.TopLevelCalibTarget target, Optional[base.CalibOptions] options=None, Optional[List[Path]] cache_paths=None, Optional[bool] cache_read_only=False, Optional connection=None)

Calibrate chip with cache functionality.

Calibration function is deduced from target and options type. If cache_paths is not empty, searches for cached calibration result with same parameters in list order. If no cache is found executes calibration and caches in fist path with write access.

:param target: Target values for calibration. :param options: Options for calibration. :param cache_paths: List of possible cache locations. If list is empty, caching is skipped. If None defaults are used. Defaults are read-only shared wang cache path followed by user home cache. :param cache_read_only: Only read cache file, do not create cache file if one does not exist. :return: Calibration result

Variables

_DEFAULT_LOCAL_CACHE = Path(os.getenv("XDG_CACHE_HOME")).joinpath("calix")
Path
module common
module algorithms

Provides algorithms for running calibrations.

Those algorithms need a Calib instance which, among other settings, yields instructions for configuring parameters and measuring results.

module calix.common.base

Provides abstract base classes for calibrations and algorithms.

Functions

run(StatefulConnection connection, WriteRecordingPlaybackProgramBuilder builder)

Wraps the stadls run function.

Records all write accesses and updates the connection’s reinit program.

Includes a barrier, blocking for the omnibus being idle, before the end of the program. The finished program is returned, such that, e.g., spikes are accessible.

:param connection: Connection to the chip to execute on. :param builder: Builder to execute.

:return: Program compiled by builder.done() that is executed.

Variables

ParameterRange = namedtuple("ParameterRange", ["lower", "upper"])
module calix.common.boundary_check

Functions

check_range_boundaries(np.ndarray parameters, ParameterRange boundaries, Optional[List[str]] errors=None)

Checks if parameters are in a given range and sets them to the limits if they exceed the range.

If error messages are given, returns those if a parameter has reached the limits or has gone beyond.

:param parameters: Array of parameters to check. :param boundaries: Parameter range to be checked for. :param errors: List of error messages to print when parameter exceeds respective boundaries, in format [err_lower, err_upper]. Message needs to include placeholer ‘{0}’ where indices of the violating parameters are inserted.

:return: BoundaryCheckResult, containing parameters within boundaries, error mask and optional error messages.

module calix.common.cadc

Calibrates all CADC channels on Hicann-X for a given dynamic range.

Functions

calibrate(hxcomm.ConnectionHandle connection, Optional[CADCCalibTarget] target=None, Optional[CADCCalibOptions] options=None)

Calibrates all the CADCs (top, bottom, causal, acausal) to work in a given dynamic range (given as CapMem LSB voltage settings).

After calling this function, the CADC is left in a calibrated state, ready for usage.

Part 1 sets the reset voltage of the CADC ramp depending on the given minimum of the dynamic range for readout. The reset voltage is set slightly below this desired readout, such that the CADC reads read_range.lower (default: 20) there (to avoid clipping of channels that get high offsets later).

Part 2 sets the ramp current (steepness) depending on the given maximum of the dynamic range for readout. The current is set such that the ramp crosses the upper end of the dynamic readout range when the counter reads read_range.upper (default: 220). This is partly to avoid the last part of the dynamic range as the ramp will become less linear, and again to avoid clipping of channels with higher offsets.

Part 3 applies a constant calibration voltage to all CADC channels, chosen in the middle of the dynamic range, and requires all channels to read the same result. The digital offsets are set to compensate the observed differences in reads.

:param connection: Connection to a chip that this calibration will run on. :param target: Target parameters for calibration, given as an instance of CADCCalibTarget. Refer there for the individual parameters. :param options: Further options for calibration, given as an instance of CADCCalibOptions. Refer there for the individual parameters.

:returns: CADCCalibResult, containing the settings for the CADC ramps of each quadrant and the digital offsets and calibration success of each channel.

module calix.common.cadc_evaluation

Provides functions which are helpful when evaluating the success of a CADC calibration.

Functions

check_calibration_success(hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder, np.ndarray read_data)

Compare the given uncalibrated reads to a new read that is done with the supplied builder/connection.

Logs a warning if the deviation of reads after calibration is still high.

:param connection: Connection to the chip to run on. :param builder: Builder to append read instructions to. :param read_data: Array of reads before calibration.

compare_results(np.ndarray uncalibrated_data, np.ndarray calibrated_data)

Compare results with calibrated offset and uncalibrated reads.

Logs the mean and standard deviation of CADC reads before and after calibration.

:param uncalibrated_data: Array of CADC samples that will be used as data before calibration. :param calibrated_data: Array of CADC samples after calibration.

module calix.common.cadc_helpers

Provides functions for reading the CADCs and configuring for calibration purposes.

Functions

cadc_read_row(base.WriteRecordingPlaybackProgramBuilder builder, halco.SynramOnDLS synram)

Read one row of CADCs and return the read ticket.

:param builder: Builder to append the read instruction to. :param synram: Synram coordinate of row to read.

:return: Tuple containing:

  • Builder with read instruction appended

  • CADC read ticket

configure_chip(base.WriteRecordingPlaybackProgramBuilder builder)

Configures the chip from an arbitrary state to run CADC calibration.

Set relevant CapMem values of the CADC, connect debug lines to the CADC and set all CADCChannels to default (with zero offsets).

:param builder: Builder to append chip configuration commands to. :return: Builder with configuring commands appended.

configure_readout_cadc_debug(base.WriteRecordingPlaybackProgramBuilder builder)

Writes the readout chain configuration in a way that allows reading the capmem debug cell output voltage at the CADC debug line.

Enables the capmem debug output on stp_v_charge_0.

:param builder: Builder to append the bit-configuration to. :return: Builder with configuration appended to.

convert_success_masks(np.ndarray quadrant_mask)

Converts a mask showing the calibration success of quadrants to a mask showing the success of each channel.

If a quadrant shows False, all channels on that quadrants are set to False.

:param quadrant_mask: Boolean array of length 4, i.e. matching the quadrants on chip.

:return: Boolean array of length 1024, i.e. matching all CADC channels.

read_cadcs(hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder=None)

Read all CADC channels in order top causal, top acausal, bottom causal, bottom acausal.

Dump results into a numpy array.

The readout of the top row is triggered before the bottom row, such that there is a delay of some 100 us between the measurements.

:param connection: Connection to a chip to read CADC channels from. :param builder: Optional builder to be run before reading the CADCs. This allows reading fast after doing other operations.

:return: Array containing integer results for each channel. The order is top causal, top acausal, bottom causal, bottom acausal; within these blocks the channels are ordered from left to right. The order of returned results corresponds to the enums of halco.CADCChannelConfigOnDLS.

reshape_cadc_quadrants(np.ndarray cadc_results)

Reshapes an array containing all CADC samples as obtained with the read_cadcs() function (shape: (1024,)) into a two-dimensional array that holds the CADC results per quadrant (shape: (4, 256)).

:param cadc_results: Flat array of CADC results.

:return: Two-dimensional array of CADC results with the first index being the index of the Quadrant.

module exceptions
module calix.common.helpers

Various helper functions that are more general and thus not contained in one of the named modules.

Functions

capmem_noise(int start=-5, int end=6, Optional[Union[int, Tuple[int]]] size=None)

Creates random integers between start and end-1.

Used mainly to vary CapMem settings in order to avoid setting many cells to the same value.

:param start: Lower end of the random range. :param end: One above the upper end of the random range. :param size: Number/shape of values to draw. If None, a single integer is returned.

:return: Array with integer noise, or single integer.

capmem_set_neuron_cells(base.WriteRecordingPlaybackProgramBuilder builder, Dict[halco.CapMemRowOnCapMemBlock, Union[int, np.ndarray]] config)

Set single CapMem rows on the neurons to the desired values.

Expects parameters to be configured along with the desired row coordinates. The parameters can either be a numpy array of integer values, which are written to the neurons directly, or a single value, which is written only after adding some noise of +/- 5, if the range allows. Values of zero are not changed, turning something off is always possible.

:param builder: Builder to append configuration to. :param config: Dict which contains pairs of CapMemRowOnCapMemBlock coordinates and either a single CapMemCell value or an array of CapMemCell values. In case a single non-zero value is given, it is changed to an array with noise and this array is written to hardware. This aims to reduce the crosstalk between CapMem cells.

:return: Builder with configuration appended.

capmem_set_quadrant_cells(base.WriteRecordingPlaybackProgramBuilder builder, Dict[halco.CapMemCellOnCapMemBlock, Union[int, np.ndarray]] config)

Set multiple CapMem cells that are global per quadrant to the same provided values.

:param builder: Builder to append configuration to. :param config: Dict with the desired configuration.

:return: Builder with configuration appended.

wait(base.WriteRecordingPlaybackProgramBuilder builder, pq.quantity.Quantity waiting_time)

Waits for a given amount of time.

This function appends instructions to the given builder which first reset the timer and then wait until the given time is reached.

:param builder: Builder to add wait instruction to. :param waiting_time: Time to wait for.

:return: Builder with wait instruction added to.

module madc_base

Provides an abstract base class for calibrations utilizing the MADC.

module synapse
module calix.constants

Global constants used for calibrations.

Variables

cadc_reliable_range = base.ParameterRange(30, 210)
capmem_level_off_time = 20000 * pq.us
tau_mem_range = base.ParameterRange(0.1 * pq.us, 100 * pq.us)
tau_syn_range = base.ParameterRange(0.1 * pq.us, 100 * pq.us)
module calix.hagen

Module for calibrating the HICANN-X chips for usage in hagen mode, i.e.

for multiply-accumulate operation.

Functions

calibrate(hxcomm.ConnectionHandle connection, Optional[HagenCalibTarget] target=None, Optional[HagenCalibOptions] options=None)

Execute a full calibration for hagen mode: Calibrate CADCs to a suitable dynamic range.

Calibrate neurons, calibrate synapse drivers.

The chip has to be initialized first, which can be done using the stadls ExperimentInit().

The individual calibrations’ default parameters can be overwritten by providing the appropriate arguments.

:param connection: Connection to the chip to calibrate. :param target: Target parameters for calibration, given as an instance of HagenCalibTarget. :param options: Further options for calibration, given as an instance of HagenCalibOptions.

:return: HagenCalibResult, containing cadc, neuron and synapse driver results.

calibrate_for_synin_integration(hxcomm.ConnectionHandle connection, Optional[HagenSyninCalibTarget] target=None, Optional[HagenSyninCalibOptions] options=None)

Calibrate the chip for integration on synaptic input lines.

Calibrate CADC, synapse drivers, and synapse DAC bias.

:param connection: Connection to the chip to calibrate. :param target: Calib target parameters. :param options: Further options for calibration.

:return: Calib result for integration on the synaptic input lines.

module multiplication

Provides a class which handles multiplication of vectors with matrices on the synaptic input line.

module calix.hagen.neuron

Calibrate neurons for integrating synaptic inputs, as it is desired using the hagen mode.

Call the function calibrate(connection) to run the calibration.

Functions

calibrate(hxcomm.ConnectionHandle connection, Optional[NeuronCalibTarget] target=None, Optional[NeuronCalibOptions] options=None)

Set up the neurons for integration.

This calibration aims to equalize the neurons’ leak and reset potentials as well as the synaptic input strength and time constants.

Initially, the leak bias currents are calibrated such that the membrane time constants are equal for all neurons. This has to be done before matching the synaptic input strengths, as a neuron with higher leakage would show smaller integrated amplitudes even if the current inputs were matched. For this calibration, the neurons are reset to a potential below the leak, and the rise of the voltage is captured using the CADCs. This allows to roughly match the membrane time constant to the given value.

The synaptic input OTA bias currents are calibrated such that they yield the same charge output to the membrane for each synaptic input. The synaptic input reference potentials are recalibrated in every run of the search for the bias currents, as the required voltage offset between the two inputs of the OTA changes with the bias current.

Afterwards, the leak OTA bias current is reduced while keeping the noise in CADC readouts after the integration near the target. Reducing the target noise results in higher leak bias currents and thus a lower membrane time constant, which means fast decay of the synaptic inputs. Increasing the target noise means the neuron does a better job at integrating the inputs, but at the cost of reproducibility of the results, since noise of the synaptic input is more amplified. Apart from the pure statistical noise, systematic offsets are considered in this part of the calibration. The leak potential was calibrated before adjusting the leak biases. If a neuron drifts away from the expected leak potential, the leak bias current will be increased as well.

The whole leak bias current readjustment can be disabled by setting the parameter target_noise to None.

After setting the leak bias currents low, the resting potential of the neurons is prone to floating away from the leak potential. Thus, the synaptic input reference potentials are recalibrated, which can compensate systematic effects like a constant leakage current onto the membrane. Eventually, leak and reset potentials are calibrated.

Requirements:

:param connection: Connection to the chip to calibrate. :param target: Calib target, given as an instance of NeuronCalibTarget. Refer there for the individual parameters. :param options: Further calibration options, given as an instance of NeuronCalibOptions. Refer there for the individual parameters.

:return: NeuronCalibResult, containing all calibrated parameters.

:raises ValueError: If target parameters are not in a feasible range. :raises ValueError: If target parameters are not shaped as specified. :raises TypeError: If time constants are not given with a unit from the quantities package.

calibrate_baseline(hxcomm.ConnectionHandle connection, int target_read=128)

Calibrate the CADC channel offsets such that the neuron baseline, that is reading shortly after a reset without getting synaptic input, reads the given target value.

This calibration can only be called after the neuron calibration has finished, as it permanently overwrites the CADC offsets. Thus, the CADCs can no longer read constant voltages precisely.

This eases the calculation of amplitudes of inputs, as no extra baseline read is required.

:param connection: Connection to the chip to calibrate. :param target_read: Target CADC read of all neurons at baseline.

:return: CalibResult, containing:

  • Calibrated CADC channel offsets.

  • Success mask of calibration - False for CADC channels that could not be matched to the target read.

module neuron_dataclasses

Dataclasses for hagen neuron calib target and result.

module calix.hagen.neuron_evaluation

Functions to print statistics of the neuron membrane potentials per quadrant.

Functions

measure_quadrant_results(hxcomm.ConnectionHandle connection, np.ndarray success_mask=np.ones(halco.NeuronConfigOnDLS.size, dtype=np.bool))

Measure the current membrane potentials (without any inputs) and log statistics by quadrant at DEBUG level.

:param connection: Connection to chip to run on. :param success_mask: Mask of successfully calibrated neurons. Neurons which have failed are excluded when calculating statistics.

module calix.hagen.neuron_helpers

Provides functions for reading neuron membrane potentials and configuring them for integration.

Functions

cadc_read_neuron_potentials(hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder=None)

Read from the CADCs and interpret the results as membrane potentials.

Use acausal and causal channels for reading neuron output voltages. We expect the neurons’ readout amplifiers to be enabled and connected to both acausal and causal channels. We return the mean of the two channels as a neuron membrane read.

When supplying a builder, it is used to read. Note that between reading top and bottom neurons, some 100 us pass, i.e. this function is not suitable for reading integrated amplitudes.

:param connection: Connection to chip to read membrane potentials. :param builder: Builder to append read instructions to before execution.

:return: Numpy array containing the results for all neurons.

cadc_read_neurons_repetitive(hxcomm.ConnectionHandle connection, base.WriteRecordingPlaybackProgramBuilder builder, *halco.SynramOnDLS synram, int n_reads=50, pq.quantity.Quantity wait_time=1000 *pq.us, bool reset=False)

Read the potential from all neurons multiple times.

Reads all CADC channels multiple times and calculates the mean of acausal and causal reads as neuron voltage. Note that the CADCs have to be connected to the neurons for this to make sense. Returns a 2-dimensional array of the results.

:param connection: Connection to the chip to run on. :param builder: Builder to use for reads. Gets executed along the way. :param synram: Synram coordinate to read neuron potentials from. :param n_reads: Number of reads to execute for all channels. :param wait_time: Time to wait between two successive reads. :param reset: Select whether the neurons’ membranes are connected to the reset potential some 30 us before measuring.

:return: Array containing all obtained values. The first dimension is the number of reads, the second the number of neurons on synram.

configure_chip(base.WriteRecordingPlaybackProgramBuilder builder, int v_leak=700, int n_synapse_rows=8, Optional[halco.AtomicNeuronOnDLS] readout_neuron=None)

Does all the necessary configurations on the chip to start calibrating the neurons for usage in hagen mode.

Configures neurons statically for integration, sets synapse connections, global synapse driver and PADI settings, CapMem and readout settings.

:param builder: Builder to append configuration to. :param v_leak: Leak potential CapMem setting to start calibrations with. :param n_synapse_rows: Number of synapse rows to enable. :param readout_neuron: Coordinate of the neuron to be connected to a readout pad, i.e. can be observed using an oscilloscope. or the MADC. The neuron is connected to the upper pad via readout mux 0, CADC ramp is connected to the lower pad via readout mux 1. If None, neither the CADC ramp nor the neuron is connected to the pads, the readout chain configuration is untouched.

:return: Tuple containing:

  • Builder with configuration instructions appended.

  • Dict of configured neuron CapMem parameters.

configure_integration(base.WriteRecordingPlaybackProgramBuilder builder)

Applies static configuration required for integrate-operation of the neurons in hagen mode.

Configures the chip such that the CADCs can read out neuron membranes. This means setting the switches to connect the columns to the CADC.

:param builder: Builder to append configuration instructions to.

:return: Builder with configuration.

configure_readout_neurons(base.WriteRecordingPlaybackProgramBuilder builder, halco.AtomicNeuronOnDLS readout_neuron)

Configure the readout such that the membrane potential of one neuron and the CADC ramp is available at the pads.

When using an oscilloscope, you may set the trigger to the CADC ramp in order to observe CADC measurements. Note, however, that connecting a simple cable to the CADC ramp output will not suffice, a low-capacitance probe is required to read the ramp correctly.

:param builder: Builder to append configuration to. :param readout_neuron: Coordinate of the neuron to be connected to a readout pad, i.e. can be observed using an oscilloscope.

:return: Builder with configuration instructions.

configure_stp_and_padi(base.WriteRecordingPlaybackProgramBuilder builder)

Configure global STP config and PADI bus config to default.

:param builder: Builder to append instructions to.

:return: Builder with instructions appended.

configure_synapses(base.WriteRecordingPlaybackProgramBuilder builder, int n_synapse_rows=8, *hal.SynapseQuad.Label stimulation_address=hal.SynapseQuad.Label(0), hal.SynapseQuad.Weight weight=hal.SynapseQuad.Weight(10))

Configures the synapses such that events can be sent to the neurons.

The given number of synapse rows are enabled. This function does not configure synapse drivers, as they need to select excitatory/inhibitory row modes when events are sent.

:param builder: Builder to append configuration instructions to. :param n_synapse_rows: Number of rows in which the synapses are enabled. :param stimulation_address: Address to use for inputs. Disabled synapses get set to (stimulation_address + 1) % address_range. :param weight: Weight of enabled synapses.

:return: Builder with configuration.

enable_all_synapse_drivers(base.WriteRecordingPlaybackProgramBuilder builder, hal.SynapseDriverConfig.RowMode row_mode)

Configure synapse drivers to drive both connected rows of synapses either excitatory or inhibitory.

All drivers listen to all row select addresses of PADI events.

:param builder: Builder to append configuration to. :param row_mode: Row mode (excitatory/inhibitory) to use for both rows.

:return: Builder with configuration appended.

inspect_read_tickets(Union[sta.ContainerTicket, List[sta.ContainerTicket]] read_tickets)

Iterate the given read tickets and return the contained results as an array.

The values are extracted from the tickets and for each column (and ticket) the average of the causal and acausal channel is calculated. Note that this only makes sense if both causal and acausal channels are connected to the same potential, here reading from the neurons.

:param read_tickets: List of read tickets to be evaluated, or single ticket.

:return: Array of CADC averaged reads. If a single ticket is provided, the array is one-dimensional, containing results for all reads in a row. If a list of tickets is provided, the array is two-dimensional, with the outer dimension matching the order of tickets in the list.

neuron_backend_config_default()

Return a neuron backend config suitable for hagen mode.

Only the refractory time settings (counter and clock) are set, otherwise it is default constructed.

:return: NeuronBackendConfig suitable for integration.

neuron_config_default()

Return a neuron configuration suitable for integration.

Mainly, the synaptic inputs and membrane readout get enabled. Enabling leak divisions allows to achieve long membrane time constants, as required for integration.

:return: NeuronConfig suitable for integration.

reconfigure_synaptic_input(hxcomm.ConnectionHandle connection, Optional[Union[int, np.ndarray]] excitatory_biases=None, Optional[Union[int, np.ndarray]] inhibitory_biases=None)

Reconfigures the excitatory and inhibitory synaptic inputs of all neurons.

If excitatory_biases are given, they are written to the excitatory synaptic input bias current cells. If the bias current is zero, it is disabled in the neuron config, if another number is given, it is enabled. If a single integer is given, all neurons are configured to this value plus some noise. If an array of values is provided, each neuron’s synaptic input OTA bias is set to the given values.

If excitatory_biases are None, the excitatory synaptic input is not reconfigured at all. Configuring the inhibitory synaptic input works similarly.

This function reads the current neuron config, turns on/off the desired synaptic inputs as described above, and writes the config back to the neurons.

:param connection: Connection to chip to run on. :param excitatory_biases: Neuron excitatory synaptic input OTA bias current setting to configure. :param inhibitory_biases: Neuron excitatory synaptic input OTA bias current setting to configure.

reset_neurons(base.WriteRecordingPlaybackProgramBuilder builder, halco.SynramOnDLS synram=None)

Trigger an artificial reset in all neurons.

The membrane potential gets pulled back to the reset potential.

:param builder: Builder to append reset instructions to. :param synram: Synram of neurons to be reset. If None, all neurons on the chip are reset.

:return: Builder with reset instructions appended.

reshape_neuron_quadrants(np.ndarray neuron_reads)

Reshape the flat reads for all neurons on the chip to a two-dimensional array containing the 4 quadrants in the first dimension and 128 neuron reads each in the second dimension.

:param neuron_reads: Flat array of 512 neuron reads.

:return: Reshaped array containing quadrant results.

set_analog_neuron_config(base.WriteRecordingPlaybackProgramBuilder builder, Union[int, np.ndarray] v_leak, Union[int, np.ndarray] i_leak)

Configure all neurons’ CapMem cells to the given v_leak potential and the given i_leak bias current.

The other parameters are chosen as usable defaults, the reset potential is set equal to the leak potential. Also, we turn off the synaptic input bias currents, since the synaptic inputs can not be used without calibration. The reset bias current is set maximum.

:param builder: Builder to append the configuration to. :param v_leak: CapMem setting of the leak potential for all neurons. If an array is given, it is written to the neurons following enumeration of halco.NeuronConfigs. If a single integer is given, some noise (+- 5) is added before writing the values. The reset voltage is set as well, always equal to the leak voltage. :param i_leak: CapMem setting of the leak bias current for all neurons, noise will be added as for v_leak.

:return: Tuple containing:

  • Builder with configuration instructions appended.

  • Dict containing the exact configured parameters for each neuron.

set_global_capmem_config(base.WriteRecordingPlaybackProgramBuilder builder)

Set required global bias currents to static values.

:param builder: Builder to append instructions to.

:return: Builder with instructions appended.

Variables

_coord = halco.NeuronResetQuadOnDLS(_quad_coord, _synram)
neuron_reset_builders = {_coord: base.WriteRecordingPlaybackProgramBuilder() for _coordin halco.iter_all(halco.SynramOnDLS)}
module neuron_leak_bias
module neuron_potentials

Provides functions to calibrate leak and reset potential.

module neuron_synin
module neuron_synin_coba

Provides calibration classes for conductance-based (COBA) synaptic input parameters.

module calix.hagen.synapse_driver

Provides a function to calibrate the synapse drivers for hagen-mode input activation encoding.

This boils down to calibrating the STP ramp current such that the emitted amplitudes utilize the available dynamic range, and calibrating the hagen-mode DAC offsets such that different drivers yield the same amplitudes.

These calibrations are performed on the synaptic input lines, therefore we require calibrated CADCs, but the neurons don’t need to be calibrated.

Functions

calibrate(hxcomm.ConnectionHandle connection, Optional[SynapseDriverCalibOptions] options=None)

Calibrate the synapse drivers’ STP offsets such that the amplitudes match when using hagen mode.

The STP ramp currents are calibrated such that drivers connected to each CapMem Block use the available dynamic range. To achieve that, we (1) select the drivers with median amplitudes per quadrant, (2) measure the maximum amplitudes generated by these drivers, (3) set the ramp current such that the activation scales amplitudes sensibly.

The hagen-mode DAC offsets are calibrated for each driver afterwards.

Requirements:

:param connection: Connection to the chip to run on. :param options: Calib options, given as an instance of SynapseDriverCalibOptions.

:return: SynapseDriverCalibResult containing STP ramp currents for the CapMem blocks, offsets for the drivers, and a success mask.

preconfigure_capmem(base.WriteRecordingPlaybackProgramBuilder builder)

Set necessary static biases required for hagen mode.

:param builder: Builder to append configuration instructions to.

:return: Builder with configuration instructions appended.

Variables

DEFAULT_STP_OFFSET = hal.SynapseDriverConfig.Offset.max // 2
RANGE_LIMIT = 0.9
module calix.spiking

Functions

calibrate(hxcomm.ConnectionHandle connection, Optional[SpikingCalibTarget] target=None, Optional[SpikingCalibOptions] options=None)

Execute a full calibration for spiking mode: Calibrate CADCs to a suitable dynamic range.

Calibrate neurons.

The chip has to be initialized first, which can be done using the stadls ExperimentInit().

The individual calibrations’ default parameters can be overwritten by providing cadc_ or neuron_kwargs, respectively.

After the “usual” neuron calibration has finished, the CADC calibration is repeated in order to mitigate CapMem crosstalk effects. Afterwards, the neuron potentials are calibrated once again.

:param connection: Connection to the chip to calibrate. :param target: Target parameters for calibration, given as an instance of SpikingCalibTarget. :param options: Further options for calibration, given as an instance of SpikingCalibOptions.

:return: SpikingCalibResult, containing cadc and neuron results.

module calix.spiking.correlation

Provides classes for calibration of the correlation characteristics, i.e.

time constants and amplitudes.

Functions

calibrate(hxcomm.ConnectionHandle connection, *Optional[CorrelationCalibTarget] target=None, Optional[CorrelationCalibOptions] options=None)

Calibrate all synapses’ correlation parameters.

The CapMem bias currents are set such that the target amplitude and time constant are reached in the median of the measured synapses.

If desired, the individual synapses’ calibration bits are then used to shrink the deviations between synapses. This takes some two hours of runtime, and can be enabled via the calibrate_synapses option.

Note that a strong asymmetry between causal and acausal traces is present on many synapses. This cannot be countered by calibration, as calibration parameters apply to both branches equally. In case your experiment uses only one branch, you can set the branches option accordingly, so that only one is considered during calibration.

Requirements:

  • CADCs are enabled and calibrated.

:param connection: Connection to the chip to calibrate. :param target: Calibration targets, given as an instance of CorrelationCalibTargets. :param options: Further options for calibration, given as an instance of CorrelationCalibOptions.

:return: Correlation calib result.

calibrate_synapses(hxcomm.ConnectionHandle connection, CorrelationCalibResult calib_result)

Set the individual synapses’ calibration bits.

The bits are selected such that the deviation from the targets is smallest. To calculate the deviation, the relative difference in amplitude and time constant is weighted according to the time_constant_priority option and then added squared.

This function will be called automatically as part of the calibrate function, if individual synapses are to be calibrated.

Requirements:

  • CADCs are enabled and calibrated.

  • Correlation sensors are enabled and configured with CapMem biases suitable for the given targets. This can be achieved using the calibrate function.

:param connection: Connection to the chip to calibrate. :param calib_result: Correlation calib result, with CapMem biases already calibrated.

Variables

REPRESENTATIVE_QUADS = [halco.SynapseQuadColumnOnDLS(col) for col in range(0, 16, 4)]
module correlation_measurement

Provides a measurement class that measures correlation amplitudes at different timings of pre- and postspikes, and determines amplitude and time constants.

module calix.spiking.neuron

Provides an interface for calibrating LIF neurons.

Functions

calibrate(hxcomm.ConnectionHandle connection, Optional[NeuronCalibTarget] target=None, Optional[NeuronCalibOptions] options=None)

Calibrate neurons for spiking operation in the LIF model.

Parts of the calibration use the CADC, thus it has to be calibrated beforehand. All parameters are given in a “technical” domain. Parameters can be single values or numpy arrays shaped (512,), matching the number of neurons.

Requirements:

:param connection: Connection to the chip to calibrate. :param target: Calib target, given as an instance of NeuronCalibTarget. Refer there for the individual parameters. :param options: Further options for neuron calibration.

:raises TypeError: If time constants are not given with a unit from the quantities package. :raises ValueError: If parameters are badly shaped or out of feasible range.

calibrate_leak_over_threshold(hxcomm.ConnectionHandle connection, NeuronCalibResult result, pq.Quantity leak_over_threshold_rate=100 *pq.kHz)

Calibrate neurons to a specific firing rate in leak over threshold setup, by adjusting the threshold.

The previously chosen threshold is disregarded here, it is not necessary to choose a leak over threshold setup beforehand. There has to be sufficient range between the reset and leak potential, though, in order to calibrate the threshold in between the two.

:param connection: Connection to the chip to calibrate. :param result: Result of the previous neuron calibration. The spike thresholds will be adjusted. :param leak_over_threshold_rate: Target spike rate, given with a unit in the hardware time domain (so usual values are 10 to 100 kHz). The threshold is calibrated such that the neuron spikes with the given rate without any synaptic input. The previously calibrated threshold is threfore overwritten. If configuring an array in order to set individual targets per neuron, use a rate of zero to leave the threshold untouched.

refine_potentials(hxcomm.ConnectionHandle connection, NeuronCalibResult result, Optional[NeuronCalibTarget] target=None)

Re-calibrate the leak, reset and threshold potentials.

This can be useful to minimize the effects of CapMem crosstalk on the end calibration. For best results, first run/apply a neuron calibration and then re-run the CADC calibration, as it is also affected by the neuron calibration. Call this function last.

:param connection: Connection to the chip to re-calibrate. :param result: Result of the previous neuron calibration. The potentials will be overwritten by the refinement. :param target: Calib target parameters. Only the potentials (leak, reset, threshold) will be used and re-calibrated.

module calix.spiking.neuron_calib_parts

Helper functions representing parts of the spiking neuron calibration.

These functions are intended to be called in a specific order, as it is done in the spiking neuron calibration - please use caution in case you call them directly.

Functions

calibrate_synapse_dac_bias(hxcomm.ConnectionHandle connection, int synapse_dac_bias, calix.hagen.neuron.CalibResultInternal calib_result)

Calibrate the synapse DAC bias.

First, configure the target parameters on each quadrant. Then, calibrate each quadrant’s parameters such that the minimum amplitude of those measured previously on the quadrants is reached.

:param connection: Connection to chip to run on. :param synapse_dac_bias: Target CapMem value for calibration. :param calib_result: Calib result.

calibrate_synaptic_input(hxcomm.ConnectionHandle connection, neuron.NeuronCalibTarget target, neuron._CalibResultInternal calib_result, np.ndarray target_cadc_reads)

Run calibration of (current-based) synaptic inputs.

:param connection: Connection to chip to run on. :param target: Target parameters for neuron calibration. :param calib_result: Calib result to store parameters in. :param target_cadc_reads: CADC samples at resting potential, with synaptic input disabled.

calibrate_synin_coba(hxcomm.ConnectionHandle connection, neuron.NeuronCalibTarget target, neuron.NeuronCalibResult calib_result)

Calibrate synaptic input in COBA mode, i.e.

calibrate the OTA that modulates the CUBA OTA’s bias.

:param connection: Connection to the chip to run on. :param target: Target for neuron calibration. :param calib_result: Neuron calibration result.

calibrate_synin_references(hxcomm.ConnectionHandle connection, np.ndarray target_cadc_reads, neuron._CalibResultInternal calib_result)

Calibrate synaptic input OTA reference potentials such that the given target CADC reads are reached with synaptic inputs enabled, i.e., set to the bias currents in the calib result.

:param connection: Connection to chip to run on. :param target_cadc_reads: Target CADC reads, obtained at leak potential with synaptic inputs disabled. :param calib_result: Result of neuron calibration.

calibrate_tau_mem(hxcomm.ConnectionHandle connection, pq.Quantity tau_mem, neuron._CalibResultInternal calib_result)

Calibrate membrane time constant to given target.

:param connection: Connection to chip to run on. :param tau_mem: Target membrane time constant. :param calib_result: Neuron calibration result.

calibrate_tau_syn(hxcomm.ConnectionHandle connection, np.ndarray tau_syn, neuron._CalibResultInternal calib_result)

Calibrate synaptic input time constant to given target.

:param connection: Connection to chip to run on. :param tau_syn: Target synaptic input time constant. :param calib_result: Calib result to store parameters in.

disable_synin_and_threshold(hxcomm.ConnectionHandle connection, neuron._CalibResultInternal calib_result)

Configure neurons with synaptic input OTAs and spike threshold disabled.

This is a benign state in which many other parameters can be calibrated more easily.

:param connection: Connection to chip to run on. :param calib_result: Neuron calibration result.

finalize_synin_calib(hxcomm.ConnectionHandle connection, neuron._CalibResultInternal calib_result)

Un-set some of the hagen-mode specific parameters that were set in prepare_for_synin_calib.

The synaptic input time constant is re-set to the user-selected value, that was calibrated previously. We don’t change the membrane time constant here, as it will be calibrated only afterwards.

:param connection: Connection to chip to run on. :param calib_result: Calib result to store parameters in.

prepare_for_synin_calib(hxcomm.ConnectionHandle connection, neuron.NeuronCalibOptions options, neuron._CalibResultInternal calib_result)

Preconfigure the chip for synaptic input calibration.

Select a hagen-mode-like setup, i.e. calibrate membrane time constant to a high value and synaptic input time constant to a low value.

Note that there is a corresponding function finalize_synin_calib that undoes some of these changes, i.e. re-applies the synaptic input time constant to the user-selected value.

:param connection: Connection to chip to run on. :param options: Further options for calibration. :param calib_result: Calib result to store parameters in.

:return: Array of target CADC reads at resting potential, to be used as reference point during synaptic input calib.

module neuron_threshold
module calix.spiking.refractory_period

Calculations related to determining the refractory clock scales as well as counter values.

Functions

_calculate_clock_cycles(pq.Quantity refractory_times, int clock_scale, pq.Quantity f_base)

Convert refractory time to clock cycles.

:param refractory_times: Refractory times in time unit. :param clock_scale: Clock scaler of refrectory clock :param f_base: Base frequency of the refractory clock. :return: Refractory times in clock cycles.

_calculate_clock_scale(pq.Quantity min_time_per_cycle, pq.Quantity max_time_per_cycle, pq.Quantity f_base)

Calculate clock scale needed to have a suitable time per cycle.

The clock scaler is chosen such that the minimum time per cycle is fulfilled. Then, it tries to also fulfil the maximum time per cycle. If there’s still headroom, a medium clock scaler will be preferred.

:param min_time_per_cycle: Minimum time one cycle should take. :param max_time_per_cycle: Maximum time one cycle is allowed to take. :param f_base: Base frequency of the refractory clock.

:return: Minimum clock scale for which one cycle needs at least the given time.

:raises ValueError: If requested minimum time per clock cycle is too large for BSS-2.

_clock_period(int clock_scale, pq.Quantity f_base)

Calculate period of refractory clock.

:param clock_scale: Scalinf factor of refrctory clock. :param f_base: Base frequency of the refractory clock. :return: Period length of refractory clock

calculate_settings(pq.Quantity tau_ref, pq.Quantity holdoff_time=0 *pq.us)

Determine scales of fast and slow clock as well as refractory counter settings of individual neurons.

On BSS-2 the refractory period is made up of a “reset period” where the potential is clamped to the reset potential and a “holdoff period” in which the membrane can evolve freely but no new spikes are triggered.

In this function the clock scalers and counter values are chosen such that the given targets for both parameters can be fulfilled.

:param tau_ref: Target refractory times. This is the total time in which the neuron does not emit new spikes and therefore includes the holdoff period. :param holdoff_time: Target length of the holdoff period. Note: Due to hardware constraint the holdoff period is always at least one clock cycle long. For a target of zero the minimal holdoff period is chosen.

:return: Clock settings.

:raises ValueError: If tau_ref and holdoff_time have shapes that are incompatible with the number of neurons on chip.

Variables

_clock_base_frequency = hal.ADPLL().calculate_output_frequency(output=hal.ADPLL().Output.core_1) * pq.Hz
module calix.spiking.synapse_driver

Provides a calibration class for the synapse driver STP offset for the usual spiking mode.

Functions

calibrate(hxcomm.ConnectionHandle connection, *Optional[STPCalibTarget] target=None, Optional[STPCalibOptions] options=None)

Calibrate all synapse drivers’ STP offsets.

The STP ramp current is set as provided in the options. The other STP voltages, as given in the options, are configured after calibration.

Requirements:

  • CADCs and Synapse DAC biases are calibrated.

:param connection: Connection to the chip to calibrate. :param target: Target parameters for calibration. :param options: Further options for calibration, including STP voltages.

:return: STP calib result.

module calix_generate_default_calibration

Execute all available default calibration and saves them in all available data formats.

If result files already exist, they are overwritten.

Functions

run_and_save_all(Path deployment_folder)

Executes all available default calibrations and saves them to all available file formats.

:param deployment_folder: Path calibration results are deployed to.

Variables

args = parser.parse_args()
depl_folder = Path(args.deployment_folder)
exist_ok
help
log = logger.get("calix")
parents
parser = argparse.ArgumentParser(description=__doc__)
True
module calix_generate_weekly_calibration

Execute more specific, long-running calibrations and save them in all available data formats.

If result files already exist, they are overwritten.

Functions

run_and_save_all(Path deployment_folder)

Executes all available default calibrations and saves them to all available file formats.

:param deployment_folder: Path calibration results are deployed to.

Variables

args = parser.parse_args()
depl_folder = Path(args.deployment_folder)
exist_ok
help
log = logger.get("calix")
parents
parser = argparse.ArgumentParser(description=__doc__)
True
namespace madc_base
namespace multiplication
namespace neuron_dataclasses
module neuron_icc_bias
module plateau_potential

Calibrate neurons to generate plateau potentials when spiking and saving the calibration result to disk.

Functions

plateau_potential_decay(*Union[float, np.ndarray] v_leak, Union[float, np.ndarray] v_reset, Union[float, np.ndarray] v_thres, pq.quantity.Quantity tau_mem)

Helper function.

Calculate time needed to exponentially decay below threshold.

In case of plateau potentials the reset potential is above the threshold potential. In this function we calculate how long the membrane needs to relax below the threshold potential if a simple leaky-integrate-and-fire neuron is assumed. If the reset potential is below threshold, i.e. no plateau potential is configured, zero is returned.

:param v_leak: Target leak potentials. :param v_reset: Target reset potentials. :param v_thres: Target threshold potentials. :param tau_mem: Target membrane time constants.

Variables

builder = sta.PlaybackProgramBuilderDumper()
calibration_result = calix.calibrate(     SpikingCalibTarget(neuron_target=neuron_params))

Perform the calibration.

holdoff_time
mode
neuron_params = NeuronCalibTarget(leak=50,threshold=80,reset=100,tau_mem=10 * pq.us,)

Define calibration target.

On BSS-2 plateau potentials are emulated by the refractory mechanism. Instead of choosing a reset near the leak potential it is chosen above the threshold:

refractory_time
target_file = Path('my_calibration.pbin')

Save calibration as portable binary.

tau_mem
v_leak
v_reset
v_thres
namespace sta
namespace std

STL namespace.

file calib_cache.py
file __init__.py
file __init__.py
file __init__.py
file __init__.py
file algorithms.py
file base.py
file boundary_check.py
file cadc.py
file cadc_evaluation.py
file cadc_helpers.py
file exceptions.py
file helpers.py
file madc_base.py
file synapse.py
file constants.py
file plateau_potential.py
file multiplication.py
file neuron_dataclasses.py
file neuron_evaluation.py
file neuron_helpers.py
file neuron_leak_bias.py
file neuron_potentials.py
file neuron_synin.py
file neuron_synin_coba.py
file neuron_icc_bias.py
file calix_generate_default_calibration.py
file calix_generate_weekly_calibration.py
file correlation.py
file correlation_measurement.py
file neuron.py
file neuron.py
file neuron_calib_parts.py
file neuron_threshold.py
file refractory_period.py
file synapse_driver.py
file synapse_driver.py
dir /jenkins/jenlib_workspaces_f9/doc_gerrit_documentation-brainscales2.ZG9jX2dlcnJpdF9kb2N1bWVudGF0aW9uLWJyYWluc2NhbGVzMiMzODM.x/calix
dir /jenkins/jenlib_workspaces_f9/doc_gerrit_documentation-brainscales2.ZG9jX2dlcnJpdF9kb2N1bWVudGF0aW9uLWJyYWluc2NhbGVzMiMzODM.x/calix/src/py/calix
dir /jenkins/jenlib_workspaces_f9/doc_gerrit_documentation-brainscales2.ZG9jX2dlcnJpdF9kb2N1bWVudGF0aW9uLWJyYWluc2NhbGVzMiMzODM.x/calix/src/py/calix/common
dir /jenkins/jenlib_workspaces_f9/doc_gerrit_documentation-brainscales2.ZG9jX2dlcnJpdF9kb2N1bWVudGF0aW9uLWJyYWluc2NhbGVzMiMzODM.x/calix/src/py/calix/examples
dir /jenkins/jenlib_workspaces_f9/doc_gerrit_documentation-brainscales2.ZG9jX2dlcnJpdF9kb2N1bWVudGF0aW9uLWJyYWluc2NhbGVzMiMzODM.x/calix/src/py/calix/hagen
dir /jenkins/jenlib_workspaces_f9/doc_gerrit_documentation-brainscales2.ZG9jX2dlcnJpdF9kb2N1bWVudGF0aW9uLWJyYWluc2NhbGVzMiMzODM.x/calix/src/py/calix/multicomp
dir /jenkins/jenlib_workspaces_f9/doc_gerrit_documentation-brainscales2.ZG9jX2dlcnJpdF9kb2N1bWVudGF0aW9uLWJyYWluc2NhbGVzMiMzODM.x/calix/src/py
dir /jenkins/jenlib_workspaces_f9/doc_gerrit_documentation-brainscales2.ZG9jX2dlcnJpdF9kb2N1bWVudGF0aW9uLWJyYWluc2NhbGVzMiMzODM.x/calix/src/py/calix/scripts
dir /jenkins/jenlib_workspaces_f9/doc_gerrit_documentation-brainscales2.ZG9jX2dlcnJpdF9kb2N1bWVudGF0aW9uLWJyYWluc2NhbGVzMiMzODM.x/calix/src/py/calix/spiking
dir /jenkins/jenlib_workspaces_f9/doc_gerrit_documentation-brainscales2.ZG9jX2dlcnJpdF9kb2N1bWVudGF0aW9uLWJyYWluc2NhbGVzMiMzODM.x/calix/src