parse_constraints_script
- pyoptex.doe.constraints.parse_constraints_script(script, factors, exclude=True, eps=1e-06)[source]
Parses a formula of constraints. The function returns an object of type
Colwhich can generate a function evaluating either the encoded or non-encoded design matrix. The generated function returns True where the constraints are violated.For example, “(A > 0) & (B < 0)” specifies that if A is larger than 0, B cannot be smaller than 0.
Another example, “(A == “L1”) & (B < 0)” specifies that if A is “L1”, B cannot be smaller than 0.
Use constraint.func() to retrieve a function which can evaluate a decoded design matrix, use constraint.encode() to retrieve a function which can evaluate an encoded design matrix.
Note
Parameter exclude can invert the function, specifying where the constraints are upheld.
Parameters
- scriptstr
The script to parse
- factorslist(
Factor) The list of factors in the design.
- excludebool
Determines whether the presented formula should be excluded (= return True when the constraints are violated), or not (= return False when the constraints are violated).
- epsfloat
The epsilon parameter to be used in the parsing. this parameter can be used to deal with numerical precision. For example, instead of “A > 0”, use “A > 0 + eps”.
Returns
- constraint
Col The root constraint which can be converted to a function to evaluate either the encoded or decoded design matrix.