print(f'{GREEN}green {RED} red {ENDC}no color {CYAN} cyan {ENDC} no color {WHITE} white {ENDC} no color {UP1} up1 {ERASE} erase {ENDC} no color {YELLOW} yellow')
green red no color cyan no color white no color up1 erase no color yellow
The analysis and conversion scripts need to know out where the config files (i.e. main.ini
) are located and where to store the process data. For the pip
installed packages an ANALYSIS_DIR
variable should be set before starting the script.
print(f'{GREEN}green {RED} red {ENDC}no color {CYAN} cyan {ENDC} no color {WHITE} white {ENDC} no color {UP1} up1 {ERASE} erase {ENDC} no color {YELLOW} yellow')
green red no color cyan no color white no color up1 erase no color yellow
get_t_str ()
returns current hour:minute:second
colored (txt, color=None)
returns colored text for printing, resetting the color at the end
print(colored('I am red', RED))
print(colored('I am green', GREEN))
print(colored('I am cyan', CYAN))
I am red
I am green
I am cyan
prnt_msg (txt:str, head:str='', color=None, blank_lines:int=0, endl:bool=True, prnt:bool=True)
prints the message with a header of a certain color and a current time stamp
Type | Default | Details | |
---|---|---|---|
txt | str | message to print | |
head | str | Header to the message | |
color | NoneType | None | Color of the header |
blank_lines | int | 0 | number of blank lines before the message |
endl | bool | True | add end line charachter |
prnt | bool | True | print the message? |
info (txt:str, blank_lines:int=0, endl:bool=True, prnt:bool=True)
prints out message with a green INFO heading and a current time stamp.
Returns current time
Type | Default | Details | |
---|---|---|---|
txt | str | message to print | |
blank_lines | int | 0 | number of blank lines to follow |
endl | bool | True | add end line charachter |
prnt | bool | True | print the message? |
add_to_info (t:float, msg:str='Done', color=None, prnt:bool=True)
Prints colored message and a time difference between the inputed time and current time
Type | Default | Details | |
---|---|---|---|
t | float | time in float point format since the Epoch | |
msg | str | Done | Message to print |
color | NoneType | None | |
prnt | bool | True |
warning (txt:str, blank_lines:int=0, prnt=True)
Prints yellow colored warning message with a timestamp
Type | Default | Details | |
---|---|---|---|
txt | str | warning to print | |
blank_lines | int | 0 | number of bank lines to follow |
prnt | bool | True | print? |
critical (txt)
get_stat (status)
returns the state of Draw
class options
choose (v, default, decider='None', *args, **kwargs)
Returns the first object if the decider
not None
and the object itself is not None
, otherwise returns the second default
element, optionally passes arguments if the returned object is a function
Type | Default | Details | |
---|---|---|---|
v | first object | ||
default | default object | ||
decider | str | None | Decider |
args | |||
kwargs |
First object not None
so choose it
The first object is None
so choose the default
second object, since the decider
is None
The first object is None
but the decider
is not so choose the first object
round_up_to (num, val:int=1)
rounds up an int or float to a digit indicacted by val
Type | Default | Details | |
---|---|---|---|
num | number to round up | ||
val | int | 1 | the order to which round up 1 , 10 , 100 , … |
example:
do (fs, pars, exe=-1)
do_nothing ()
is_iter (v)
is_ufloat (value)
uarr2n (x)
uarr2s (arr)
arr2u (x, ex)
add_err (u, e)
add_perr (u, e)
eff2u (eff)
make_ufloat (n, s=0)
make_list (value)
prep_kw (dic, **default)
get_kw (kw, kwargs, default=None)
rm_key (d, *key)
mean_sigma (values, weights=None, err=True)
Return the weighted average and standard deviation. values, weights – Numpy ndarrays with the same shape.
calc_eff (k=0, n=0, values=None)
cart2pol (x, y)
pol2cart (rho, phi)
get_x (x1, x2, y1, y2, y)
get_y (x1, x2, y1, y2, x)
ensure_dir (path)
remove_file (*file_path, string=None, warn=True)
correlate (l1, l2)
add_spaces (s)
print_check (reset=False)
sum_times (t, fmt='%H:%M:%S')
load_json (filename)
Config (file_name:str, section:str=None, from_json:bool=False, required:bool=False, **kwargs)
ConfigParser implementing interpolation.
Type | Default | Details | |
---|---|---|---|
file_name | str | Path to the config file | |
section | str | None | section in the config file |
from_json | bool | False | load config from a json file |
required | bool | False | If the config file is required then throw an error if the file doesn’t exist |
kwargs |
AsymVar (value, err_down, err_up, fmt='.2f')
Initialize self. See help(type(self)) for accurate signature.
aufloat (n, s0=0, s1=0)
add_asym_error (v, s0=0, s1=0)
download_file (server:str, loc:str, target:str, out:bool=True)
Downloads a file using rsync in archive mode a
, transforming symlinks into referent file L
keeping partialy transfered files and displaying the progress P
. Increased verbosity v
Type | Default | Details | |
---|---|---|---|
server | str | remote_host/server address where the file is located | |
loc | str | path/to/remote_file on the server | |
target | str | path/to/local_directory | |
out | bool | True | print out the progress is True |