Menpo
  • menpo.base
    • Core
    • Convenience
    • Warnings and Exceptions
  • menpo.io
    • Input
    • Output
    • Path Operations
  • menpo.image
    • Image Types
    • Exceptions
  • menpo.feature
    • Features
    • Optional Features
    • Predefined (Partial Features)
    • Normalization
    • Visualization
    • Widget
    • References
  • menpo.landmark
    • Abstract Classes
    • Exceptions
    • Landmarks & Labeller
    • Bounding Box Labels
    • Labels
  • menpo.math
    • Decomposition
    • Linear Algebra
    • Convolution
  • menpo.model
    • Abstract Classes
    • Principal Component Analysis
    • Gaussian Markov Random Field
  • menpo.shape
    • Base Class
    • PointCloud
    • Graphs
    • PointGraphs
    • LabelledPointGraph
    • Predefined Graphs
    • Triangular Meshes
    • Group Operations
    • Shape Building
  • menpo.transform
    • Composite Transforms
    • Homogeneous Transforms
    • Alignments
    • Group Alignments
    • Composite Transforms
    • Radial Basis Functions
    • Abstract Bases
    • Performance Specializations
  • menpo.visualize
    • Abstract Classes
    • Patches
    • Print Utilities
    • Various
  • Changelog
    • 0.8.1 (2017/05/06)
    • 0.8.0 (2017/05/04)
    • 0.7.7 (2017/01/05)
    • 0.7.6 (2016/12/10)
    • 0.7.5 (2016/11/17)
    • 0.7.4 (2016/08/18)
    • 0.7.3 (2016/08/05)
    • 0.7.2 (2016/06/22)
    • 0.7.1 (2016/06/10)
    • 0.7.0 (2016/05/20)
    • 0.6.2 (2015/12/13)
    • 0.6.1 (2015/12/09)
    • 0.6.0 (2015/11/26)
    • 0.5.3 (2015/08/12)
    • 0.5.2 (2015/08/04)
    • 0.5.1 (2015/07/16)
    • 0.5.0 (2015/06/25)
    • 0.4.4 (2015/03/05)
    • 0.4.3 (2015/02/19)
    • 0.4.2 (2015/02/19)
    • 0.4.1 (2015/02/07)
    • 0.4.0 (2015/02/04)
    • v0.4.0a2 (2014/12/03)
    • v0.4.0a1 (2014/10/31)
    • v0.3.0 (2014/05/27)
 
Menpo
  • Docs »
  • menpo.visualize »
  • print_progress
  • Edit on GitHub

print_progress¶

menpo.visualize.print_progress(iterable, prefix='', n_items=None, offset=0, show_bar=True, show_count=True, show_eta=True, end_with_newline=True, min_seconds_between_updates=0.1)[source]¶

Print the remaining time needed to compute over an iterable.

To use, wrap an existing iterable with this function before processing in a for loop (see example).

The estimate of the remaining time is based on a moving average of the last 100 items completed in the loop.

Parameters:
  • iterable (iterable) – An iterable that will be processed. The iterable is passed through by this function, with the time taken for each complete iteration logged.
  • prefix (str, optional) – If provided a string that will be prepended to the progress report at each level.
  • n_items (int, optional) – Allows for iterator to be a generator whose length will be assumed to be n_items. If not provided, then iterator needs to be Sizable.
  • offset (int, optional) – Useful in combination with n_items - report back the progress as if offset items have already been handled. n_items will be left unchanged.
  • show_bar (bool, optional) – If False, The progress bar (e.g. [========= ]) will be hidden.
  • show_count (bool, optional) – If False, The item count (e.g. (4/25)) will be hidden.
  • show_eta (bool, optional) – If False, The estimated time to finish (e.g. - 00:00:03 remaining) will be hidden.
  • end_with_newline (bool, optional) – If False, there will be no new line added at the end of the dynamic printing. This means the next print statement will overwrite the dynamic report presented here. Useful if you want to follow up a print_progress with a second print_progress, where the second overwrites the first on the same line.
  • min_seconds_between_updates (float, optional) – The number of seconds that have to pass between two print updates. This allows print_progress to be used on fast iterations without incurring a significant overhead. Set to 0 to disable this throttling.
Raises:

ValueError – offset provided without n_items

Examples

This for loop:

from time import sleep
for i in print_progress(range(100)):
    sleep(1)

prints a progress report of the form:

[=============       ] 70% (7/10) - 00:00:03 remaining
Next Previous

© Copyright 2014, Joan Alabort-i-Medina, Epameinondas Antonakos, James Booth, Patrick Snape, and Stefanos Zafeiriou.

Built with Sphinx using a theme provided by Read the Docs.
Read the Docs v: v0.8.1
Versions
v0.8.1
v0.8.0
v0.7.7
v0.7.6
v0.7.5
v0.7.4
v0.7.3
v0.7.2
v0.7.1
v0.7.0
v0.6.2
v0.6.1
v0.6.0
v0.5.3
v0.5.2
v0.5.1
v0.5.0
v0.4.4
v0.4.3
v0.4.2
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.