momepy icon indicating copy to clipboard operation
momepy copied to clipboard

SciPy sparse array migration from sparse matrices

Open dschult opened this issue 7 months ago • 2 comments

As per the SciPy sparray migration guide this is a "pass 1" set of changes. "Pass 1" essentially makes sure your code is compatible for both sparray and spmatrix. It doesn't actually change any sparse objects to sparray. It only changes usage of * and ** and gets rid of some functions like spdiags.

In this repo, we only need to change one use of ** for matrix power. Once scipy v1.12 is the minimal version we can use scipy.sparse.linalg.matrix_power for matrix power. But this PR uses @ repeatedly instead. It is close to the same speed for large matrices.

This change should also help if/when the code gets moved from using w to graph.

dschult avatar May 15 '25 21:05 dschult

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 98.2%. Comparing base (4037c70) to head (02f8d2c). :warning: Report is 118 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main    #700     +/-   ##
=======================================
+ Coverage   97.4%   98.2%   +0.8%     
=======================================
  Files         26      40     +14     
  Lines       4328    7166   +2838     
=======================================
+ Hits        4214    7034   +2820     
- Misses       114     132     +18     
Files with missing lines Coverage Δ
momepy/weights.py 98.5% <100.0%> (-1.5%) :arrow_down:

... and 1 file with indirect coverage changes

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar May 15 '25 21:05 codecov[bot]

Thanks. Though the whole function has been deprecated and is marked for a removal in the upcoming release. So while I'm happy to merge this, it will be gone anyway :).

martinfleis avatar May 16 '25 05:05 martinfleis

The weights module is gone now.

martinfleis avatar Sep 23 '25 07:09 martinfleis