utilities.py
Go to the documentation of this file.
1 #//////////////////////////////////////////////////////////////////////////////
2 #// SUPERNOVA FLUX PREDICTIONS AT NOvA
3 #//
4 #// \brief utility functions
5 #// \author Justin Vasel <jvasel@indiana.edu>
6 #// \date 14 September 2018
7 #//
8 #//////////////////////////////////////////////////////////////////////////////
9 
10 import sys
11 
12 # /////////////////////////////////////////////////////////////////////////////
13 def progressBar(value, endvalue, bar_length = 40, msg = 'Progress'):
14  percent = float(value) / endvalue
15  arrow = '=' * int(round(percent * bar_length) - 1) + '>'
16  spaces = ' ' * (bar_length - len(arrow))
17 
18  sys.stdout.write("\r{0}: [\033[01;32m{1}\033[00m] {2}/{3} ({4}%)".format(msg, arrow + spaces, value, endvalue - 1, int(round(percent * 100))))
19  sys.stdout.flush()
def progressBar(value, endvalue, bar_length=40, msg='Progress')
Definition: utilities.py:13
fvar< T > round(const fvar< T > &x)
Definition: round.hpp:23
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14