Skip to content

Commit

Permalink
Update sunAltBasisFunction + test_nside
Browse files Browse the repository at this point in the history
  • Loading branch information
rhiannonlynne committed Sep 16, 2024
1 parent 2ab880d commit 2d075a2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,6 @@ def __init__(self, alt_limit=-12.1):

def check_feasibility(self, conditions):
result = True
if conditions.sunAlt > self.alt_limit:
if conditions.sun_alt > self.alt_limit:
result = False
return result
12 changes: 9 additions & 3 deletions tests/scheduler/test_baseline.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import rubin_scheduler.utils as utils
from rubin_scheduler.data import get_data_dir
from rubin_scheduler.scheduler import sim_runner
from rubin_scheduler.scheduler.basis_functions import SunAltLimitBasisFunction
from rubin_scheduler.scheduler.example import example_scheduler, simple_greedy_survey, simple_pairs_survey
from rubin_scheduler.scheduler.model_observatory import ModelObservatory
from rubin_scheduler.scheduler.schedulers import CoreScheduler
Expand Down Expand Up @@ -93,12 +94,17 @@ def test_nside(self):
"""
mjd_start = utils.survey_start_mjd()
nside = 64
survey_length = 3.0 # days
survey_length = 2.0 # days

# Add an avoidance of twilight+ for the pairs surveys -
# this ensures greedy survey will have some time to operate
pairs_surveys = [
simple_pairs_survey(filtername="g", filtername2="r", nside=nside),
simple_pairs_survey(filtername="i", filtername2="z", nside=nside),
]
for survey in pairs_surveys:
survey.basis_functions.append(SunAltLimitBasisFunction(alt_limit=-22))
survey.basis_weights.append(0)
greedy_surveys = [
simple_greedy_survey(filtername="z", nside=nside),
]
Expand All @@ -113,9 +119,9 @@ def test_nside(self):
assert "simple pair 30, iz, a" in observations["scheduler_note"]
assert "simple pair 30, iz, b" in observations["scheduler_note"]
# Make sure some greedy executed
assert "greedy z" in observations["scheduler_note"]
assert "simple greedy z" in observations["scheduler_note"]
# Make sure lots of observations executed
assert observations.size > 1000
assert observations.size > 800
# Make sure nothing tried to look through the earth
assert np.min(observations["alt"]) > 0

Expand Down

0 comments on commit 2d075a2

Please sign in to comment.