Skip to content

Commit b9eb610

Browse files
authored
Main function to execute
1 parent adfc040 commit b9eb610

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

Main.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
from Read_Write_CSV import *
2+
from Generate_DOE import *
3+
from User_input import *
4+
5+
import time
6+
7+
# ========================
8+
# Main execution function
9+
# ========================
10+
11+
def execute_main():
12+
"""
13+
Main function to execute the program.
14+
Calls "user_input" function to receive the choice of the DOE user wants to build and to read the input CSV file with the ranges of the variables. Thereafter, it calls the "generate_DOE" function to generate the DOE matrix and a suitable filename corresponding to the user's DOE choice. Finally, it calls the "write_CSV" function to write the DOE matrix (a Pandas DataFrame object) into a CSV file on the disk, and prints a message indicating the filename.
15+
"""
16+
doe_choice, infile = user_input()
17+
df, filename = generate_DOE(doe_choice,infile)
18+
if type(df)!=int or type(filename)!=int:
19+
flag=write_csv(df,filename)
20+
if flag!=-1:
21+
print("\nAnalyzing input and building the DOE...",end=' ')
22+
time.sleep(2)
23+
print("DONE!!")
24+
time.sleep(0.5)
25+
print(f"Output has been written to the file: {filename}.csv")
26+
else:
27+
print("\nError in writing the output. \nIf you have a file open with same filename, please close it before running the command again!")
28+
29+
30+
#=====================================================
31+
# Main UX with simple information about the software
32+
#=====================================================
33+
34+
print()
35+
print(" "*5+"Design-of-experiment builder by Dr. Tirthajyoti Sarkar, ON Semiconductor"+" "*5)
36+
print(" "*20+"June 2018, Sunnyvale, CA 94086"+" "*20)
37+
print(" "*10+"Uses the following packages: numpy, pandas, pydoe, diversipy"+" "*10)
38+
print()
39+
40+
# Executes the main function
41+
execute_main()

0 commit comments

Comments
 (0)