-
Notifications
You must be signed in to change notification settings - Fork 56
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
Functional density #586
Functional density #586
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #586 +/- ##
=======================================
+ Coverage 97.4% 97.9% +0.5%
=======================================
Files 26 37 +11
Lines 4328 5612 +1284
=======================================
+ Hits 4214 5492 +1278
- Misses 114 120 +6
|
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.
Check your types and ensure all supported are tested.
momepy/functional/_intensity.py
Outdated
|
||
|
||
def density( | ||
values: Series | np.ndarray, areas: Series | np.ndarray, graph: Graph |
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.
values: Series | np.ndarray, areas: Series | np.ndarray, graph: Graph | |
y: Series | NDArray[np.float_], area: Series | NDArray[np.float_], graph: Graph |
momepy/functional/_intensity.py
Outdated
|
||
stats = graph.apply( | ||
pd.concat((values, areas.rename("area")), axis=1), | ||
lambda x: (x.loc[:, x.columns != "area"].sum() / x["area"].sum()), |
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.
are you assuming here that values
can be 2d and calculate density for multiple vars at one go? That is undocumented and goes against typing.
Similar functionality to count and arearatio.
Similarly, it could be implemented by either us or the users using two calls to describe_reached.