Skip to content

Progress meters¤

As the solve progresses, progress meters offer the ability to have some kind of output indicating how far along the solve has progressed. For example, to display a text output every now and again, or to fill a tqdm progress bar.

diffrax.AbstractProgressMeter

diffrax.AbstractProgressMeter ¤

Progress meters used to indicate how far along a solve is. Typically these perform some kind of printout as the solve progresses.

init(self) -> ~_State abstractmethod ¤

Initialises the state for a new progress meter.

Arguments:

Nothing.

Returns:

The initial state for the progress meter.

step(self, state: ~_State, progress: float) -> ~_State abstractmethod ¤

Updates the progress meter. Called on every numerical step of a differential equation solve.

Arguments:

  • state: the state from the previous step.
  • progress: how far along the solve is, as a number in [0, 1].

Returns:

The updated state. In addition, the meter is expected to update as a side-effect.

close(self, state: ~_State) abstractmethod ¤

Closes the progress meter. Called at the end of a differential equation solve.

Arguments:

  • state: the final state from the end of the solve.

Returns:*

None.

¤

¤
¤
¤

diffrax.NoProgressMeter (AbstractProgressMeter) ¤

Indicates that no progress meter should be displayed during the solve.

__init__(self) ¤

Arguments:

Nothing.

diffrax.TextProgressMeter (AbstractProgressMeter) ¤

A text progress meter, printing out e.g.:

0.00%
2.00%
5.30%
...
100.00%

__init__(self, minimum_increase: Union[float, int] = 0.02) ¤

Arguments:

  • minimum_increase: the minimum amount the progress has to have increased in order to print out a new line. The progress starts at 0 at the beginning of the solve, and increases to 1 at the end of the solve. Defaults to 0.02, so that a new line is printed each time the progress increases another 2%.

diffrax.TqdmProgressMeter (AbstractProgressMeter) ¤

Uses tqdm to display a progress bar for the solve.

__init__(self, refresh_steps: int = 20) ¤

Arguments:

  • refresh_steps: the number of numerical steps between refreshing the bar. Used to limit how frequently the (potentially computationally expensive) bar update is performed.