-
-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add @no_infer flag for turning off species/variable/parameter inferring #1122
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we want to instead have our own error type UndeclaredSymbolicError
that we throw
instead of calling error
? Then we can more precisely @test_throws UndeclaredSymbolicError
to verify this is working in all the different cases?
It might also be helpful if the equation/reaction can be displayed in some way too to actually show a user precisely where the error is occuring.
Might need write some more pretty-print utilities for |
Yeah, adding a |
The itnended behaviour is that all species/parameters/variables have to be declared using the corresponding options? Wouldn't a better name bet Also, a small request, can we hold of merging this one a bit? I am trying to sort out the observables PR (think it is working locally, but need to test during the weekend), working in the DSL file is increasingly messy, and this changes some of the relevant code. Ideally I had wanted #985 to be merged before any further changes to the DSL code (since that makes it way easier to modify), but it is getting further and further away. if possible, after this and the osbervablwes fix, could we hold of further DSL changes until that one gets sorted out? |
(this is definitely useful stuff though, I'll have a look tomorrow morning) |
I'm fine with holding off on further changes after the observables fix and this one get merged (and with merging observables first), if you will be actively working on the older one afterwards. |
Yes, that is the plan. Although I just remembered we decided to change how un-declared symbolic variables in equations is handled (always set to variables, instead of for special cases). Since that is breaking I probably should do that one asap as well. |
In the main parameters_extracted
species_extracted
vars_extracted
add_default_diff listing all symbolic variables we inferred from the input. I think it would be easier (since we don't have to pass an additional argument into each function and add separate checks to add a but to the main function like if noinfer && (!isempty(parameters_extracted) || ...)
error("...")
end Then we can also make it more granular, checking each separately with a designated error messages saying which symbolic variables must be designated. This would also solve and old issue that I think @gaurav-arya raised some time (but I maybe it was just mentioned over lunch and never made it to a actual issue, couldn't find it when I looked) |
Co-authored-by: Sam Isaacson <[email protected]>
Co-authored-by: Sam Isaacson <[email protected]>
Co-authored-by: Sam Isaacson <[email protected]>
Co-authored-by: Sam Isaacson <[email protected]>
Co-authored-by: Sam Isaacson <[email protected]>
@TorkelE I don't feel super strongly about this, but there are a couple advantages to the approach here:
I think 2. is the main reason to keep this approach. If we only check after collecting everything we can only report something was improperly inferred, but not where it was inferred from. If we keep the current approach we should try to display for users enough context to easily find the line that is causing a problem. |
|
@isaacsas (As you say) I don't think (1) is much concern here. I could see how 2 could be an advantage if there is a situation where you have mistakenly used a symbolic name which you do not need to use ( We probably should modify the error messages to give the equations/reaction in question then. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test/dsl/dsl_options.jl
Outdated
import Catalyst: UndeclaredSymbolicError | ||
let | ||
# Test error when species are inferred | ||
@test_throws UndeclaredSymbolicError @macroexpand rn = @reaction_network begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, rn =
is not needed in these cases
Closes #1045 |
@vyudu please don't forget the followup doc and HISTORY.md updates. |
Probably missed some places where we do this, @TorkelE might appreciate some guidance when you can. Also probably need some more tests to catch edge cases