XanaduAI / strawberryfields

Strawberry Fields is a full-stack Python library for designing, simulating, and optimizing continuous variable (CV) quantum optical circuits.
https://strawberryfields.ai
Apache License 2.0
737 stars 187 forks source link

Assert spec and layout target equality #687

Closed thisac closed 2 years ago

thisac commented 2 years ago

Context: Currently, there's no check against using different targets in the specification (Device.target, or Device._spec["target"]) and in the Blackbird layout (target field in Device.layout, or BlackbirdProgram.target). This shouldn't be an issue for the user unless the specification is incorrect, although it's safer to have a check for this at device creation directly.

Description of the Change:

Benefits:

Possible Drawbacks: None

Related GitHub Issues: None

codecov[bot] commented 2 years ago

Codecov Report

Merging #687 (8b6d019) into master (627b491) will increase coverage by 0.00%. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #687   +/-   ##
=======================================
  Coverage   98.69%   98.69%           
=======================================
  Files          75       75           
  Lines        9198     9209   +11     
=======================================
+ Hits         9078     9089   +11     
  Misses        120      120           
Impacted Files Coverage Δ
strawberryfields/device.py 97.18% <100.00%> (+0.40%) :arrow_up:
strawberryfields/program.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 627b491...8b6d019. Read the comment docs.