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
751 stars 187 forks source link

Combine assert modes #709

Closed thisac closed 2 years ago

thisac commented 2 years ago

Context: There are two methods that check that a various number of mode parameters are within the allowed limit specified in the device specification. These can easily, and should, be combined into a single method.

Description of the Change: Program.assert_number_of_modes and program.assert_max_number_of_measurements are combined into a single assert_modes method.

Benefits: The logic is simplified.

Possible Drawbacks: None

Related GitHub Issues: None

codecov[bot] commented 2 years ago

Codecov Report

Merging #709 (6c595a7) into master (5db4fa4) will decrease coverage by 0.00%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #709      +/-   ##
==========================================
- Coverage   98.72%   98.72%   -0.01%     
==========================================
  Files          75       75              
  Lines        9225     9224       -1     
==========================================
- Hits         9107     9106       -1     
  Misses        118      118              
Impacted Files Coverage Δ
strawberryfields/program.py 100.00% <100.00%> (ø)
strawberryfields/tdm/tdmprogram.py 99.19% <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 5db4fa4...6c595a7. Read the comment docs.

thisac commented 2 years ago

@josh146 Could you override codecov. All code is covered, but there's less code to cover (so the overall coverage has gone down).