tirthajyoti / doepy

Design of Experiment Generator. Read the docs at: https://doepy.readthedocs.io/en/latest/
MIT License
143 stars 41 forks source link

Parsing factor levels for two leveled designs #12

Open javi-rojo opened 3 years ago

javi-rojo commented 3 years ago

Thank you for this great work. I think that the code snippet that is used to trim factor_level_ranges in each two leveled design should search for the min, max value of the array and avoid duplicate values. something like: for key in factor_level_ranges: if len(factor_level_ranges[key]) != 2: factor_level_ranges[key][0] = min(factor_level_ranges[key]) factor_level_ranges[key][1] = max(factor_level_ranges[key]) factor_level_ranges[key] = factor_level_ranges[key][:2] print( f"{key} had more than two levels. Assigning the end point to the high level." ) if (factor_level_ranges[key][0]==factor_level_ranges[key][1]): rep_value=factor_level_ranges[key][0] raise ValueError("duplicate value '{rep_value}' found in key '{key}'") Furthermore, this code should be included in a function or a decorator since you are reusing it a lot in your code.