calix.common.madc_base.Recorder
-
class
calix.common.madc_base.
Recorder
Bases:
abc.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.
- Variables
original_readout_config – Source selection mux config before start of the experiment. Used to restore state after the experiment has finished.
original_neuron_configs – Neuron configs before start of the experiment. Used to restore state after the experiment.
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.
_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.
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.
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.
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.
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.
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.
-
__init__
() Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
()Initialize self.
build_measurement_program
(builder)Builds a program to measure an arbitrary MADC trace for each neuron.
neuron_config_disabled
(neuron_coord)Return a neuron config in silent state, i.e. disconnected from the common readout lines.
neuron_config_readout
(neuron_coord)Return a neuron config with readout active and connected to the readout lines.
prepare_recording
(connection)Prepares chip for the experiment.
record_traces
(connection, builder)Executes measurement on chip, returns samples per neuron.
restore_initial_state
(connection)Restore original readout and neuron configuration.
stimulate
(builder, neuron_coord, …)Execute some commands after triggering MADC sampling.
-
build_measurement_program
(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder) → Tuple[calix.common.base.WriteRecordingPlaybackProgramBuilder, List[pystadls_vx_v3.ContainerTicket]] 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.
- Parameters
builder – Builder to append instructions to.
- Returns
Tuple containing: * Builder with instructions appended. * List of read tickets marking start and end of the
recording of each neuron.
-
abstract
neuron_config_disabled
(neuron_coord: pyhalco_hicann_dls_vx_v3.NeuronConfigOnDLS) → pyhaldls_vx_v3.NeuronConfig Return a neuron config in silent state, i.e. disconnected from the common readout lines.
- Parameters
neuron_coord – Coordinate of neuron to get config for.
- Returns
Neuron config with readout disabled.
-
abstract
neuron_config_readout
(neuron_coord: pyhalco_hicann_dls_vx_v3.NeuronConfigOnDLS) → pyhaldls_vx_v3.NeuronConfig Return a neuron config with readout active and connected to the readout lines.
- Parameters
neuron_coord – Coordinate of neuron to get config for.
- Returns
Neuron config with readout enabled.
-
prepare_recording
(connection: pyhxcomm_vx.ConnectionHandle) 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.
- Parameters
connection – Connection to the chip.
-
record_traces
(connection: pyhxcomm_vx.ConnectionHandle, builder: calix.common.base.WriteRecordingPlaybackProgramBuilder) → List[numpy.ndarray] Executes measurement on chip, returns samples per neuron.
- Parameters
connection – Connection to the chip to calibrate.
builder – Builder to append measurement program to.
- Returns
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
(connection: pyhxcomm_vx.ConnectionHandle) Restore original readout and neuron configuration.
- Parameters
connection – Connection to the chip to calibrate.
-
abstract
stimulate
(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder, neuron_coord: pyhalco_hicann_dls_vx_v3.NeuronConfigOnDLS, stimulation_time: pyhaldls_vx_v3.Timer.Value) → calix.common.base.WriteRecordingPlaybackProgramBuilder Execute some commands after triggering MADC sampling.
E.g., synaptic inputs could be sent to observe their shape.
- Parameters
builder – Builder to append stimulation instructions to.
neuron_coord – Coordinate of neuron which is currently recorded.
stimulation_time – Timer value at beginning of stimulation.
- Returns
Builder with stimulation instructions appended.