Skip to content

Commit

Permalink
Merge branch 'master' into 1682-defgate-construction-fails-if-matrix-…
Browse files Browse the repository at this point in the history
…contains-expressions-but-not-parameters
  • Loading branch information
MarquessV authored Apr 10, 2024
2 parents 050efae + 2cabc84 commit e601852
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 4 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 4.9.0-rc.1 (2024-04-10)

### Features

#### Publish pyquil-grpc-web; A new package that supports making gRPC connections over HTTP/1.1. (#1763)

### Fixes

#### Program#out(calibrations=False) will not expand calibrations (#1758)

## 4.9.0-rc.0 (2024-04-09)

### Features
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pyquil"
version = "4.9.0-rc.0"
version = "4.9.0-rc.1"
description = "A Python library for creating Quantum Instruction Language (Quil) programs."
authors = ["Rigetti Computing <[email protected]>"]
readme = "README.md"
Expand Down
4 changes: 2 additions & 2 deletions pyquil/api/_wavefunction_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -230,4 +230,4 @@ def augment_program_with_memory_values(

p += quil_program

return percolate_declares(p)
return p
4 changes: 3 additions & 1 deletion pyquil/quil.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,9 @@ 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.filter_instructions(
lambda inst: not isinstance(inst, (DefCalibration, DefMeasureCalibration))
).out()

@deprecated(
version="4.0",
Expand Down
31 changes: 31 additions & 0 deletions test/unit/test_quil.py
Original file line number Diff line number Diff line change
Expand Up @@ -1163,3 +1163,34 @@ 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(
"""
DEFFRAME 0 1 "cphase":
DIRECTION: "tx"
INITIAL-FREQUENCY: 458935243.82547355
CENTER-FREQUENCY: 375000000.0
HARDWARE-OBJECT: "q0_ff"
SAMPLE-RATE: 1000000000.0
DEFWAVEFORM another1:
4,5
DECLARE ro BIT[1]
J 0
MEASURE 0 ro
DELAY 0
"""
)

combined_program = quilt_program + quil_program

assert combined_program.out(calibrations=False) == quil_program.out()

0 comments on commit e601852

Please sign in to comment.