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
ENH: CloughTocher2DInterpolator multiple times with different values #18376
Conversation
Hi, I am having trouble understanding the outputs of the failed CI tests. |
This error you can ignore, it's not related to your changes and is being worked on separately. |
Have to admit, I don't like this at its present form. The reasons are mirroring #10860 (comment): it adds essentially a global state to objects and the result is hard to reason about and hard to maintain. Maybe there is a way to rework this similar to gh-17230 : add necessary hooks for a downstream subclass to override. |
Ok, I see your point. |
@ev-br I would like to know your opinion on the following matter: Also, the function |
I'd just override it in
Certainly, if it's not needed, it's best removed. That's an if though, this code has not been looked at for quite a while, it'd be great if you could take a close look. One other thing which would be useful is to do an asv benchmark (similar to what was done for the RGI) to double-check there are no slowdowns. |
0ca7d38
to
8fb293e
Compare
I have updated the PR such that now the barycentric coordinates are calculated in About the call to |
Note that CI errors are real and need to be fixed. |
My suggestion is that users maintain a subclass: #18376 (comment) |
@ev-br Ok, I misunderstood your first comments, sorry for that :( |
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.
This is getting closer, but there's still work to do. Ideally, we don't attach a bunch of attributes to instances.
9838925
to
48ba363
Compare
What do you think about the current form? |
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.
This is getting close!
I've left several small-ish comments; two big-picture asks are:
- can you verify that a subclass does what you want it to?
- we'd need a benchmark to check that there is no big perf regression (might want to take a look at what RGI PR did).
I have fixed the code according to your comments, and added a benchmark test with an example subclass.
If you have any clue on how to solve this issue I would be greateful. |
Don't know what the error is, sorry. Something about asv (which is the benchmark runner), so it's something about how you installed scipy. As a data point, I just run a benchmarks for a first time in several years and it basically worked (more below). My dev setup is a There is indeed some issue with Running
|
…in and set values after creation
…s for future interpolations
4ffec8a
to
6948eee
Compare
I will look into it an update when I find the reasons. |
Since I can't run the benchmarks on my computer for now, I have created a small benchmark of my own, and the differences you display do not show in it, even though it is based completely on the The code is as follows:
And I obtain the following results:
The changes are all within the standard deviation. |
OK, something's amiss with asv indeed:
|
Ok, so what else is needed for the PR to be approved? |
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.
OK, this is getting very very close. Two small comments, and then
- if someone has an idea of what's going on with asv benchmarks, that would be helpful
- can you verify that this PR improves the OP use case?
Here is a working example for subclassing:
The results are:
In this case, the operation is more than x15 faster, and the more different sets of values there are to interpolate the difference gets larger. This is very helpful for realtime applications. I have also fixed both comments, and updated the benchmark class (in case they ever work again...) |
It turns out I cheated a little bit, the original code could have been made faster if only one Delaunay triangulation would have been performed for all the iterations.
|
Are the errors related to me? |
Hmm... there's a slight git glitch it seems: submodule changes should not be there.
then
|
ff8f0a9
to
28ce130
Compare
Fixed (In a slightly different way). |
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.
LGTM now!
CI failure seems unrelated.
Yay! |
Merged. Thank you @hovavalon and congratulations with what I believe is your first scipy contribution. Keep them coming! |
Reference issue
#13306
What does this implement/fix?
The PR adds an ability to change interpolation values in an existing
CloughTocher2DInterpolator
object, while also saving the barycentric coordinates of interpolation points.In a use case in which only the values at the given points change, this saves most of the function's runtime.
The PR includes basic tests.
Additional information
This is my first PR to
scipy
, and I am not 100% sure how to document the API, help and guidance would be appreciated.