Skip to content

Commit

Permalink
warn if changing mjd on conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
yoachim committed Aug 26, 2023
1 parent a6f1f3f commit fe0f567
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
5 changes: 4 additions & 1 deletion rubin_sim/scheduler/detailers/detailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@ def __call__(self, observation_list, conditions):

# Find the closest in angular distance of the points that are in band
ang_dist = _angular_separation(az[in_band], alt[in_band], conditions.tel_az, conditions.tel_alt)
good = np.min(np.where(ang_dist == ang_dist.min())[0])
if np.size(ang_dist) == 1:
good = 0
else:
good = np.min(np.where(ang_dist == ang_dist.min())[0])
indx = in_band[good]
result = observation_list[indx:] + observation_list[:indx]
return result
Expand Down
3 changes: 3 additions & 0 deletions rubin_sim/scheduler/features/conditions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
__all__ = ("Conditions",)

import warnings
from io import StringIO

import healpy as hp
Expand Down Expand Up @@ -393,6 +394,8 @@ def mjd(self):
@mjd.setter
def mjd(self, value):
# If MJD is changed, everything else is no longer valid, so re-init
if self.mjd is not None:
warnings.warn("Changing MJD and resetting all attributes.")
self._init_attributes()
self._mjd = value

Expand Down
8 changes: 6 additions & 2 deletions rubin_sim/scheduler/surveys/long_gap_survey.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,14 @@ def _schedule_obs(self, observations):
"""

# Only match if we have completed the second of a pair and are in most recent night.
# ugh, stupid np.where doesn't support using scalars anymore
if np.size(observations) == 1:
need_to_observe = (observations["note"] == self.blob_survey.survey_note + ", b") & (
if (observations["note"] == self.blob_survey.survey_note + ", b") & (
observations["night"] == np.max(observations["night"])
)
):
need_to_observe = np.array([0])
else:
need_to_observe = np.array([])
else:
need_to_observe = np.where(
(observations["note"] == self.blob_survey.survey_note + ", b")
Expand Down

0 comments on commit fe0f567

Please sign in to comment.