calix.common.cadc_helpers

Provides functions for reading the CADCs and configuring for calibration purposes.

Functions

calix.common.cadc_helpers.cadc_read_row(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder, synram: pyhalco_hicann_dls_vx_v3.SynramOnDLS)Tuple[calix.common.base.WriteRecordingPlaybackProgramBuilder, pystadls_vx_v3.ContainerTicket]

Read one row of CADCs and return the read ticket.

Parameters
  • builder – Builder to append the read instruction to.

  • synram – Synram coordinate of row to read.

Returns

Tuple containing: * Builder with read instruction appended * CADC read ticket

calix.common.cadc_helpers.configure_chip(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder)calix.common.base.WriteRecordingPlaybackProgramBuilder

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

Parameters

builder – Builder to append chip configuration commands to.

Returns

Builder with configuring commands appended.

calix.common.cadc_helpers.configure_readout_cadc_debug(builder: calix.common.base.WriteRecordingPlaybackProgramBuilder)calix.common.base.WriteRecordingPlaybackProgramBuilder

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.

Parameters

builder – Builder to append the bit-configuration to.

Returns

Builder with configuration appended to.

calix.common.cadc_helpers.convert_success_masks(quadrant_mask: numpy.ndarray)numpy.ndarray

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.

Parameters

quadrant_mask – Boolean array of length 4, i.e. matching the quadrants on chip.

Returns

Boolean array of length 1024, i.e. matching all CADC channels.

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

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.

Parameters
  • connection – Connection to a chip to read CADC channels from.

  • builder – Optional builder to be run before reading the CADCs. This allows reading fast after doing other operations.

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.

calix.common.cadc_helpers.reshape_cadc_quadrants(cadc_results: numpy.ndarray)numpy.ndarray

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

Parameters

cadc_results – Flat array of CADC results.

Returns

Two-dimensional array of CADC results with the first index being the index of the Quadrant.