qutip_qtrl.dump

Classes that enable the storing of historical objects created during the pulse optimisation. These are intented for debugging. See the optimizer and dynamics objects for instrutcions on how to enable data dumping.

Classes

Dump()

A container for dump items.

DumpItem()

An item in a dump list

DumpSummaryItem()

A summary of the most recent iteration.

DynamicsDump(dynamics[, level])

A container for dumps of dynamics data.

EvoCompDumpItem(dump)

A copy of all objects generated to calculate one time evolution.

OptimDump(optim[, level])

A container for dumps of optimisation data generated during the pulse optimisation.

class qutip_qtrl.dump.Dump[source]

A container for dump items. The lists for dump items is depends on the type Note: abstract class

Attributes:
parentsome control object (Dynamics or Optimizer)

aka the host. Object that generates the data that is dumped and is host to this dump object.

dump_dirstr

directory where files (if any) will be written out the path and be relative or absolute use ~/ to specify user home directory Note: files are only written when write_to_file is True of writeout is called explicitly Defaults to ~/.qtrl_dump

levelstring

The level of data dumping that will occur.

write_to_filebool

When set True data and summaries (as configured) will be written interactively to file during the processing Set during instantiation by the host based on its dump_to_file attrib

dump_file_extstr

Default file extension for any file names that are auto generated

fname_basestr

First part of any auto generated file names. This is usually overridden in the subclass

dump_summarybool

If True a summary is recorded each time a new item is added to the the dump. Default is True

summary_sepstr

delimiter for the summary file. default is a space

data_sepstr

delimiter for the data files (arrays saved to file). default is a space

summary_filestr

File path for summary file. Automatically generated. Can be set specifically

create_dump_dir()[source]

Checks dump directory exists, creates it if not

property level

The level of data dumping that will occur.

SUMMARY

A summary will be recorded

FULL

All possible dumping

CUSTOM

Some customised level of dumping

When first set to CUSTOM this is equivalent to SUMMARY. It is then up to the user to specify what specifically is dumped

class qutip_qtrl.dump.DumpItem[source]

An item in a dump list

class qutip_qtrl.dump.DumpSummaryItem[source]

A summary of the most recent iteration. Abstract class only.

Attributes:
idxint

Index in the summary list in which this is stored

class qutip_qtrl.dump.DynamicsDump(dynamics, level='SUMMARY')[source]

A container for dumps of dynamics data. Mainly time evolution calculations.

Attributes:
dump_summarybool

If True a summary is recorded

evo_summarylist of tslotcomp.EvoCompSummary

Summary items are appended if dump_summary is True at each recomputation of the evolution.

dump_ampsbool

If True control amplitudes are dumped

dump_dyn_genbool

If True the dynamics generators (Hamiltonians) are dumped

dump_propbool

If True propagators are dumped

dump_prop_gradbool

If True propagator gradients are dumped

dump_fwd_evobool

If True forward evolution operators are dumped

dump_onwd_evobool

If True onward evolution operators are dumped

dump_onto_evobool

If True onto (or backward) evolution operators are dumped

evo_dumpslist of EvoCompDumpItem

A new dump item is appended at each recomputation of the evolution. That is if any of the calculation objects are to be dumped.

add_evo_comp_summary(dump_item_idx=None)[source]

add copy of current evo comp summary

add_evo_dump()[source]

Add dump of current time evolution generating objects

property dump_all

True if all of the calculation objects are to be dumped

property dump_any

True if any of the calculation objects are to be dumped

writeout(f=None)[source]

Write all the dump items and the summary out to file(s).

Parameters:
ffilename or filehandle

If specified then all summary and object data will go in one file. If None is specified then type specific files will be generated in the dump_dir. If a filehandle is specified then it must be a byte mode file as numpy.savetxt is used, and requires this.

class qutip_qtrl.dump.EvoCompDumpItem(dump)[source]

A copy of all objects generated to calculate one time evolution. Note the attributes are only set if the corresponding DynamicsDump dump_* attribute is set.

writeout(f=None)[source]

write all the objects out to files

Parameters:
ffilename or filehandle

If specified then all object data will go in one file. If None is specified then type specific files will be generated in the dump_dir If a filehandle is specified then it must be a byte mode file as numpy.savetxt is used, and requires this.

class qutip_qtrl.dump.OptimDump(optim, level='SUMMARY')[source]

A container for dumps of optimisation data generated during the pulse optimisation.

Attributes:
dump_summarybool

When True summary items are appended to the iter_summary

iter_summarylist of qutip.control.optimizer.OptimIterSummary

Summary at each iteration

dump_fid_errbool

When True values are appended to the fid_err_log

fid_err_loglist of float

Fidelity error at each call of the fid_err_func

dump_grad_normbool

When True values are appended to the fid_err_log

grad_norm_loglist of float

Gradient norm at each call of the grad_norm_log

dump_gradbool

When True values are appended to the grad_log

grad_loglist of ndarray

Gradients at each call of the fid_grad_func

add_iter_summary()[source]

add copy of current optimizer iteration summary

property dump_all

True if everything (ignoring the summary) is to be dumped

property dump_any

True if anything other than the summary is to be dumped

update_fid_err_log(fid_err)[source]

add an entry to the fid_err log

update_grad_log(grad)[source]

add an entry to the grad log

update_grad_norm_log(grad_norm)[source]

add an entry to the grad_norm log

writeout(f=None)[source]

write all the logs and the summary out to file(s)

Parameters:
ffilename or filehandle

If specified then all summary and object data will go in one file. If None is specified then type specific files will be generated in the dump_dir If a filehandle is specified then it must be a byte mode file as numpy.savetxt is used, and requires this.