qat.runtime.post_processing module

apply_post_processing(response, post_processing, axes)

Applies software post processing to the results.

Uses the information in the PostProcessing instruction to determine what method to apply.

Parameters:
  • response (ndarray) – Readout results from an execution engine.

  • post_processing (PostProcessing) – The post processing instruction.

  • axes (Dict[ProcessAxis, int]) – A dictionary containing which axes contain the shots and which contain time series.

Return type:

(ndarray, dict[ProcessAxis, int])

Returns:

The processed results as an array and the axis map.

discriminate(response, axes, threshold)

Discriminates a real value to a classical bit by comparison to a supplied discrimination threshold.

Parameters:
  • response (np.ndarray) – Readout results from an execution engine.

  • axes (dict[ProcessAxis, Int]) – A dictionary containing which axes contain the shots and which contain time series.

  • threshold (float) – The supplied discrimination threshold.

Returns:

The processed results as an array and the axis map.

down_convert(response, axes, frequency, dt)

Down-conversion of the readout signal.

If down-conversion of the readout signal is not done on the hardware, is can be done via software using this method. Can only be done over the ProcessAxis.TIME axis.

Parameters:
  • response (np.ndarray) – Readout results from an execution engine.

  • axes (dict[ProcessAxis, Int]) – A dictionary containing which axes contain the shots and which contain time series.

  • frequency (float) – Down-conversion frequency

  • dt (float) – The sampling rate for the readout

Returns:

The processed results as an array and the axis map.

get_axis_map(mode, response)

Given the acquisition mode, determine what each axis corresponds to.

The way the results are returned are defined by the acquisition mode: this could be averaged over shots, averaged over time, or neither. We must determine how to unpack the results.

Parameters:
  • mode (AcquireMode) – The acquisition mode.

  • response (ndarray) – The response returned by the target machine.

Return type:

Dict[ProcessAxis, int]

Returns:

A dictionary containing the axis index for each type of ProcessAxis.

linear_map_complex_to_real(response, axes, multiplier, constant)

Maps complex values onto a real z-projection using a provided linear mapping.

Parameters:
  • response (np.ndarray) – Readout results from an execution engine.

  • axes (dict[ProcessAxis, Int]) – A dictionary containing which axes contain the shots and which contain time series.

  • multiplier (numbers.Number) – Coeffecient for the linear map.

  • constant (numbers.Number) – Constant for the linear map.

Returns:

The processed results as an array and the axis map.

mean(response, axes, target_axes)

Calculates the mean over the given axes.

Parameters:
  • response (np.ndarray) – Readout results from an execution engine.

  • axes (dict[ProcessAxis, Int]) – A dictionary containing which axes contain the shots and which contain time series.

  • target_axes (Union[ProcessAxis, list[ProcessAxis]]) – Which axis or axes should the mean be done over?

Returns:

The processed results as an array and the axis map.