-
-
Notifications
You must be signed in to change notification settings - Fork 553
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
Implemented non_linear_time
, an array of time as an input to step
function
#3627
Conversation
Signed-off-by: Pradyot Ranjan <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #3627 +/- ##
========================================
Coverage 99.60% 99.60%
========================================
Files 259 259
Lines 21273 21275 +2
========================================
+ Hits 21189 21191 +2
Misses 84 84 ☔ 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 @prady0t, looks good. Happy to see almost all tests passing, although to fix coverage you might want to modify test_base_model relative to your changes. Requesting @rtimms review for further refinements.
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 for taking this on. I don't think it is necessary to have both npts
and non_linear_time
. Instead, I think we should deprecate npts
, require users to pass dt
and make t_eval
an optional argument.
In the deprecation warning we can explain that you can calculate t_eval = np.linspace(t_start, t_end, npts)
and pass that instead.
That way, you don't need to have repeated logic depending on which optional argument is passed, and the API is a bit cleaner - better to have only one way of doing things. It would also mimic solve_ivp's API where you pass t_span
(the start and end time) and optionally t_eval
.
tagging @TomTranter as I know you use step a fair bit in other projects
@rtimms suggestions sound sensible to me |
Yes that makes much more sense! Making changes now along with code coverage. |
Should I change name of variable |
You should always have to pass |
Why not just require |
Happy with this too, but |
Signed-off-by: Pradyot Ranjan <[email protected]>
Yes |
Signed-off-by: Pradyot Ranjan <[email protected]>
Signed-off-by: Pradyot Ranjan <[email protected]>
Signed-off-by: Pradyot Ranjan <[email protected]>
…n' into fixing-step-function
Signed-off-by: Pradyot Ranjan <[email protected]>
Signed-off-by: Pradyot Ranjan <[email protected]>
Signed-off-by: Pradyot Ranjan <[email protected]>
I've made the changes! Please have a look. |
thanks @prady0t looks great! can you add a changelog entry then this is good to go |
Signed-off-by: Pradyot Ranjan <[email protected]>
@agriyakhetarpal why is this CI job failing? |
@prady0t that check has been failing for a while. If you did not add any links in your PR then it is probably unrelated. I did not check if you made any URL changes, but I know it was failing before due to stuff in the all-contributors section and other markdown files. The check looks to see if it can access the URLs found in the codebase, and fails if any of them are unreachable. The idea is that if we put a link to a documentation page, it warns us if the URL stops working. Just check the links in the failing test to make sure it is not from anything you did. If it is unrelated then we will ignore it |
@rtimms Is anything left for your review of this PR? |
@prady0t I will merge this when CI passes. I think everything is done |
… function (pybamm-team#3627) * Implemented non_linear_time, an array of time Signed-off-by: Pradyot Ranjan <[email protected]> * style: pre-commit fixes * Modified step to take dt as required parameter Signed-off-by: Pradyot Ranjan <[email protected]> * style: pre-commit fixes * Fixed failing test cases Signed-off-by: Pradyot Ranjan <[email protected]> * style: pre-commit fixes * Delete python * Fixed failing test cases 2 Signed-off-by: Pradyot Ranjan <[email protected]> * style: pre-commit fixes * Added tests Signed-off-by: Pradyot Ranjan <[email protected]> * style: pre-commit fixes * Update pybamm/simulation.py * Renamed non_linear_time to t_eval and other suggested changes Signed-off-by: Pradyot Ranjan <[email protected]> * style: pre-commit fixes * Minor docstring fix Signed-off-by: Pradyot Ranjan <[email protected]> * Added deprecation warning Signed-off-by: Pradyot Ranjan <[email protected]> * style: pre-commit fixes * Added changelog.md entry Signed-off-by: Pradyot Ranjan <[email protected]> * Update CHANGELOG.md --------- Signed-off-by: Pradyot Ranjan <[email protected]> Co-authored-by: Pradyot Ranjan <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Arjun Verma <[email protected]> Co-authored-by: Robert Timms <[email protected]> Co-authored-by: Agriya Khetarpal <[email protected]> Co-authored-by: Eric G. Kratz <[email protected]>
Description
Fixes #3524
Now an array of time can be passed to
step
function which will return solutions at that step times.Example:
Output:
Type of change
Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s. If necessary, also add to the list of breaking changes.
Key checklist:
$ pre-commit run
(or$ nox -s pre-commit
) (see CONTRIBUTING.md for how to set this up to run automatically when committing locally, in just two lines of code)$ python run-tests.py --all
(or$ nox -s tests
)$ python run-tests.py --doctest
(or$ nox -s doctests
)You can run integration tests, unit tests, and doctests together at once, using
$ python run-tests.py --quick
(or$ nox -s quick
).Further checks: