qucontrol / krotov

Python implementation of Krotov's method for quantum optimal control
https://qucontrol.github.io/krotov
Other
70 stars 29 forks source link

Add support for parametrized pulses #92

Open goerz opened 3 years ago

goerz commented 3 years ago

This adds support for parametrized pulses by attaching an optional 'parametrization' attribute to control-functions and pulse arrays. The parametrization object stored in that attribute contains information for converting ϵ⟷u and calculating the derivative ∂ϵ/∂u. These are automatically taking into account when calculating the pulse updates (μ = (∂Ĥ/∂ϵ)⋅(∂ϵ/∂u) for an Ĥ that is linear in ϵ).

Thus, all internal storage is for the physical pulse values ϵ(t), and any conversion to u(t) is done on the fly as necessary. This ensures that everything stays 100% compatible with QuTiP, but adds a small overhead from the ϵ⟷u conversions compared to the "hacky" solution discussed in https://github.com/qucontrol/krotov/issues/23#issuecomment-850887732. The latter could still be used by an advanced user when performance is more critical than clarity.

Closes #23

review-notebook-app[bot] commented 3 years ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

codecov[bot] commented 3 years ago

Codecov Report

Merging #92 (809d94e) into master (cfe6b10) will decrease coverage by 2.8%. The diff coverage is 45.4%.

@@           Coverage Diff            @@
##           master     #92     +/-   ##
========================================
- Coverage    96.1%   93.2%   -2.9%     
========================================
  Files          13      14      +1     
  Lines        1676    1765     +89     
========================================
+ Hits         1611    1646     +35     
- Misses         65     119     +54     
Impacted Files Coverage Δ
src/krotov/__init__.py 100.0% <ø> (ø)
src/krotov/mu.py 90.0% <33.3%> (-10.0%) :arrow_down:
src/krotov/parametrization.py 36.1% <36.1%> (ø)
src/krotov/conversions.py 95.6% <75.0%> (-2.5%) :arrow_down:
src/krotov/optimize.py 96.7% <75.0%> (-1.0%) :arrow_down:

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 cfe6b10...809d94e. Read the comment docs.