From 7ceaa36e6340a5aa91d36e0e758e85be1dfb89c7 Mon Sep 17 00:00:00 2001 From: Aniket Pandey Date: Sun, 12 Mar 2017 20:23:36 +0530 Subject: [PATCH 1/3] Deleted the extra import of 'Isiterable' module --- astroplan/observer.py | 1 - 1 file changed, 1 deletion(-) 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 From 29b551f55e4c34171d6f708090b50755abf662f6 Mon Sep 17 00:00:00 2001 From: Aniket Pandey Date: Sun, 12 Mar 2017 20:26:50 +0530 Subject: [PATCH 2/3] Corrected a typo in the scheduling tutorial --- docs/tutorials/scheduling.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 0cf8573d3e7832e0de20ad1b05a44540aae0bf78 Mon Sep 17 00:00:00 2001 From: Aniket Pandey Date: Tue, 11 Apr 2017 11:53:01 +0530 Subject: [PATCH 3/3] Modified the handling of corner cases in Sequential Scheduler Adjusted the code slightly so that memory usage is minimized, the properties `_all_constraints` and `constraints` were being used repetitively . Also separately added the part which can append `AltitudeConstraints` in `b.constraints` if initially the constraints was not empty and there was no instance of `AltitudeConstraint` (default 0 deg) in it. --- astroplan/scheduling.py | 6 ++++++ 1 file changed, 6 insertions(+) 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: