ortk95 / planetmapper

PlanetMapper: An open source Python package for visualising, navigating and mapping Solar System observations
https://planetmapper.readthedocs.io
MIT License
10 stars 1 forks source link

Ensure `SpiceBODIESNOTDISTINCT` is raised first if the target and observer are the same #355

Closed ortk95 closed 4 months ago

ortk95 commented 4 months ago

This ensures that if the bodies are the same, the SpiceBODIESNOTDISTINCT error will be raised first (by the subpoint calculations), rather than potentially getting a more cryptic divide by zero error from the target_diameter_arcsec calculation. This shouldn't have any major change in runtime functionality (as an error was always going to be raised), but should help to make things a little more explicit and clear.

Technically, with the previous version, the self.r_eq / self.target_distance would usually cause a numpy warning rather than a full exception, but in some situations this could be raised as an exception (e.g. with warnings.filterwarnings('error'). Therefore, this change ensures that the exception isn't affected by the warnings settings and ensures that there aren't any redundant warnings printed just before a much more useful error message.

Pull request checklist

See CONTRIBUTING.md for more details.

coveralls commented 4 months ago

Pull Request Test Coverage Report for Build 9004973135

Details


Totals Coverage Status
Change from base Build 9004764206: 0.0%
Covered Lines: 2913
Relevant Lines: 2925

💛 - Coveralls