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
Add symmetric st-neighbors in local knox #121
Conversation
Codecov Report
@@ Coverage Diff @@
## main #121 +/- ##
=======================================
+ Coverage 64.1% 69.4% +5.3%
=======================================
Files 12 12
Lines 1448 1769 +321
=======================================
+ Hits 928 1228 +300
- Misses 520 541 +21
|
inference type in edge plots
@knaaptime, do you mean guidance on how to test the result of |
Yeah. Looking at geopandas, like like you test for some known elements in the json output? |
Yes. Folium can give you a string of the HTML it generates, and we just try to ensure that those bits we need are there in the number of occurrences we expect them. |
thinking about this just a little bit more, i wonder if we should set the default neighbor color to yellow or something instead of blue. If you're stuck in LISA mode, you might assume blue is some sort of coldspot |
That sounds very reasonable. |
notebooks/spacetime.ipynb
Outdated
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.
In cell 10, you can avoid apply.
sd_collisions["time_in_days"] = (sd_collisions.COLLISION_DATE - min_date).dt.days
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.
useful, thanks
if dataframe.crs is None: | ||
warn( | ||
"There is no CRS set on the dataframe. The KDTree will assume coordinates " | ||
"are stored in Euclidean distances" | ||
) |
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.
just fyi, GeoPandas does not warn in this case. We only warn when the crs is geographic. No CRS implies cartesian coordinates.
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.
we hit this with the burkitt data which is stored in planar coords but doesnt have a CRS, so figured i'd add a warning just in case. I dont think we can always assume no CRS necessarily implies cartesian coords here.
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.
I don't mind the warning, just wanted to clarify the assumptions geopandas makes in case we want to do the same.
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.
ah gotcha. I opted to warn here because the KDtree will still "work" (and thus the class will produce a result), but afaik there's no way to make it work correctly with cartesian coords, so its up to the user if they know what they're doing. Maybe it would be more conservative to fail instead?
pointpats/spacetime.py
Outdated
"""Create an integer valued column for time""" | ||
time_series = pandas.to_datetime(df[column], format=fmt) | ||
min_time = time_series.min() | ||
time_int = time_series.appy(lambda x: x - min_time) |
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.
Here's a typo in apply
. I also don't think you need apply here.
time_int = time_series.appy(lambda x: x - min_time) | |
time_int = time_series - min_time |
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.
we were going to try an introspect any datetime col if passed, but then punted and decided the time col needs to be given as integer from the user.
so this is just a vestige of that idea and can be removed
pointpats/spacetime.py
Outdated
return s_coords, t_coords | ||
|
||
|
||
def _time_to_int(df, column, fmt="%Y%m%d"): |
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 not used. Shall we remove it or plug it somewhere?
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.
i think toss
Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>
Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>
inference type in edge plots
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 looks okay to me, assuming that you have checked the correctness of the result (which I haven't).
No description provided.