calix.common.cadc.ChannelOffsetCalib
-
class
calix.common.cadc.
ChannelOffsetCalib
(dynamic_range_mid: pyhaldls_vx_v3.CapMemCell.Value = Value(310)) Bases:
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: * All CADC channels are connected to the CADC debug line (can be
achieved with cadc_helpers.configure_chip()).
CADC debug line connected to CapMem cell stp_v_charge_0 (can be archived with cadc_helpers.configure_readout_cadc_debug())
- Variables
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.
initial_results – CADC reads before calibrating the offsets. Stored to print statistics after calibration.
-
__init__
(dynamic_range_mid: pyhaldls_vx_v3.CapMemCell.Value = Value(310)) Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
([dynamic_range_mid])Initialize self.
configure_parameters
(builder, parameters)Set up the given CADC channel offsets.
find_target_read
(reads)Inspect a given array of CADC Samples and return the median read of all CADC channels.
measure_results
(connection, builder)Read all CADC channels on chip.
postlude
(connection)Print statistics about the CADC reads before and after calibration.
prelude
(connection)Configure debug readout cell to roughly the middle of the desired dynamic CADC range.
-
configure_parameters
(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder, parameters: numpy.ndarray) → calix.common.base.WriteRecordingPlaybackProgramBuilder Set up the given CADC channel offsets. Expects the given parameter array to be ordered like the iter_all of CADCChannelConfigOnDLS.
- Parameters
builder – Builder to append configuration instructions to.
parameters – CADC channel offsets to set.
- Returns
Builder with configuration instructions appended.
-
static
find_target_read
(reads: numpy.ndarray) → int 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.
- Parameters
reads – Array of CADC Samples for both synrams obtained at a constant common voltage.
- Returns
Calib target for individual CADC channel offsets.
-
measure_results
(connection: pyhxcomm_vx.ConnectionHandle, builder: calix.common.base.WriteRecordingPlaybackProgramBuilder) → numpy.ndarray Read all CADC channels on chip.
- Parameters
connection – Connection to the chip to calibrate.
builder – Builder to append read instructions to.
- Returns
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
(connection: pyhxcomm_vx.ConnectionHandle) Print statistics about the CADC reads before and after calibration. Data after calibration is measured using the connection.
- Parameters
connection – Connection to the chip to run on.
-
prelude
(connection: pyhxcomm_vx.ConnectionHandle) → None 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.
- Parameters
connection – Connection to the chip to calibrate.