qat.backend.passes.analysis module

class IntermediateFrequencyAnalysis(model)

Bases: AnalysisPass

Adapted from qat.purr.backends.live.LiveDeviceEngine.build_baseband_frequencies().

Retrieves intermediate frequencies for all physical channels if they exist, and validates that pulse channels that share the same physical channel cannot have differing fixed frequencies. This pass should always follow a PartitionByPulseChannel, as information of pulse channels are needed.

Instantiate the pass with a hardware model.

Parameters:

model (PhysicalHardwareModel) – The hardware model.

run(ir, res_mgr, *args, **kwargs)
Parameters:
  • ir (PartitionedIR) – The list of instructions stored in an InstructionBuilder.

  • res_mgr (ResultManager) – The result manager to store the analysis results.

Return type:

PartitionedIR

class IntermediateFrequencyResult(frequencies)

Bases: ResultInfoMixin

frequencies: Dict[PhysicalChannel, float]
class PulseChannelTimeline(samples=<factory>, start_positions=<factory>, end_positions=<factory>)

Bases: object

Timeline analysis for instructions on a pulse channel.

Imagine the timeline for a pulse channel, with an instruction that occurs over samples 3-7, i.e.,

samples: 0 1 2 [3 4 5 6 7] 8 9 10.

The start_position would be 3, the end_position 7, and the number of samples 5.

Parameters:
  • samples (np.ndarray[int]) – The number of samples each instruction takes.

  • start_positions (np.ndarray[int]) – The sample when the instruction begins.

  • end_positions (np.ndarray[int]) – The sample when the instruction ends.

end_positions: ndarray[int]
samples: ndarray[int]
start_positions: ndarray[int]
PydIntermediateFrequencyAnalysis

alias of IntermediateFrequencyAnalysis

PydIntermediateFrequencyResult

alias of IntermediateFrequencyResult

PydTimelineAnalysis

alias of TimelineAnalysis

PydTimelineAnalysisResult

alias of TimelineAnalysisResult

class TimelineAnalysis(model, target_data)

Bases: AnalysisPass

Analyses the timeline of each pulse channel.

Takes the instruction list for each pulse channel retrieved from the the partitioned results, and calculates the timeline in units of samples (each sample takes time sample_time). It calculates the duration of each instruction in units of samples, and the start and end times of each instruction in units of samples.

Warning

The pass will assume that the durations of instructions are sanitised to the granularity of the channels. If instructions that do not meet the criteria are provided, it might produce incorrect timelines. This can be enforced used the InstructionGranularitySanitisation pass.

Parameters:
  • model (PhysicalHardwareModel) – The hardware model that holds calibrated information on the qubits on the QPU.

  • target_data (TargetData) – Target-related information.

durations_as_samples(pulse_ch_id, durations)

Converts a list of durations into a number of samples.

run(ir, res_mgr, *args, **kwargs)
Parameters:
  • ir (PartitionedIR) – The list of instructions stored in an InstructionBuilder.

  • res_mgr (ResultManager) – The result manager to store the analysis results.

Return type:

PartitionedIR

class TimelineAnalysisResult(target_map=<factory>, total_duration=0.0)

Bases: ResultInfoMixin

Stores the timeline analysis for all pulse channels.

Parameters:

target_map (dict[str, PulseChannelTimeline]) – The dictionary containing the timeline analysis for all pulse channels.

target_map: dict[str, PulseChannelTimeline]
total_duration: float = 0.0