diff --git a/astroplan/observer.py b/astroplan/observer.py index f7f9b5e4..3abf2698 100644 --- a/astroplan/observer.py +++ b/astroplan/observer.py @@ -15,7 +15,6 @@ from astropy.utils.compat.numpy import broadcast_to import astropy.units as u from astropy.time import Time -from astropy.utils import isiterable import numpy as np import pytz diff --git a/astroplan/scheduling.py b/astroplan/scheduling.py index b4994e83..d9f6fb67 100644 --- a/astroplan/scheduling.py +++ b/astroplan/scheduling.py @@ -530,7 +530,10 @@ def _make_schedule(self, blocks): for b in blocks: if b.constraints is None: b._all_constraints = self.constraints + b.constraints = [AltitudeConstraint(min=0 * u.deg)] else: + if AltitudeConstraint not in b.constraints: + b.constraints.append(AltitudeConstraint(min=0 * u.deg)) b._all_constraints = self.constraints + b.constraints # to make sure the scheduler has some constraint to work off of # and to prevent scheduling of targets below the horizon @@ -538,6 +541,9 @@ def _make_schedule(self, blocks): if b._all_constraints is None: b._all_constraints = [AltitudeConstraint(min=0 * u.deg)] b.constraints = [AltitudeConstraint(min=0 * u.deg)] + + # If there is no constraint on Altititude, specifically giving an AltitudeConstraint + # for the target to be above horizon. elif not any(isinstance(c, AltitudeConstraint) for c in b._all_constraints): b._all_constraints.append(AltitudeConstraint(min=0 * u.deg)) if b.constraints is None: diff --git a/docs/tutorials/scheduling.rst b/docs/tutorials/scheduling.rst index 9d3ffeda..2541a139 100644 --- a/docs/tutorials/scheduling.rst +++ b/docs/tutorials/scheduling.rst @@ -172,7 +172,7 @@ Scheduling Now all we have left is to initialize the scheduler, input our list of blocks and the schedule to put them in. There are currently two -schedulers to chose from in astroplan. +schedulers to choose from in astroplan. The first is a sequential scheduler. It starts at the start_time and scores each block (constraints and target) at that time and then