nenupytf.other.tools
tools¶
-
nenupytf.other.tools.idx_of(array, value, order='low')[source]¶ Find the index of value in array.
Parameters:
-
class
nenupytf.other.tools.ProgressBar(valmax=100, barsize=None, title=None, bar=True, up_every=2)[source]¶ Bases:
object- Class to do fancy progressbars
- by G. Schworer
https://github.com/ceyzeriat/patiencebar Provides a terminal-friendly single-thread progress bar :param * valmax: the finish value of the progress bar. Default is 100. :type * valmax: float :param * barsize: the size of the bar in the opened terminal. If
None, the bar will automatically fit the width of the window. :type * barsize: int >0 :param * title: the title, printed one line above the progress bar :type * title: str :param * bar: whether the bar should be displayed or not. IfFalse, only the text given at eachupdate()will be printed :type * bar: bool :param * up_every: ifbarisTrue, the progress bar will be updated everyup_everypercent of progress. Settingup_every= 0 updates the progress bar at eachupdate():type * up_every: int [0-100]>>> import patiencebar as PB >>> n_calc = 34 >>> pb = PB.ProgressBar(valmax=n_calc, barsize=50, title="Test bar") >>> for i in range(n_calc): >>> do_stuff() >>> pb.update()
-
bar¶
-
barsize¶
-
reset(valmax=None, barsize=None, title=None, bar=None, up_every=None)[source]¶ Resets the progress bar with initialization values, unless new values are given :param * valmax: the finish value of the progress bar. Default is 100. :type * valmax: float :param * barsize: the size of the bar in the opened terminal. If
None, the bar will automatically fit the width of the window. :type * barsize: int >0 :param * title: the title, printed one line above the progress bar. :type * title: str :param * bar: whether the bar should be displayed or not. IfFalse, only the text given at eachupdate()will be printed. :type * bar: bool :param * up_every: ifbarisTrue, the progress bar will be updated everyup_everypercent of progress. Settingup_every= 0 updates the progress bar at eachupdate(). :type * up_every: int [0-100]>>> n_calc = 34 >>> pb = PB.Patiencebar(valmax=n_calc, barsize=50, title="Test bar") >>> for i in range(n_calc): >>> do_stuff() >>> pb.update() >>> pb.reset(title="Second trial", barsize=70) >>> for i in range(n_calc): >>> do_stuff() >>> pb.update()
-
running¶
-
title¶
-
up_every¶
-
update(step=None)[source]¶ Updates the progress bar to a newer value :param * step: adds 1 to the progress of the bar, where
valmaxis the finish value. :type * step: None :param * step: sets the progress of the bar to thestepvalue, wherevalmaxis the finish value. :type * step: float :param * step: displaysstepon a new line. For this to work,barmust beFalse(no progress bar displayed) otherwise the update instruction is ignored. :type * step: str
-
valmax¶