calix.hagen.neuron_helpers

Provides functions for reading neuron membrane potentials and configuring them for integration.

Classes

CADCReadNeurons

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

Functions

calix.hagen.neuron_helpers.cadc_read_neuron_potentials(connection: pyhxcomm_vx.ConnectionHandle, builder: Optional[calix.common.base.WriteRecordingPlaybackProgramBuilder] = None)numpy.ndarray

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.

Parameters
  • connection – Connection to chip to read membrane potentials.

  • builder – Builder to append read instructions to before execution.

Returns

Numpy array containing the results for all neurons.

calix.hagen.neuron_helpers.cadc_read_neurons_repetitive(connection: pyhxcomm_vx.ConnectionHandle, builder: calix.common.base.WriteRecordingPlaybackProgramBuilder, *, synram: pyhalco_hicann_dls_vx_v3.SynramOnDLS, n_reads: int = 50, wait_time: quantities.quantity.Quantity = array(1000.) * us, reset: bool = False)numpy.ndarray

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.

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

  • builder – Builder to use for reads. Gets executed along the way.

  • synram – Synram coordinate to read neuron potentials from.

  • n_reads – Number of reads to execute for all channels.

  • wait_time – Time to wait between two successive reads.

  • reset – Select whether the neurons’ membranes are connected to the reset potential some 30 us before measuring.

Returns

Array containing all obtained values. The first dimension is the number of reads, the second the number of neurons on synram.

calix.hagen.neuron_helpers.configure_chip(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder, v_leak: int = 700, n_synapse_rows: int = 8, readout_neuron: Optional[pyhalco_hicann_dls_vx_v3.AtomicNeuronOnDLS] = None)Tuple[calix.common.base.WriteRecordingPlaybackProgramBuilder, Dict[pyhalco_hicann_dls_vx_v3.CapMemRowOnCapMemBlock, numpy.ndarray]]

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.

Parameters
  • builder – Builder to append configuration to.

  • v_leak – Leak potential CapMem setting to start calibrations with.

  • n_synapse_rows – Number of synapse rows to enable.

  • 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.

Returns

Tuple containing: * Builder with configuration instructions appended. * Dict of configured neuron CapMem parameters.

calix.hagen.neuron_helpers.configure_integration(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder)calix.common.base.WriteRecordingPlaybackProgramBuilder

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.

Parameters

builder – Builder to append configuration instructions to.

Returns

Builder with configuration.

calix.hagen.neuron_helpers.configure_readout_neurons(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder, readout_neuron: pyhalco_hicann_dls_vx_v3.AtomicNeuronOnDLS)calix.common.base.WriteRecordingPlaybackProgramBuilder

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.

Parameters
  • builder – Builder to append configuration to.

  • readout_neuron – Coordinate of the neuron to be connected to a readout pad, i.e. can be observed using an oscilloscope.

Returns

Builder with configuration instructions.

calix.hagen.neuron_helpers.configure_stp_and_padi(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder)calix.common.base.WriteRecordingPlaybackProgramBuilder

Configure global STP config and PADI bus config to default.

Parameters

builder – Builder to append instructions to.

Returns

Builder with instructions appended.

calix.hagen.neuron_helpers.configure_synapses(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder, n_synapse_rows: int = 8, *, stimulation_address: pyhalco_hicann_dls_vx_v3.SynapseLabel = SynapseLabel(0), weight: pyhaldls_vx_v3.SynapseWeightQuad.Value = Value(10))calix.common.base.WriteRecordingPlaybackProgramBuilder

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.

Parameters
  • builder – Builder to append configuration instructions to.

  • n_synapse_rows – Number of rows in which the synapses are enabled.

  • stimulation_address – Address to use for inputs. Disabled synapses get set to (stimulation_address + 1) % address_range.

  • weight – Weight of enabled synapses.

Returns

Builder with configuration.

calix.hagen.neuron_helpers.enable_all_synapse_drivers(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder, row_mode: pyhaldls_vx_v3.SynapseDriverConfig.RowMode)calix.common.base.WriteRecordingPlaybackProgramBuilder

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.

Parameters
  • builder – Builder to append configuration to.

  • row_mode – Row mode (excitatory/inhibitory) to use for both rows.

Returns

Builder with configuration appended.

calix.hagen.neuron_helpers.inspect_read_tickets(read_tickets: Union[pystadls_vx_v3.ContainerTicket, List[pystadls_vx_v3.ContainerTicket]])numpy.ndarray

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.

Parameters

read_tickets – List of read tickets to be evaluated, or single ticket.

Returns

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.

calix.hagen.neuron_helpers.neuron_backend_config_default()pyhaldls_vx_v3.NeuronBackendConfig

Return a neuron backend config suitable for hagen mode.

Only the refractory time settings (counter and clock) are set, otherwise it is default constructed.

Returns

NeuronBackendConfig suitable for integration.

calix.hagen.neuron_helpers.neuron_config_default()pyhaldls_vx_v3.NeuronConfig

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.

Returns

NeuronConfig suitable for integration.

calix.hagen.neuron_helpers.reconfigure_synaptic_input(connection: pyhxcomm_vx.ConnectionHandle, excitatory_biases: Optional[Union[int, numpy.ndarray]] = None, inhibitory_biases: Optional[Union[int, numpy.ndarray]] = None)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.

Parameters
  • connection – Connection to chip to run on.

  • excitatory_biases – Neuron excitatory synaptic input OTA bias current setting to configure.

  • inhibitory_biases – Neuron excitatory synaptic input OTA bias current setting to configure.

calix.hagen.neuron_helpers.reset_neurons(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder, synram: Optional[pyhalco_hicann_dls_vx_v3.SynramOnDLS] = None)calix.common.base.WriteRecordingPlaybackProgramBuilder

Trigger an artificial reset in all neurons.

The membrane potential gets pulled back to the reset potential.

Parameters
  • builder – Builder to append reset instructions to.

  • synram – Synram of neurons to be reset. If None, all neurons on the chip are reset.

Returns

Builder with reset instructions appended.

calix.hagen.neuron_helpers.reshape_neuron_quadrants(neuron_reads: numpy.ndarray)numpy.ndarray

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.

Parameters

neuron_reads – Flat array of 512 neuron reads.

Returns

Reshaped array containing quadrant results.

calix.hagen.neuron_helpers.set_analog_neuron_config(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder, v_leak: Union[int, numpy.ndarray], i_leak: Union[int, numpy.ndarray])Tuple[calix.common.base.WriteRecordingPlaybackProgramBuilder, Dict[pyhalco_hicann_dls_vx_v3.CapMemRowOnCapMemBlock, numpy.ndarray]]

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.

Parameters
  • builder – Builder to append the configuration to.

  • 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.NeuronConfig`s. 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.

  • i_leak – CapMem setting of the leak bias current for all neurons, noise will be added as for v_leak.

Returns

Tuple containing: * Builder with configuration instructions appended. * Dict containing the exact configured parameters for each neuron.

calix.hagen.neuron_helpers.set_global_capmem_config(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder)calix.common.base.WriteRecordingPlaybackProgramBuilder

Set required global bias currents to static values.

Parameters

builder – Builder to append instructions to.

Returns

Builder with instructions appended.