spacetelescope / spherical_geometry

A Python package for handling spherical polygons that represent arbitrary regions of the sky
http://spherical-geometry.readthedocs.io/
61 stars 31 forks source link

Fix bugs in the Python implementation of inner1d and length #265

Closed mcara closed 3 months ago

mcara commented 4 months ago

This PR should fix (for now some) errors in unit tests when C math_util is not available.

length() needs more investigation (but the biggest difference in how nan are treated in comparisons: C code considers two nan equal) and I will do that in about 1 week from now.

Fix #261

CC: @jhunkeler @pllim

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 30.43478% with 16 lines in your changes are missing coverage. Please review.

Project coverage is 80.33%. Comparing base (5de7fc7) to head (dd32324). Report is 4 commits behind head on master.

Files Patch % Lines
spherical_geometry/great_circle_arc.py 28.57% 15 Missing :warning:
spherical_geometry/polygon.py 50.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #265 +/- ## ========================================== - Coverage 81.28% 80.33% -0.96% ========================================== Files 5 5 Lines 1010 1017 +7 ========================================== - Hits 821 817 -4 - Misses 189 200 +11 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

pllim commented 4 months ago

This does fix the devdeps job, so if you don't want to add a test, feel free to merge. Thanks!

mcara commented 4 months ago

I think this should fix failing tests and the Python versions of length and inner1d. I disabled one test: I don't think it is critical and I will think about it in a week.

Unit tests for would be a plus but no time now.

mcara commented 3 months ago

Tests with numpy>2.0.0 are passing after https://github.com/spacetelescope/spherical_geometry/pull/270 and https://github.com/spacetelescope/spherical_geometry/blob/7028f15eff18caee6c56219ff774c3c534b6ea67/pyproject.toml#L57 uncommented.

Screenshot 2024-05-12 at 3 44 04 PM
mcara commented 3 months ago

After commit c99e74e4440f4d40cae9a409dc1ff8f3ea179453 most tests (except for one that we skip) with numpy implementation of quad-accuracy functions from math_util pass.

I will now remove tricks used for testing purpose and squash most commits.