forked from RAMP-project/RAMP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathramp.py
61 lines (51 loc) · 2.06 KB
/
ramp.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import argparse
from ramp.ramp_run import run_usecase
parser = argparse.ArgumentParser(
prog="python ramp_run.py", description="Execute RAMP code"
)
parser.add_argument(
"-i",
dest="fname_path",
nargs="+",
type=str,
help="path to the (xlsx) input files (including filename). If not provided, then legacy .py input files will be fetched",
)
parser.add_argument(
"-n",
dest="num_profiles",
nargs="+",
type=int,
help="number of profiles to be generated",
)
if __name__ == "__main__":
args = vars(parser.parse_args())
fnames = args["fname_path"]
num_profiles = args["num_profiles"]
# Define which input files should be considered and run.
if fnames is None:
print("Please provide path to input file with option -i, \n\nDefault to old version of RAMP input files\n")
# Files are specified as numbers in a list (e.g. [1,2] will consider input_file_1.py and input_file_2.py)
from ramp.ramp_run import input_files_to_run
if num_profiles is not None:
if len(num_profiles) == 1:
num_profiles = num_profiles * len(input_files_to_run)
else:
if len(num_profiles) != len(input_files_to_run):
raise ValueError(
"The number of profiles parameters should match the number of input files provided")
else:
num_profiles = [None] * len(input_files_to_run)
for i, j in enumerate(input_files_to_run):
run_usecase(j=j, num_profiles=num_profiles[i])
else:
if num_profiles is not None:
if len(num_profiles) == 1:
num_profiles = num_profiles * len(fnames)
else:
if len(num_profiles) != len(fnames):
raise ValueError(
"The number of profiles parameters should match the number of input files provided")
else:
num_profiles = [None] * len(fnames)
for i, fname in enumerate(fnames):
run_usecase(fname=fname, num_profiles=num_profiles[i])