Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constraints patch #297

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion astroplan/observer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions astroplan/scheduling.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,14 +530,20 @@ 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
# TODO : change default constraints to [] and switch to append
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:
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/scheduling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down