-
Notifications
You must be signed in to change notification settings - Fork 538
Add time interpolation to mpc data #3559
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
base: main
Are you sure you want to change the base?
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.
Thanks for the addition. This is definitely functionality we were missing. I think this would be better as it's own interpolate
, or get_interpolated_data
, method. Would that work for your application?
There is also the question of whether to support some form of interpolation in DynamicModelInterface
. (E.g., in get_data_at_time
, load_data
, or dedicated methods for interpolation.) I'm fine with (and think I prefer) punting for now if you don't need this for your application.
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.
Looks good once tests pass, thanks!
"""Return an array floats interpolated from data at times_data in | ||
time_set. |
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.
"""Return an array floats interpolated from data at times_data in | |
time_set. | |
"""Return an array of floats interpolated at the time points in time_set | |
from data defined at time_data. |
return pos | ||
|
||
|
||
def _get_interp_expr_vec(time_set, time_data, data, indexes=None): |
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.
indexes
isn't described in the docstring
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 indexes
used? If not, can it be removed?
If data are Pyomo components, this will return Pyomo expressions | ||
interpolation if data are floats, this will return floats. |
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.
If data are Pyomo components, this will return Pyomo expressions | |
interpolation if data are floats, this will return floats. | |
If data are Pyomo components, this will return Pyomo expressions. | |
If data are floats, this will return floats. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3559 +/- ##
=======================================
Coverage 88.75% 88.76%
=======================================
Files 890 891 +1
Lines 102246 102284 +38
=======================================
+ Hits 90749 90790 +41
+ Misses 11497 11494 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fixes None
Adds option to linearly interpolate from MPC TimeSeriesData.
Summary/Motivation:
Sometimes you have time series data that doesn't line up perfectly with model time indexes. @blnicho and @jsiirola, this is part of the recent MHE work.
Changes proposed in this PR:
Legal Acknowledgement
By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution: