Is there a modify_params_after_update? #91
-
Currently, there's a modify_params_after_iter option which allows injection of arbitrary code after each iteration of Krotov. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
There is not, but you can "inject code" for most use cases due to the fact that the The two specific use cases that I've come across are:
Both of these are very straightforward to do inside a custom You could conceivably extend the scope of what def make_propagator(objectives):
def propagator(H, state, dt, c_ops=None, backwards=False, initialize=False):
pass
# do the propagation, and something involving objectives
return propagator
# optimize_pulses(objectives,..., propagator=make_propagator(objectives), ...) For anything beyond that, you can always create your own copy of the |
Beta Was this translation helpful? Give feedback.
There is not, but you can "inject code" for most use cases due to the fact that the
propagate
routine that you pass tooptimize_pulses
is under your control. Specifically, you have direct read/write access to both the propagated state and the Hamiltonian/Liouvillian.The two specific use cases that I've come across are:
Both of these are very straightforward to do inside a custom
propagate
routine.You could conceivably extend the scope of what
propagate
has access to with some Python trickery (closures), e.g. to give it access to the …