Skip to content
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

Metric space #84

Merged
merged 58 commits into from
Apr 20, 2021
Merged

Metric space #84

merged 58 commits into from
Apr 20, 2021

Conversation

redhog
Copy link
Collaborator

@redhog redhog commented Apr 12, 2021

Continuation of #68 but within this repo

Egil added 30 commits November 25, 2020 12:26
@mmaelicke
Copy link
Owner

@redhog are you currently working on more commits?

@redhog
Copy link
Collaborator Author

redhog commented Apr 15, 2021

Nope :)

@mmaelicke
Copy link
Owner

@redhog, from the conversation I get that I will turn a few assert statements into an if today. What about the VariogramResult? you mentioned it could be dropped...
Can I go forward and do that to finally merge today, or is there something that we need to take care of / discuss?

Finally, just for my understanding, a reply to #84 (comment) would be great, so that I understand your code as well :)

Anything you would like to add?

Thank you man, I am really looking forward to use these nice code extensions.

@redhog
Copy link
Collaborator Author

redhog commented Apr 16, 2021

Yes, just drop VariogramResult.
And no, I think any other fixes/changes I make would have to go to their own PRs - this is getting way too big...

@mmaelicke
Copy link
Owner

@redhog I am finished with my changes. But I have broken something. All 7 tests fail at the same line:

ridx = np.where(dists <= max_dist)[0]

I don't get it right now. Maybe I am in front of my computer for a few hours too long today.
Did I unindent something? Can you help me out?

@mmaelicke
Copy link
Owner

@redhog ,
Unfortunately, I found a serious issue with this branch. I ran a notebook this morning producing some figures for my next publication. With the metric-space branch still active, a new variograms changed their shapes dramatically, without chaning the code. After some intensive code review, I think there is something wrong with the maxlag / max_dist settings. I tried to put an example together.
Consider the two examples below. I am only setting a maxlag, that should not change the variogram, as I am using the largest bin as a maxlag. For the master branch everything is fine and the two variograms look the same:
master

For the metric-space branch the two variograms differ dramatically. Note: the coordinates is a ndarray of shape (500,2).
metric-space

I am right now not sure, what is happening and you might have the better insight into the code. Maybe the grouping into lag classes is somehow not prepared for some kind of edge case. Other variograms in the very same notebook do not show this behavior.

@mmaelicke
Copy link
Owner

@redhog: Edit: here is the sample dataset if you want to run / try it yourself:
sample.csv

@redhog
Copy link
Collaborator Author

redhog commented Apr 19, 2021

Thanks, was gonna ask for the sample dataset :) Will try it out and try to figure out what's boken ASAP....

@mmaelicke
Copy link
Owner

mmaelicke commented Apr 19, 2021

@redhog Thanks, appreciate it!
I just pushed commit 0c617c5 to master, which includes the test data and a test that reproduces the example. You can also use that one to test a bugfix. (And this would also be another good place to put more tests that need actual spatial correlated data in the future...)

@redhog
Copy link
Collaborator Author

redhog commented Apr 19, 2021

There was some strangeness in the handling of max_dists (self.max_dist overriding max_dist to find_closest). With that fix, your new test, cherry-picked from master, passes.

Copy link
Owner

@mmaelicke mmaelicke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll merge and release in a minute.
Thanks @redhog, this is an awesome PR that really makes the lib better.

@mmaelicke mmaelicke merged commit 157ec54 into master Apr 20, 2021
@mmaelicke mmaelicke deleted the metric-space branch April 20, 2021 06:46
@redhog
Copy link
Collaborator Author

redhog commented Apr 20, 2021

:) So happy we managed to finally push it all the way!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants