-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.py
156 lines (142 loc) · 5.94 KB
/
main.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#Copyright 2023, Battelle Energy Alliance, LLC ALL RIGHTS RESERVED
"""
Created on %(date)s
@author: %Minglei Lu
"""
import os
print('\n\
\N{COPYRIGHT SIGN} 2023, Battelle Energy Alliance, LLC ALL RIGHTS RESERVED \n\
###################################################################### \n\
____ ____ ____ ___ _____ _____ \n\
/ ___| | _ \ | _ \ |_ _| |_ _| | ____| \n\
\___ \ | |_) | | |_) | | | | | | _| \n\
___) | | __/ | _ < | | | | | |___ \n\
|____/ |_| |_| \_\ |___| |_| |_____| \n\
\n\
Smart Preprocessing & Robust Integration Emulator \n\
\n\
\n\
###################################################################### \n\
\n\
SPRITE current functions include predicting \n\
the particle size distribution (PSD) of \n\
milled flexible and brittle materials. \n\
')
## select material
while True:
materialnum = input("Choose the model for the prediction of flexible or brittle materials (choose between 1 and 2):\n\n\
[1] Flexible material: Corn stover (biomass)\n\
[2] Brittle materials: Glass (glass recycling)\n\
\nPlease enter here: ")
if materialnum == "":
print('\nNo input detected, using Method No.1 as default.\n')
materialnum = 1
try:
materialnum = int(materialnum)
if 1 <= materialnum <= 2:
print(f"\nMethod No.{materialnum} is selected.\n")
if materialnum == 1:
materialnum = 1
elif materialnum == 2:
materialnum = 2
break
else:
print("\n############# Warning ############## \n\
Input out of range. Please enter an integer between 1 and 2.\n\
####################################\n")
except ValueError:
print("\n############# Warning ############## \n\
Invalid input. Please enter an integer.\n\
####################################\n")
else:
print('Invalid input')
if materialnum == 1:
while True:
data_num = input("Choose the model for the prediction (choose between 1 and 3):\n\n\
[1] PBM: Population Balance Model \n\
[2] DNO+: Enhanced Deep Neural Operator \n\
[3] PIDNO+: Physics-informed DNO+ \n\
[4] SR: Symbolic Regression \n\
\nPlease enter here: ")
if data_num == "":
print('\nNo input detected, using Method No.1 as default.\n')
data_num = 1
os.chdir('./PBM')
with open("./main.py") as f:
exec(f.read())
break
try:
data_num = int(data_num)
if 1 <= data_num <= 4:
print(f"\nMethod No.{data_num} is selected.\n")
if data_num == 1:
os.chdir('./PBM')
with open("./main.py") as f:
exec(f.read())
os.chdir('../')
elif data_num == 2:
os.chdir('./DNO+')
with open("./main.py") as f:
exec(f.read())
os.chdir('../')
elif data_num == 3:
os.chdir('./PIDNO+')
with open("./main.py") as f:
exec(f.read())
os.chdir('../')
elif data_num == 4:
os.chdir('./SR/flexible')
with open("./main.py") as f:
exec(f.read())
os.chdir('../../')
break
else:
print("\n############# Warning ############## \n\
Input out of range. Please enter an integer between 1 and 3.\n\
####################################\n")
except ValueError:
print("\n############# Warning ############## \n\
Invalid input. Please enter an integer.\n\
####################################\n")
else:
print('Invalid input')
if materialnum == 2:
while True:
data_num = input("Choose the function (choose between 1 and 2):\n\n\
[1] PIDNO+: Physics-informed DNO+ \n\
[2] SR: Symbolic Regression \n\
\nPlease enter here: ")
if data_num == "":
print('\nNo input detected, using Method No.1 as default.\n')
data_num = 1
os.chdir('./PIDNO+')
with open("./main.py") as f:
exec(f.read())
break
try:
data_num = int(data_num)
if 1 <= data_num <= 2:
print(f"\nMethod No.{data_num} is selected.\n")
if data_num == 1:
os.chdir('./PIDNO+')
with open("./main_glass.py") as f:
exec(f.read())
os.chdir('../')
elif data_num == 2:
os.chdir('./SR/brittle')
with open("./main.py") as f:
exec(f.read())
os.chdir('../../')
break
else:
print("\n############# Warning ############## \n\
Input out of range. Please enter an integer between 1 and 3.\n\
####################################\n")
except ValueError:
print("\n############# Warning ############## \n\
Invalid input. Please enter an integer.\n\
####################################\n")
else:
print('Invalid input')