-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_nlbayes.py
executable file
·32 lines (25 loc) · 1015 Bytes
/
run_nlbayes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python3
import argparse
import os
# parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("add_noise", type=str, default="True")
ap.add_argument("sigma", type=int)
ap.add_argument("usearea1", type=str, default="True")
ap.add_argument("usearea2", type=str, default="False")
ap.add_argument("computebias", type=str, default="False")
args = ap.parse_args()
def get_bool_param_from_string(string):
"""
Returns 1 (True) or 0 (False) from the string value
"""
test = str(string)
param = 1 if test == 'True' else 0
return param
add_noise = get_bool_param_from_string(args.add_noise)
usearea1 = get_bool_param_from_string(args.usearea1)
computebias = get_bool_param_from_string(args.computebias)
usearea2 = get_bool_param_from_string(args.usearea2)
p = f'NL_Bayes input_0.png {args.sigma} {add_noise} noisy.png denoised.png basic.png\
diff.png bias.png basic_bias.png diff_bias.png {usearea1} {usearea2} {computebias}'
if os.system(p)!= 0: exit(-1)