corrections#

Pulse and acquisition corrections for hardware compilation.

Module Contents#

Functions#

determine_relative_latency_corrections(→ Dict[str, float])

Generates the latency configuration dict for all port-clock combinations that are present in

distortion_correct_pulse(...)

Sample pulse and apply filter function to the sample to distortion correct it.

_is_distortion_correctable(→ bool)

Checks whether distortion corrections can be applied to the given operation.

apply_distortion_corrections(→ quantify_scheduler.Schedule)

Apply distortion corrections to operations in the schedule.

Attributes#

logger

logger[source]#
determine_relative_latency_corrections(hardware_cfg: Dict[str, Any]) Dict[str, float][source]#

Generates the latency configuration dict for all port-clock combinations that are present in the hardware_cfg. This is done by first setting unspecified latency corrections to zero, and then subtracting the minimum latency from all latency corrections.

distortion_correct_pulse(pulse_data: Dict[str, Any], sampling_rate: int, filter_func_name: str, input_var_name: str, kwargs_dict: Dict[str, Any], clipping_values: Tuple[float] | None = None) quantify_scheduler.operations.pulse_library.NumericalPulse[source]#

Sample pulse and apply filter function to the sample to distortion correct it.

Parameters:
  • pulse_data – Definition of the pulse.

  • sampling_rate – The sampling rate used to generate the time axis values.

  • filter_func_name – The filter function path of the dynamically loaded filter function. Example: "scipy.signal.lfilter".

  • input_var_name – The input variable name of the dynamically loaded filter function, most likely: "x".

  • kwargs_dict – Dictionary containing kwargs for the dynamically loaded filter function. Example: {"b": [0.0, 0.5, 1.0], "a": 1}.

  • clipping_values – Min and max value to which the corrected pulse will be clipped, depending on allowed output values for the instrument.

Returns:

The sampled, distortion corrected pulse wrapped in a NumericalPulse.

_is_distortion_correctable(operation: quantify_scheduler.operations.operation.Operation) bool[source]#

Checks whether distortion corrections can be applied to the given operation.

apply_distortion_corrections(schedule: quantify_scheduler.Schedule, hardware_cfg: Dict[str, Any]) quantify_scheduler.Schedule[source]#

Apply distortion corrections to operations in the schedule.

Defined via the hardware configuration file, example:

"distortion_corrections": {
    "q0:fl-cl0.baseband": {
        "filter_func": "scipy.signal.lfilter",
        "input_var_name": "x",
        "kwargs": {
            "b": [0.0, 0.5, 1.0],
            "a": [1]
        },
        "clipping_values": [-2.5, 2.5]
    }
}

Clipping values are the boundaries to which the corrected pulses will be clipped, upon exceeding, these are optional to supply.

For pulses in need of correcting (indicated by their port-clock combination) we are only replacing the dict in "pulse_info" associated to that specific pulse. This means that we can have a combination of corrected (i.e., pre-sampled) and uncorrected pulses in the same operation.

Note that we are not updating the "operation_id" key, used to reference the operation from schedulables.

Parameters:
  • schedule – The schedule that contains operations that are to be distortion corrected.

  • hardware_cfg – The hardware configuration of the setup.

Returns:

The schedule with distortion corrected operations.

Warns:

RuntimeWarning – If distortion correction can not be applied to the type of Operation in the schedule.

Raises:
  • KeyError – when elements are missing in distortion correction config for a port-clock combination.

  • KeyError – when clipping values are supplied but not two values exactly, min and max.