pencil.backpack

Third-party modules.

Submodules

Functions

printProgressBar(iteration, total[, pbar, prefix, ...])

Call in a loop to create terminal progress bar

in_ipynb()

Returns True if executed in jupyter notebook, else False.

module_exists(MOD)

Returns True if module MOD exists, else False.

Package Contents

pencil.backpack.printProgressBar(iteration, total, pbar=False, prefix='', suffix='', decimals=1, length=50, fill='X', verbose=False)

Call in a loop to create terminal progress bar

Parameters:
  • Required (total -) – current iteration (Int)

  • Required – total iterations (Int)

  • RECOMMENDED (pbar -) – put progress bar object here, False initially

  • Optional (fill -) – prefix string (Str)

  • Optional – suffix string (Str)

  • Optional – positive number of decimals in percent complete (Int)

  • Optional – character length of bar (Int)

  • Optional – bar fill character (Str)

Example

pbar = False; Nt = np.size(varlist) for ii, varname in enumerate(varlist):

pbar = pc.backpack.printProgressBar(ii, Nt, pbar=pbar) var = pc.read.var(varname, trim_all=True) …

Non-tqdm Example:

printProgressBar(i, l, prefix = ‘Progress:’, suffix = ‘Complete’, length = 50)

Credit: Greensticks modified version of @Vladimir Ignatyev’s solution

http://stackoverflow.com/questions/3173320/text-progress-bar-in-the-console

pencil.backpack.in_ipynb()

Returns True if executed in jupyter notebook, else False.

pencil.backpack.module_exists(MOD)

Returns True if module MOD exists, else False.