ProgressBar

class mdtools.run_time_info.ProgressBar(*_, **__)[source]

Display a visual progress bar and time estimate.

The ProgressBar decorates an iterable object, returning an iterator which acts exactly like the original iterable, but prints a dynamically updating progress bar every time a value is requested.

See also

MDAnalysis.lib.log.ProgressBar

Parent class

tqdm.auto.tqdm

Grandparent class

Notes

This class is derived from MDAnalysis.lib.log.ProgressBar, which in turn is derived from tqdm.auto.tqdm. The only difference to tqdm.auto.tqdm is that some default arguments are changed:

  • ascii is set to True.

  • unit is set to 'frames'.

  • unit_scale is set to True.

  • The bar_format is changed to switch off a possible inversion of ‘unit/s’ to ‘s/unit’ (see also https://github.com/tqdm/tqdm/issues/72).

  • mininterval is set to 300 seconds.

  • maxinterval is set to 3600 seconds.

See the MDAnalysis and tqdm documentations for further information.

Example

for ts in mdt.rti.ProgressBar(u.trajectory):
    # Perform analysis

will produce something similar to:

25%|#####1           | 25/100 [00:15<00:45,  1.67frames/s]

Initialize the ProgressBar.

Parameters:

Methods

as_completed

Wrapper for asyncio.as_completed.

clear

Clear current bar display.

close

Cleanup and (if leave=False) close the progressbar.

display

Use self.sp to display msg in the specified pos.

external_write_mode

Disable tqdm within context and refresh tqdm when exits.

format_interval

Formats a number of seconds as a clock time, [H:]MM:SS

format_meter

Return a string-based progress bar given some parameters

format_num

Intelligent scientific notation (.3g).

format_sizeof

Formats a number (greater than unity) with SI Order of Magnitude prefixes.

gather

Wrapper for asyncio.gather.

get_lock

Get the global lock.

moveto

pandas

Registers the current tqdm class with

refresh

Force refresh the display of this bar.

reset

Resets to 0 iterations for repeated use.

send

set_description

Set/modify description of the progress bar.

set_description_str

Set/modify description without ': ' appended.

set_lock

Set the global lock.

set_postfix

Set/modify postfix (additional stats) with automatic formatting based on datatype.

set_postfix_str

Postfix without dictionary expansion, similar to prefix handling.

status_printer

Manage the printing and in-place updating of a line of characters.

unpause

Restart tqdm timer from last print time.

update

Manually update the progress bar, useful for streams such as reading files.

wrapattr

stream : file-like object. method : str, "read" or "write". The result of read() and the first argument of write() should have a len().

write

Print a message via tqdm (without overlap with bars).

Attributes

format_dict

Public API for read-only member access.

monitor

monitor_interval