Skip to content

Commit

Permalink
Set origin_mismatch="ignore" when calculating sun and moon separations
Browse files Browse the repository at this point in the history
This removes the warnings about non-rotation transform.
There is a comment before both instances to warn future editors.
  • Loading branch information
vandalt committed Sep 20, 2024
1 parent 9871101 commit c27b803
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions astroplan/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c27b803

Please sign in to comment.