Using the code below I would expect a design with 8 experiments whereby the min and max levels are used for each attribute. That works and I get a design that makes sense except for one item: the levels for G2 are changed from 0.2 and 0.4 into 0 and 1. This behavior does not change when I add a middle level, if I change the order of the attributes in the design space, or if I change the name of attribute G2. It does work however, when I change the values to 2 and 4. It seems that when one of the levels is below a value of 1, that the levels are changed to 0 and 1.
Using the code below I would expect a design with 8 experiments whereby the min and max levels are used for each attribute. That works and I get a design that makes sense except for one item: the levels for G2 are changed from 0.2 and 0.4 into 0 and 1. This behavior does not change when I add a middle level, if I change the order of the attributes in the design space, or if I change the name of attribute G2. It does work however, when I change the values to 2 and 4. It seems that when one of the levels is below a value of 1, that the levels are changed to 0 and 1.
My code:
from doepy import build
Define the design space
design_space = {'P_CG_substance':['P','CG'], 'P_CG_level':[1,2,3], 'AF':[1, 1.5, 2], 'MX':[1.25, 1.5, 2], 'G2':[0.2, 0.4], }
print(design_space)
Build the design
design = build.frac_fact_res(design_space)
In the design for column P_CG_substance, replace 0 with P and 1 with CG
design['P_CG_substance'] = design['P_CG_substance'].replace({0:'P', 1:'CG'})
Print the design
print(design)
Print the number of experiments
print(f'number of experiments is {len(design)}')
Expected result: P_CG_substance P_CG_level AF MX G2 0 P 1.0 1.0 2.00 0.4 1 CG 1.0 1.0 1.25 0.2 2 P 3.0 1.0 1.25 0.4 3 CG 3.0 1.0 2.00 0.2 4 P 1.0 2.0 2.00 0.2 5 CG 1.0 2.0 1.25 0.4 6 P 3.0 2.0 1.25 0.2 7 CG 3.0 2.0 2.00 0.4
What I get: P_CG_substance P_CG_level AF MX G2 0 P 1.0 1.0 2.00 1.0 1 CG 1.0 1.0 1.25 0.0 2 P 3.0 1.0 1.25 1.0 3 CG 3.0 1.0 2.00 0.0 4 P 1.0 2.0 2.00 0.0 5 CG 1.0 2.0 1.25 1.0 6 P 3.0 2.0 1.25 0.0 7 CG 3.0 2.0 2.00 1.0