calix.spiking.correlation_measurement.CorrelationMeasurement

class calix.spiking.correlation_measurement.CorrelationMeasurement(delays: quantities.quantity.Quantity, *, n_events: int = 100, amp_calib: Union[int, numpy.ndarray] = 0, time_calib: Union[int, numpy.ndarray] = 0, i_ramp: Union[int, numpy.ndarray] = 80, i_store: Union[int, numpy.ndarray] = 70)

Bases: object

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.

Variables
  • delays – Delay between pre- and postspike for correlated spike pairs. Use negative numbers for anticausal spike pairs.

  • n_events – Number of correlated events in one measurement.

  • amp_calib – Amplitude calibration bits for synapses.

  • time_calib – Time constant calibration bits for synapses.

  • i_ramp – Correlation time constant calibration CapMem current.

  • i_store – Correlation amplitude calibration CapMem current.

  • address – Address to use for presynaptic events.

  • wait_between_pairs – Wait time between the individual correlated spike pairs. Should be an order of magnitude greater than the largest delay.

  • log – Logger used to log outputs.

__init__(delays: quantities.quantity.Quantity, *, n_events: int = 100, amp_calib: Union[int, numpy.ndarray] = 0, time_calib: Union[int, numpy.ndarray] = 0, i_ramp: Union[int, numpy.ndarray] = 80, i_store: Union[int, numpy.ndarray] = 70)

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(delays, *[, n_events, amp_calib, …])

Initialize self.

configure_all(builder)

Preconfigure the chip for correlation measurements.

configure_base(builder)

Basic config for reading correlation.

configure_capmem(builder)

Configure synapse bias currents for the correlation sensors.

configure_input(builder)

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

configure_synapses(builder, quad)

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

estimate_fit(results)

Guess fit parameters for exponential traces.

fit(results)

Fit exponential traces to the given correlation data.

fitfunc(delay, amplitude, time_constant, offset)

Exponential fit function for correlation traces.

measure_chip(connection)

Measure correlation data for all synapses on chip.

measure_quad(connection, quad, synram)

Measure correlation data for the given quad.

prelude(connection)

Preconfigure the chip for correlation measurements.

configure_all(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder)None

Preconfigure the chip for correlation measurements.

Parameters

builder – Builder to append configuration instructions to.

static configure_base(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder)None

Basic config for reading correlation.

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

Parameters

builder – Builder to append configuration instructions to.

configure_capmem(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder)None

Configure synapse bias currents for the correlation sensors.

Parameters

builder – Builder to append the configuration to.

static configure_input(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder)None

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

Parameters

builder – Builder to append configuration instructions to.

configure_synapses(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder, quad: pyhalco_hicann_dls_vx_v3.SynapseQuadColumnOnDLS)None

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.

Parameters
  • builder – Builder to append configuration instructions to.

  • quad – Coordinate of synapse quad column to be set to address.

estimate_fit(results: numpy.ndarray)Tuple[numpy.ndarray, quantities.quantity.Quantity]

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.

Parameters

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.

Returns

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(results: numpy.ndarray)Tuple[numpy.ndarray, quantities.quantity.Quantity]

Fit exponential traces to the given correlation data.

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

Parameters

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.

Returns

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.

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

Exponential fit function for correlation traces.

measure_chip(connection: pyhxcomm_vx.ConnectionHandle)numpy.ndarray

Measure correlation data for all synapses on chip.

Parameters

connection – Connection to the chip to run on.

Returns

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(connection: pyhxcomm_vx.ConnectionHandle, quad: pyhalco_hicann_dls_vx_v3.SynapseQuadColumnOnDLS, synram: pyhalco_hicann_dls_vx_v3.SynramOnDLS)numpy.ndarray

Measure correlation data for the given quad.

Parameters
  • connection – Connection to the chip to run on.

  • quad – Synapse quad column coordinate to measure correlation on.

  • synram – Synapse array coordinate to measure correlation on.

Returns

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(connection: pyhxcomm_vx.ConnectionHandle)None

Preconfigure the chip for correlation measurements.

Parameters

connection – Connection to the chip to run on.