diff --git a/pyquil/api/_wavefunction_simulator.py b/pyquil/api/_wavefunction_simulator.py index abca2db2c..60197de75 100644 --- a/pyquil/api/_wavefunction_simulator.py +++ b/pyquil/api/_wavefunction_simulator.py @@ -26,7 +26,7 @@ ) from pyquil.gates import MOVE from pyquil.paulis import PauliSum, PauliTerm -from pyquil.quil import Program, percolate_declares +from pyquil.quil import Program from pyquil.quilatom import MemoryReference from pyquil.wavefunction import Wavefunction @@ -93,6 +93,7 @@ def wavefunction(self, quil_program: Program, memory_map: Optional[MemoryMap] = if memory_map is not None: quil_program = self.augment_program_with_memory_values(quil_program, memory_map) + print(quil_program.out(calibrations=False)) request = qvm.api.WavefunctionRequest( quil_program.out(calibrations=False), self.measurement_noise, @@ -230,4 +231,4 @@ def augment_program_with_memory_values( p += quil_program - return percolate_declares(p) + return p diff --git a/pyquil/quil.py b/pyquil/quil.py index 9daae5b7c..68bfed3e6 100644 --- a/pyquil/quil.py +++ b/pyquil/quil.py @@ -832,7 +832,7 @@ def out(self, *, calibrations: Optional[bool] = True) -> str: if calibrations: return self._program.to_quil() else: - return self._program.into_simplified().to_quil() + return self.remove_quil_t_instructions().out() @deprecated( version="4.0", diff --git a/test/unit/test_quil.py b/test/unit/test_quil.py index 9487c9809..b815ea102 100644 --- a/test/unit/test_quil.py +++ b/test/unit/test_quil.py @@ -1163,3 +1163,25 @@ def test_cached_frames(): p.inst(frames[1]) program_frames = p.frames assert program_frames == {frames[0].frame: frames[0], frames[1].frame: frames[1]} + + +def test_out_without_calibrations(): + quilt_program = Program( + """ +DEFCAL J 0: + RX(1.5707963267948966) 0 +DEFCAL MEASURE 0 addr: + FENCE 0 +""" + ) + quil_program = Program( + """ +DECLARE ro BIT[1] +J 0 +MEASURE 0 ro +""" + ) + + combined_program = quilt_program + quil_program + + assert combined_program.out(calibrations=False) == quil_program.out()