Skip to content

Commit 0c4b469

Browse files
authored
Calls DOE functions
1 parent 0b285c1 commit 0c4b469

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed

Generate_DOE.py

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
from DOE_functions import *
2+
from Read_Write_CSV import *
3+
4+
# ====================================================================
5+
# Function to generate the DOE based on user's choice and input file
6+
# ====================================================================
7+
8+
def generate_DOE(doe_choice, infile):
9+
"""
10+
Generates the output design-of-experiment matrix by calling the appropriate function from the "DOE_function.py file".
11+
Returns the generated DataFrame (Pandas) and a filename (string) corresponding to the type of the DOE sought by the user. This filename string is used by the CSV writer function to write to the disk i.e. save the generated DataFrame in a CSV format.
12+
"""
13+
14+
dict_vars = read_variables_csv(infile)
15+
if type(dict_vars)!=int:
16+
factor_count=len(dict_vars)
17+
else:
18+
return (-1,-1)
19+
20+
if doe_choice==1:
21+
df=build_full_fact(dict_vars)
22+
filename='Full_factorial_design'
23+
24+
elif doe_choice==2:
25+
print("For this choice, you will be asked to enter a generator string expression. Please only use small letters e.g. 'a b c bc' for the string. Make sure to put a space in between every variable. Please note that the number of character blocks must be identical to the number of factors you have in your input file.\n")
26+
gen_string=str(input("Please enter the generator string for the fractional factorial build: "))
27+
print()
28+
if len(gen_string.split(' '))!=factor_count:
29+
print("Length of the generator string does not match the number of factors/variables. Sorry!")
30+
return (-1,-1)
31+
df=build_frac_fact(dict_vars,gen_string)
32+
filename='Fractional_factorial_design'
33+
34+
elif doe_choice==3:
35+
df=build_plackett_burman(dict_vars)
36+
filename='Plackett_Burman_design'
37+
38+
elif doe_choice==4:
39+
num_samples=int(input("Please enter the number of samples: "))
40+
print()
41+
df=build_sukharev(dict_vars,num_samples)
42+
filename='Sukharev_grid_design'
43+
44+
elif doe_choice==5:
45+
num_center=int(input("Please enter the number of center points to be repeated (if more than one): "))
46+
print()
47+
df=build_box_behnken(dict_vars,num_center)
48+
filename='Box_Behnken_design'
49+
50+
elif doe_choice==6:
51+
#num_center=int(input("Please enter the number of center points to be repeated (if more than one): "))
52+
print()
53+
df=build_central_composite(dict_vars,face='ccf')
54+
filename='Box_Wilson_face_centered_design'
55+
56+
elif doe_choice==7:
57+
#num_center=int(input("Please enter the number of center points to be repeated (if more than one): "))
58+
print()
59+
df=build_central_composite(dict_vars,face='cci')
60+
filename='Box_Wilson_face_inscribed_design'
61+
62+
elif doe_choice==8:
63+
#num_center=int(input("Please enter the number of center points to be repeated (if more than one): "))
64+
print()
65+
df=build_central_composite(dict_vars,face='ccc')
66+
filename='Box_Wilson_face_circumscribed_design'
67+
68+
elif doe_choice==9:
69+
num_samples=int(input("Please enter the number of random sample points to generate: "))
70+
print()
71+
df=build_lhs(dict_vars,num_samples=num_samples)
72+
filename='Simple_Latin_Hypercube_design'
73+
74+
elif doe_choice==10:
75+
num_samples=int(input("Please enter the number of random sample points to generate: "))
76+
print()
77+
df=build_space_filling_lhs(dict_vars,num_samples=num_samples)
78+
filename='Space_filling_Latin_Hypercube_design'
79+
80+
elif doe_choice==11:
81+
num_samples=int(input("Please enter the number of random sample points to generate: "))
82+
print()
83+
df=build_random_k_means(dict_vars,num_samples=num_samples)
84+
filename='Random_k_means_design'
85+
86+
elif doe_choice==12:
87+
num_samples=int(input("Please enter the number of random sample points to generate: "))
88+
print()
89+
df=build_maximin(dict_vars,num_samples=num_samples)
90+
filename='Maximin_reconstruction_design'
91+
92+
elif doe_choice==13:
93+
num_samples=int(input("Please enter the number of random sample points to generate: "))
94+
print()
95+
df=build_halton(dict_vars,num_samples=num_samples)
96+
filename='Halton_sequence_design'
97+
98+
elif doe_choice==14:
99+
num_samples=int(input("Please enter the number of random sample points to generate: "))
100+
print()
101+
df=build_uniform_random(dict_vars,num_samples=num_samples)
102+
filename='Uniform_random_matrix_design'
103+
104+
return (df,filename)

0 commit comments

Comments
 (0)