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
[x] Add a clear description of the change
[x] Add any new tests needed
[x] Run spell check on new text visible to user (documentation, GUI etc.)
[x] Check any changes to requirements.txt are reflected in setup.py and conda-forge feedstock
[x] Check code passes CI checks (run run_ci.sh or check GitHub Actions)
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 thetarget_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. withwarnings.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
requirements.txt
are reflected insetup.py
and conda-forge feedstockrun_ci.sh
or check GitHub Actions)See CONTRIBUTING.md for more details.