Added support for time series temperature in an experiment step#4855
Open
Rishab87 wants to merge 8 commits intopybamm-team:mainfrom
Open
Added support for time series temperature in an experiment step#4855Rishab87 wants to merge 8 commits intopybamm-team:mainfrom
Rishab87 wants to merge 8 commits intopybamm-team:mainfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #4855 +/- ##
========================================
Coverage 98.71% 98.71%
========================================
Files 304 304
Lines 23495 23522 +27
========================================
+ Hits 23192 23219 +27
Misses 303 303 ☔ View full report in Codecov by Sentry. |
kratman
requested changes
Feb 18, 2025
Comment on lines
550
to
560
| if isinstance(temperature_and_units, np.ndarray): | ||
| if temperature_and_units.ndim == 2 and temperature_and_units.shape[1] == 2: | ||
| # Assume first column is time (s) and second column is temperature (K) | ||
| times = temperature_and_units[:, 0] | ||
| temps = temperature_and_units[:, 1] | ||
| # Create an interpolant function parameter that depends on time | ||
| return pybamm.Interpolant(times, temps, pybamm.t, interpolator="linear") | ||
| else: | ||
| raise ValueError( | ||
| "Temperature time-series must be a 2D array with two columns (time, temperature)." | ||
| ) |
Contributor
There was a problem hiding this comment.
Can you write a test for this. Sometimes it is easiest to cover error handling code by extracting a smaller function and using that in the tests. You can make the if-else block a helper function, then covering it in tests should be easy
Member
Author
There was a problem hiding this comment.
yeah sure, I'll add a test for it
…nto arbitrary-temp
Member
Author
|
Can I get a review on this? |
Member
Author
|
Any updates on this? |
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.
Description
Added support for time series temperature in an experiment step, now it can be passed something like this:
Fixes #4200
Type of change
Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #)
Important checks:
Please confirm the following before marking the PR as ready for review:
nox -s pre-commitnox -s testsnox -s doctests