674 bug discrete variables in doe#742
Open
dlinzner-bcs wants to merge 3 commits intomainfrom
Open
Conversation
KappatC
reviewed
Mar 27, 2026
| _inputs = list(inputs.get([ContinuousInput])) | ||
| _inputs = [ | ||
| input for input in inputs.get([DiscreteInput]) if len(input.values) > 2 | ||
| ] + _inputs |
Collaborator
There was a problem hiding this comment.
now discrete are first thus test_formula_discrete_handled_like_continuous fails due to ordering. I updated it
KappatC
reviewed
Mar 27, 2026
| ) # formula casting for expansion of terms like (a+b)*(c+d) | ||
| for _input in inputs.get([DiscreteInput]): | ||
| for k in range( | ||
| 2, 99 |
Collaborator
There was a problem hiding this comment.
can we add sth like len(_input.values)+1 instead of 99 which is arbitary?
KappatC
reviewed
Mar 27, 2026
| ): # arbitrary upper bound on number of levels of discrete input | ||
| if (len(_input.values) <= k) and (_input.key + f" ** {k}" in formula.root): | ||
| warnings.warn( | ||
| f"Discrete input {_input.key} with {len(_input.values)} levels can not be represent term of order {k} or higher.", |
Collaborator
There was a problem hiding this comment.
syntax error. I corrected this
KappatC
reviewed
Mar 27, 2026
| custom_formula = "color + material + temperature + { pressure ** 2 } + color:material + color_intensity" | ||
| with pytest.warns( | ||
| UserWarning, | ||
| match="Discrete input pressure with 2 levels can not be represent term of order 2 or higher.", |
KappatC
reviewed
Mar 27, 2026
| 2, 99 | ||
| ): # arbitrary upper bound on number of levels of discrete input | ||
| if (len(_input.values) <= k) and (_input.key + f" ** {k}" in formula.root): | ||
| warnings.warn( |
Collaborator
There was a problem hiding this comment.
so now it gives a warning but continues. i guess that is fine. alternatively we could throw a value error I guess
KappatC
reviewed
Mar 27, 2026
Collaborator
KappatC
left a comment
There was a problem hiding this comment.
thank you Dominik. Looks good to me. Added a few comments and make some small changes to the files mostly because some tests were failing. Let me know if you are happy with these and if so we can merge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
(Write your motivation here.)
Have you read the Contributing Guidelines on pull requests?
(Write your answer here.)
Have you updated
CHANGELOG.md?(Write your answer here.)
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified that your changes work.)