q-optimize / c3

Toolset for control, calibration and characterization of physical systems
https://c3-toolset.readthedocs.io/
Apache License 2.0
66 stars 36 forks source link

Fix silent OOB params post-optimization failure #236

Closed YonatanGideoni closed 2 years ago

YonatanGideoni commented 2 years ago

What

Makes it be so an error is raised if an optimizer gives OOB parameters instead of it failing silently.

Why

Makes optimizers raise an error if they give OOB results. Closes #235

How

Made an error be raised and made the errors along the way be more explicit.

Remarks

Should not break anything and be totally backwards compatible but if something does break it means it was GIGO (garbage in->garbage out) in the first place.

Checklist

Please include and complete the following checklist. Your Pull Request is (in most cases) not ready for review until the following have been completed. You can create a draft PR while you are still completing the checklist. Check the Contribution Guidelines for more details. You can mark an item as complete with the - [x] prefix

codecov[bot] commented 2 years ago

Codecov Report

Merging #236 (e7141e0) into dev (01cd657) will increase coverage by 0.20%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##              dev     #236      +/-   ##
==========================================
+ Coverage   74.82%   75.03%   +0.20%     
==========================================
  Files          38       38              
  Lines        5534     5560      +26     
==========================================
+ Hits         4141     4172      +31     
+ Misses       1393     1388       -5     
Impacted Files Coverage Δ
c3/c3objs.py 88.83% <100.00%> (+0.60%) :arrow_up:
c3/optimizers/optimalcontrol.py 70.65% <100.00%> (+3.21%) :arrow_up:
c3/optimizers/optimizer.py 80.08% <100.00%> (ø)
c3/parametermap.py 95.14% <100.00%> (+1.67%) :arrow_up:
c3/signal/gates.py 94.89% <0.00%> (-0.13%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

YonatanGideoni commented 2 years ago

Changed default extend_bounds value where it's used. This required slight modifications of some tests that relied on this behaviour.

YonatanGideoni commented 2 years ago

@lazyoracle I believe I addressed the requested changes