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: object

The main class running the MaxEnt optimization and \(\alpha\) loop

Parameters:
cost_functionCostFunction or str

the cost function, e.g. MaxEntCostFunction (the default) or BryanCostFunction. This is \(\alpha\) dependent and has to be minimized for each \(\alpha\). It can also be a string, i.e. ‘normal’ for MaxEntCostFunction, ‘plusminus’ for MaxEntCostFunction with PlusMinusEntropy, or ‘bryan’ for BryanCostFunction.

minimizerMinimizer

the minimizer, e.g. LevenbergMinimizer (the default). This actually minimizes the cost_function for 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’, the NormalLogProbability is 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()] if probability is not None

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)

Attributes:
A_of_H
D
G
H_of_v
K
S
chi2
data_variable
err
omega

Methods

check_consistency()

check whether all child objects are consistent

get_data_variable()

run([result, matrix_element, complex_index])

Run the MaxEnt loop

set_verbosity([verbosity, add, remove, ...])

Set the verbosity

get_A_of_H

get_D

get_G

get_H_of_v

get_K

get_S

get_chi2

get_err

get_omega

set_A_of_H

set_D

set_G

set_H_of_v

set_K

set_S

set_chi2

set_data_variable

set_err

set_omega

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 new MaxEntResult is generated.

matrix_elementtuple

the index of the matrix element that should be calculated. This is needed when a result is 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:
resultMaxEntResult

the result of the calculation

check_consistency()[source]

check whether all child objects are consistent

e.g., whether they all have the same omega values 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:
verbosityVerbosityFlags

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.

addVerbosityFlags

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.

removeVerbosityFlags

if not None, the verbosity flags given are removed from the verbosity flags already set. If also verbosity or add is 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)