From c27b803fa77cd7338f4882749ab21b931686c3f7 Mon Sep 17 00:00:00 2001 From: Thomas Vandal Date: Fri, 20 Sep 2024 11:40:59 -0500 Subject: [PATCH] Set `origin_mismatch="ignore"` when calculating sun and moon separations This removes the warnings about non-rotation transform. There is a comment before both instances to warn future editors. --- astroplan/constraints.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/astroplan/constraints.py b/astroplan/constraints.py index f9857fe9..6bfa0d91 100644 --- a/astroplan/constraints.py +++ b/astroplan/constraints.py @@ -551,7 +551,10 @@ def compute_constraint(self, times, observer, targets): # 'get_sun' returns ICRS coords. sun = get_body('sun', times, location=observer.location) targets = get_skycoord(targets) - solar_separation = sun.separation(targets) + # sun.separation(targets) is NOT the same as targets.separation(sun) + # the former calculates the separation in the frame of the moon coord + # which is GCRS, and that is what we want. + solar_separation = sun.separation(targets, origin_mismatch="ignore") if self.min is None and self.max is not None: mask = self.max >= solar_separation @@ -597,7 +600,7 @@ def compute_constraint(self, times, observer, targets): # the former calculates the separation in the frame of the moon coord # which is GCRS, and that is what we want. targets = get_skycoord(targets) - moon_separation = moon.separation(targets) + moon_separation = moon.separation(targets, origin_mismatch="ignore") if self.min is None and self.max is not None: mask = self.max >= moon_separation