spacetelescope / spherical_geometry

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

Vectorization of `contains_lonlat` #259

Open camposandro opened 10 months ago

camposandro commented 10 months ago

Would it be possible to have contains_lonlat handle multiple sky coordinates checks at a time, in a vectorized fashion, to speed up operations and prevent an excessive number of function calls?

What I am thinking of in terms of interface would be something similar to what we currently have, but the function call would allow for the specification of 1D arrays for ra and dec :

polygon.contains_lonlat([300, 300, 272, 272], [-50, -55, -55, -50])

Is there any particular reason why it is currently restricted to scalars?