progress#

This is a small submodule which contains code to make printing progress reports and feedback pretty.

To report on the state of the solver, the ProgressTracker type is used, which contains state about where the solver stated, when it should stop and what is the current state. It also has methods that allow it to have pretty terminal output.

class mfv2d.progress.ProgressTracker(err_tol: float, err_initial: float, err_cur: float, iter_max: int, iter_cur: int = 0, iter_width: int = 10, err_width: int = 10)[source]#

Type for progress tracking.

err_cur: float#
property err_indicator: str#

Return error indicator string.

err_initial: float#
err_tol: float#
err_width: int = 10#
iter_cur: int = 0#
iter_max: int#
property iter_progress: str#

Return iteration progress string.

iter_width: int = 10#
state_str(format_string: str) str[source]#

Get a string with current state.

Parameters:

format_string (str) – String that will be formatted with str.format() method. It will receive the spinner character, the iteration progress bar and error indicator bar in that order.

Returns:

Formatted string.

Return type:

str

update_iteration(new_err: float) None[source]#

Update with the new iteration error.

For reporting on error distribution and distribution of element orders, the type HistogramFormat is used. It can behave oddly for very low number of elements.

class mfv2d.progress.HistogramFormat(rows: int, cols: int, tick_count: int = 2, label_format: ~collections.abc.Callable[[float], str] = <class 'str'>)[source]#

Type used to format a histogram from an array.

__call__(a: array_like) str[source]#

Call self.format(a).

cols: int#
format(a: array_like) str[source]#

Create a histogram string based on the array.

label_format#

alias of str

rows: int#
tick_count: int = 2#