pulse_compensation ================== .. py:module:: quantify_scheduler.pulse_compensation .. autoapi-nested-parse:: Compiler for the quantify_scheduler. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: quantify_scheduler.pulse_compensation.SumEnd quantify_scheduler.pulse_compensation.CompensationPulseParams Functions ~~~~~~~~~ .. autoapisummary:: quantify_scheduler.pulse_compensation._merge_sum_and_end quantify_scheduler.pulse_compensation._determine_sum_and_end_of_all_pulses quantify_scheduler.pulse_compensation._determine_compensation_pulse quantify_scheduler.pulse_compensation.process_compensation_pulses .. py:class:: SumEnd Class to store the sum and end as floats. .. py:attribute:: sum :type: float :value: 0.0 .. py:attribute:: end :type: float :value: 0.0 .. py:method:: merge(other: SumEnd) -> SumEnd Merge two `SumEnd` objects together: `sum` are added, `end` are maxed. .. py:function:: _merge_sum_and_end(pulses_sum_end_1: dict[quantify_scheduler.operations.pulse_compensation_library.Port, SumEnd], pulses_sum_end_2: dict[quantify_scheduler.operations.pulse_compensation_library.Port, SumEnd]) -> dict[quantify_scheduler.operations.pulse_compensation_library.Port, SumEnd] .. py:function:: _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.Port, SumEnd] 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. :param operation: The schedule or operation to calculate sum and end of pulses. :param sampling_rate: Sampling rate of the pulses. :param 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`. .. py:class:: CompensationPulseParams Class to store start, duration and amp in floats. .. py:attribute:: start :type: float .. py:attribute:: duration :type: float .. py:attribute:: amp :type: float .. py:function:: _determine_compensation_pulse(operation: quantify_scheduler.schedules.schedule.Schedule | quantify_scheduler.operations.operation.Operation, max_compensation_amp: dict[quantify_scheduler.operations.pulse_compensation_library.Port, float], time_grid: float, sampling_rate: float) -> dict[quantify_scheduler.operations.pulse_compensation_library.Port, CompensationPulseParams] Calculates the timing and the amplitude of a compensation pulse for each port. 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. The clock is assumed to be the baseband clock. :param operation: The original operation or schedule to compensate for. :param max_compensation_amp: The maximum amplitude of the compensation pulse. :param time_grid: Time grid the compensation pulse needs to be on. :param 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. .. py:function:: process_compensation_pulses(schedule: quantify_scheduler.schedules.schedule.Schedule, config: quantify_scheduler.backends.graph_compilation.CompilationConfig | None = None) -> quantify_scheduler.schedules.schedule.Schedule 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. :param schedule: The schedule which contains potential ``PulseCompensation`` in it. :param config: Compilation config for :class:`~quantify_scheduler.backends.graph_compilation.QuantifyCompiler`. :returns: The start, duration and amp of a compensation pulse with the given requirements as a `CompensationPulseParams` for each port.