Logtaker
- class triqs_maxent.logtaker.Logtaker[source]
Bases:
object
Handling logging and error messages.
This class allows to log all the information that is written to the screen to a file as well.
Methods
clear the list of all error messages raised
close the log file
error_message
(msg, *args, **kwargs)report error and keep track of the error message
get a list of all error messages raised
log_time
([message_verbosity])print the current time
logged_message
(msg, *args, **kwargs)print a message and write it to the log file
message
(message_verbosity, msg, *args, **kwargs)print a message and write it to the log file
open_logfile
(name[, append])open the log file
welcome_message
([always, message_verbosity])print a welcome message
solver_verbose_callback
verbosity_message
- error_message(msg, *args, **kwargs)[source]
report error and keep track of the error message
- Parameters:
- msgstr
the error message
- logged_message(msg, *args, **kwargs)[source]
print a message and write it to the log file
Warning
The use of
logged_message
is deprecated. Usemessage
instead.- Parameters:
- msgstr
the message
- message(message_verbosity, msg, *args, **kwargs)[source]
print a message and write it to the log file
- Parameters:
- message_verbosity
VerbosityFlags
verbosity flags that must be set in order to write that message (can be one flag or a
|
combination)- msgstr
the message; it can contain {} that are formatted with
format
using theargs
andkwargs
- message_verbosity
- class triqs_maxent.logtaker.VerbosityFlags[source]
Setting verbosity
This describes different verbosity levels for controlling how much output is generated.
Note that the actual integer values are considered implementation details and might not be conserved across versions.
VerbosityFlags can be combined using
|
, e.g. in order to write out header and timing information, use:self.verbose = VerbosityFlags.Header | VerbosityFlags.Timing
Additional VerbosityFlags can be set with
|=
:self.verbose |= VerbosityFlags.AlphaLoop
and unset with
&= ~
:self.verbose &= ~VerbosityFlags.AlphaLoop
Testing for a particular flag can be done with
&
.Use this in the
Logtaker
or in theMaxEntLoop.set_verbosity()
method.The following shows a typical output of the code and together with the VerbosityFlags for the individual lines:
ElementInfo Calculating diagonal elements. Calling MaxEnt for element 0 0 Header 2018-11-22 16:51:11.012704 MaxEnt run TRIQS application maxent ... scaling alpha by a factor 201 (number of data points) AlphaLoop alpha[0] = 1.00500000e+05, chi2 = 6.90348835e+04, n_iter= 9 SolverDetails 6 Q: 7.031977e+06, max_f: 1.494887e-05, conv: 5.297643e-16 AlphaLoop alpha[1] = 2.69610927e+04, chi2 = 2.69219648e+04, n_iter= 7 ... Timing MaxEnt loop finished in 0:00:00.548325
- Quiet = 0
- Header = 1
- ElementInfo = 2
- Timing = 4
- AlphaLoop = 8
- SolverDetails = 16
- Errors = 32
- Default = 47