MaxEntLoop
- class triqs_maxent.maxent_loop.MaxEntLoop(cost_function=None, minimizer=None, alpha_mesh=None, probability=None, analyzers=None, logtaker=None, G_threshold=1e-10, reduce_singular_space=1e-14, A_init=None, interactive=True, scale_alpha='Ndata')[source]
Bases:
objectThe main class running the MaxEnt optimization and \(\alpha\) loop
- Parameters:
- cost_functionCostFunction or str
the cost function, e.g.
MaxEntCostFunction(the default) orBryanCostFunction. This is \(\alpha\) dependent and has to be minimized for each \(\alpha\). It can also be a string, i.e. ‘normal’ for MaxEntCostFunction, ‘plusminus’ forMaxEntCostFunctionwithPlusMinusEntropy, or ‘bryan’ forBryanCostFunction.- minimizerMinimizer
the minimizer, e.g.
LevenbergMinimizer(the default). This actually minimizes thecost_functionfor a particular \(\alpha\).- alpha_meshAlphaMesh
the array of \(\alpha\) values that should be calculated. The convention is to start with the largest \(\alpha\) value. The default is a
LogAlphaMesh.- probabilityProbability or str
the function, e.g.
NormalLogProbability, that allows to calculate the \(\log\) of the probability of a particular \(\alpha\). If ‘normal’, theNormalLogProbabilityis used. Default:None- analyzerslist of Analyzer
the list of analyzers that are used to choose the one true spectral functions from \(A_\alpha(\omega)\). Default:
[LineFitAnalyzer(), Chi2CurvatureAnalyzer(), EntropyAnalyzer()]and additionally[BryanAnalyzer(), ClassicAnalyzer()]ifprobabilityis notNone- logtakerLogtaker
for processing the log
- G_thresholdfloat
if all values of the data Green function have an absolute value below that threshold, the calculation is not performed
- reduce_singular_spacefloat
a threshold for reducing the singular space, see
KernelSVD.reduce_singular_space().- A_initarray
the initial spectral function (i.e., the starting value of the optimization for the first \(\alpha\) value) (if it is
None, the default model is used)- interactivebool
whether or not to pressing Ctrl+C during the run should show a menu to decide what to do instead of immediately exiting (default: True)
- scale_alphafloat or str
scale all alpha values by this factor; if
'Ndata', it is scaled by the number of data points (the default)
- run(result=None, matrix_element=None, complex_index=None)[source]
Run the MaxEnt loop
- Parameters:
- resultMaxEntResult
the object where the result should be saved in; especially useful for elementwise calculations, where the results from different matrix elements should be written into only one result object. If
None, a newMaxEntResultis generated.- matrix_elementtuple
the index of the matrix element that should be calculated. This is needed when a
resultis given in an elementwise calculation, so that the result can be written for the correct matrix element- complex_indexint
the index of the complex number, either 0 (real) or 1 (imaginary); this is needed for complex elementwise calculations
- Returns:
- result
MaxEntResult the result of the calculation
- result
- check_consistency()[source]
check whether all child objects are consistent
e.g., whether they all have the same
omegavalues etc.Raises an error if not.
This is automatically done before
running.
- set_verbosity(verbosity=None, add=None, remove=None, change_callback=True)[source]
Set the verbosity
- Parameters:
- verbosity
VerbosityFlags if not None, the verbosity is set to this value; e.g.:
VerbosityFlags.Header | VerbosityFlags.Timing
to show just the header and the timing information.
- add
VerbosityFlags if not None, the verbosity flags given are added to the verbosity flags already set. If also verbosity is not None, this is performed after setting
verbosity.- remove
VerbosityFlags if not None, the verbosity flags given are removed from the verbosity flags already set. If also
verbosityoraddis not None, this is performed after the other two.- change_callbackbool
whether to turn on/off the callback in the minimizer as needed according to the verbosity flags given (the minimizer is faster if it does not have to produce verbose info)
- verbosity