krotov.result module¶
Module defining the Result object that is returned by
optimize_pulses().
Reference¶
- 
class krotov.result.Result[source]¶
- Bases: - object- Result 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 - objectivesthe- guess_controlsand- optimized_controlsare used (as returned by- extract_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 to- guess_controls). These pulses are defined at midpoints of the tlist intervals. Empty list if- store_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_strand- end_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 the- optimized_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 as- guess_controlsand- optimized_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_controlsand- optimized_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 to- result.objectives_with_controls(result.optimized_controls).
 - 
classmethod load(filename, objectives=None, finalize=False)[source]¶
- Construct - Resultobject from a- dump()file- Parameters
- filename (str) – The file from which to load the - Result. Must be in the format created by- dump().
- objectives (None or list[Objective]) – If given, after loading - Resultfrom the given filename, overwrite- objectiveswith the given objectives. This is necessary because- dump()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 a- Resultthat was dumped before- optimize_pulses()finished, e.g. by- dump_result().
 
- Returns
- The - Resultinstance loaded from filename
- Return type
 
 
-