pulse_compensation#

Compiler for the quantify_scheduler.

Module Contents#

Classes#

SumEnd

Class to store the sum and end as floats.

CompensationPulseParams

Class to store start, duration and amp in floats.

Functions#

_merge_sum_and_end(...)

_determine_sum_and_end_of_all_pulses(...)

Calculates the sum (or integral) of the amplitudes of all pulses in the operation,

_determine_compensation_pulse(...)

Calculates the timing and the amplitude of a compensation pulse for each port clock.

process_compensation_pulses(…)

Replaces PulseCompensation with a subschedule with an additional compensation pulse.

class SumEnd[source]#

Class to store the sum and end as floats.

sum: float = 0.0[source]#
end: float = 0.0[source]#
merge(other: SumEnd) SumEnd[source]#

Merge two SumEnd objects together: sum are added, end are maxed.

_merge_sum_and_end(pulses_sum_end_1: dict[quantify_scheduler.operations.pulse_compensation_library.PortClock, SumEnd], pulses_sum_end_2: dict[quantify_scheduler.operations.pulse_compensation_library.PortClock, SumEnd]) dict[quantify_scheduler.operations.pulse_compensation_library.PortClock, SumEnd][source]#
_determine_sum_and_end_of_all_pulses(operation: quantify_scheduler.schedules.schedule.Schedule | quantify_scheduler.operations.operation.Operation, sampling_rate: float, time_offset: float) dict[quantify_scheduler.operations.pulse_compensation_library.PortClock, SumEnd][source]#

Calculates the sum (or integral) of the amplitudes of all pulses in the operation, and the end time of the last pulse in the operation. The function assumes there is no operation which need to be pulse compensated inside. The function also assumes that the absolute timings are already calculated in the schedule.

Parameters:
  • operation – The schedule or operation to calculate sum and end of pulses.

  • sampling_rate – Sampling rate of the pulses.

  • time_offset – Time offset for the operation with regards to the start of the whole schedule.

Returns:

The sum and end time of all the pulses as a SumEnd.

class CompensationPulseParams[source]#

Class to store start, duration and amp in floats.

start: float[source]#
duration: float[source]#
amp: float[source]#
_determine_compensation_pulse(operation: quantify_scheduler.schedules.schedule.Schedule | quantify_scheduler.operations.operation.Operation, max_compensation_amp: dict[quantify_scheduler.operations.pulse_compensation_library.PortClock, float], time_grid: float, sampling_rate: float) dict[quantify_scheduler.operations.pulse_compensation_library.PortClock, CompensationPulseParams][source]#

Calculates the timing and the amplitude of a compensation pulse for each port clock. The duration and amp are calculated, with the requirements, that if a compensation square pulse is inserted in the schedule at start with duration duration, and amplitude amp, then * the integral of all pulses in the operation would equal to 0, * the duration of the compensation pulse is divisible by time_grid, * the compensation pulse is the last pulse in the operation, and * the compensation pulse starts just after the previous pulse. The function assumes there is no operation which needs to be pulse compensated inside.

Parameters:
  • operation – The original operation or schedule to compensate for.

  • max_compensation_amp – The maximum amplitude of the compensation pulse.

  • time_grid – Time grid the compensation pulse needs to be on.

  • sampling_rate – Sampling rate of the pulses.

Returns:

The start, duration and amp of a compensation pulse with the given requirements as a CompensationPulseParams for each port clock.

process_compensation_pulses(schedule: quantify_scheduler.schedules.schedule.Schedule, config: quantify_scheduler.backends.graph_compilation.CompilationConfig | None = None) quantify_scheduler.schedules.schedule.Schedule[source]#
process_compensation_pulses(schedule: quantify_scheduler.operations.operation.Operation, config: quantify_scheduler.backends.graph_compilation.CompilationConfig | None = None) quantify_scheduler.schedules.schedule.Schedule | quantify_scheduler.operations.operation.Operation

Replaces PulseCompensation with a subschedule with an additional compensation pulse.

Parameters:
  • schedule – The schedule which contains potential PulseCompensation in it.

  • config – Compilation config for QuantifyCompiler.

Returns:

The start, duration and amp of a compensation pulse with the given requirements as a CompensationPulseParams for each port clock.