diff --git a/docs/source/conf.py b/docs/source/conf.py index 373a0999c..24f3ade7b 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -20,7 +20,7 @@ "Daria Van Hende , " "Luke Causer " ) -release = version = "2.2.0" +release = version = "2.2.1" add_module_names = False autoclass_content = "both" smv_remote_whitelist = None diff --git a/pyproject.toml b/pyproject.toml index 4bb746269..8d8f0ee71 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "qat-compiler" # This name has the -compiler suffix in order to use the poetry and twine tools to build and publish to PyPI # witout having to manually adjust the dist file names. -version = "2.2.0" +version = "2.2.1" description = "A low-level quantum compiler and runtime which facilitates executing quantum IRs." readme = "README.rst" documentation = "https://oqc-community.github.io/qat" diff --git a/src/qat/purr/compiler/instructions.py b/src/qat/purr/compiler/instructions.py index afc677ee2..bbefb4e80 100644 --- a/src/qat/purr/compiler/instructions.py +++ b/src/qat/purr/compiler/instructions.py @@ -400,7 +400,7 @@ class PostProcessing(QuantumInstruction): """ def __init__(self, acquire: Acquire, process, axes=None, args=None): - super().__init__() + super().__init__(acquire) if axes is not None and not isinstance(axes, List): axes = [axes] @@ -412,11 +412,10 @@ def __init__(self, acquire: Acquire, process, axes=None, args=None): self.axes: List[ProcessAxis] = axes or [] self.output_variable = acquire.output_variable self.result_needed = False - self._acquire = acquire @property def acquire(self) -> Acquire: - return self._acquire + return self.quantum_targets[0] def __repr__(self): axis = ",".join([axi.value for axi in self.axes]) diff --git a/tests/qat/test_quantum_backend.py b/tests/qat/test_quantum_backend.py index 6472b1146..70e284f4b 100644 --- a/tests/qat/test_quantum_backend.py +++ b/tests/qat/test_quantum_backend.py @@ -30,9 +30,13 @@ from qat.purr.compiler.emitter import InstructionEmitter, QatFile from qat.purr.compiler.hardware_models import QuantumHardwareModel from qat.purr.compiler.instructions import ( + Acquire, Delay, + DrivePulse, + MeasurePulse, PhaseReset, PhaseShift, + PostProcessing, SweepValue, Variable, ) @@ -677,3 +681,37 @@ def test_empty_channels_removed(self): for p in positions ] ) + + def test_create_duration_timeline_mapping(self): + """Test that instructions are correctly mapped to expected channels.""" + hw = get_test_model() + qubit = hw.get_qubit(0) + + builder = ( + get_builder(hw).X(qubit, np.pi / 2.0).measure_mean_z(qubit).synchronize(qubit) + ) + engine = get_test_execution_engine(hw) + qat_file = InstructionEmitter().emit(builder.instructions, hw) + + position_map = engine.create_duration_timeline(qat_file.instructions) + + drive_data = position_map[qubit.get_drive_channel()] + measure_data = position_map[qubit.get_measure_channel()] + acquire_data = position_map[qubit.get_acquire_channel()] + + assert [type(pos.instruction) for pos in drive_data] == [ + DrivePulse, + Delay, + PhaseReset, + ] + assert [type(pos.instruction) for pos in measure_data] == [ + Delay, + MeasurePulse, + PhaseReset, + ] + assert [type(pos.instruction) for pos in acquire_data] == [ + Delay, + Acquire, + PhaseReset, + *[PostProcessing] * 4, + ]