-
Notifications
You must be signed in to change notification settings - Fork 16
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
Validation based on models #34
Validation based on models #34
Conversation
… Electrode, renamed Chemistry field to Particle
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## develop #34 +/- ##
==========================================
Coverage ? 97.06%
==========================================
Files ? 9
Lines ? 307
Branches ? 0
==========================================
Hits ? 298
Misses ? 9
Partials ? 0 ☔ View full report in Codecov by Sentry. |
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.
thanks @ikorotkin looks great! can you also update the changelog
bpx/schema.py
Outdated
if (parameter_class_name, model) in allowed_combinations: | ||
return values | ||
else: | ||
raise ValueError( |
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.
can we raise a warning instead of an error? think error might be aggressive and will end up being a barrier to #40
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.
Is there any native way to raise a warning in pydantic
?
It looks like it hasn't been implemented (see this issue).
EDIT: I'll do it using warnings.warn()
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.
Changed it to a warning. Updated tests and CHANGELOG.
Please feel free to suggest a better warning message if it sounds awkward :)
A (working) attempt to add validation based on the model according to issue #29 and following roadmap #22.
This PR is based on #33 and supports blended electrodes for all models.
Added multiple tests and validation that the given model (SPM, SPMe, or DFN) corresponds to a proper parameter set. In the case of SPM, some of the parameters should not be included:
Note if we change the
Model
field toDFN
orSPMe
in this example, this will produce an error.Also note how we defined blended electrode (positive in this example).
Some of the parameters are optional.