krotov.result module¶
Module defining the Result object that is returned by
optimize_pulses().
Reference¶
-
class
krotov.result.Result[source]¶ Bases:
objectResult of a Krotov optimization with
optimize_pulses().-
tlist¶ The time grid values
- Type
-
iter_seconds¶ for each iteration number, the number of seconds that were spent in the optimization
-
tau_vals¶ for each iteration, a list of complex overlaps between the target state and the forward-propagated state for each objective, assuming
Objective.targetcontains the target state. If there is no target state, an empty list.
-
guess_controls¶ List of the guess controls in array format
- Type
-
optimized_controls¶ List of the optimized control fields, in the order corresponding to
guess_controls- Type
-
controls_mapping¶ A nested list that indicates where in
objectivestheguess_controlsandoptimized_controlsare used (as returned byextract_controls_mapping())- Type
-
all_pulses¶ If the optimization was performed with
store_all_pulses=True, for each iteration, a list of the optimized pulses (in the order corresponding toguess_controls). These pulses are defined at midpoints of the tlist intervals. Empty list ifstore_all_pulses=False- Type
-
states¶ for each objective, a list of states for each value in tlist, obtained from propagation under the final optimized control fields.
- Type
-
start_local_time¶ Time stamp of when the optimization started
- Type
-
end_local_time¶ Time stamp of when the optimization ended
- Type
-
message¶ Description of why
optimize_pulses()completed, E.g, “Reached 1000 iterations”- Type
-
time_fmt= '%Y-%m-%d %H:%M:%S'¶ Format used in
start_local_time_strandend_local_time_str
-
property
start_local_time_str¶ The
start_local_timeattribute formatted as a string
-
property
end_local_time_str¶ The
end_local_timeattribute formatted as a string
-
property
optimized_objectives¶ A copy of the
objectiveswith theoptimized_controlsplugged in.
-
objectives_with_controls(controls)[source]¶ List of objectives with the given controls plugged in.
- Parameters
controls (list[numpy.ndarray]) – A list of control fields, defined on the points of
tlist. Must be of the same length asguess_controlsandoptimized_controls.- Returns
A copy of
objectives, where all control fields are replaced by the elements of the controls.- Return type
- Raises
ValueError – If controls does not have the same number controls as
guess_controlsandoptimized_controls, or if any controls are not defined on the points of the time grid.
See also
For plugging in the optimized controls, the
optimized_objectivesattribute is equivalent toresult.objectives_with_controls(result.optimized_controls).
-
classmethod
load(filename, objectives=None, finalize=False)[source]¶ Construct
Resultobject from adump()file- Parameters
filename (str) – The file from which to load the
Result. Must be in the format created bydump().objectives (None or list[Objective]) – If given, after loading
Resultfrom the given filename, overwriteobjectiveswith the given objectives. This is necessary becausedump()does not preserve time-dependent controls that are Python functions.finalize (bool) – If given as True, make sure that the
optimized_controlsare properly finalized. This allows to load aResultthat was dumped beforeoptimize_pulses()finished, e.g. bydump_result().
- Returns
The
Resultinstance loaded from filename- Return type
-