Skip to content

Commit

Permalink
swap Footprint object to take list of filters rather than dict
Browse files Browse the repository at this point in the history
  • Loading branch information
yoachim committed Dec 19, 2024
1 parent fa8b65a commit 3fa1cc6
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions rubin_scheduler/scheduler/utils/footprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,24 +357,34 @@ class Footprint:
Parameters
----------
mjd_start : float
The MJD the survey starts on
sun_ra_start : float
The RA of the sun at the start of the survey (radians)
mjd_start : `float`
The MJD the survey starts on.
sun_ra_start : `float`
The RA of the sun at the start of the survey (radians).
filters : `list` of `str`
The filter names to include in the footprint.
period : `float`
Used for setting the phase of step_func (days). Default 365.25.
step_func : `BasePixelEvolution`
Callable class that determines how the footprint evolves with time.
Default of None will result in `StepLine` being used.
"""

def __init__(
self,
mjd_start,
sun_ra_start=0,
nside=DEFAULT_NSIDE,
filters=None,
filters=["u", "g", "r", "i", "z", "y"],
period=365.25,
step_func=None,
):
if filters is None:
filters = {"u": 0, "g": 1, "r": 2, "i": 3, "z": 4, "y": 5}
# Dict to map filtername to array index.
if not isinstance(filters, dict):
filters_dict = {}
for i, filtername in enumerate(filters):
filters_dict[filtername] = i
filters = filters_dict
self.period = period
self.nside = nside
if step_func is None:
Expand Down Expand Up @@ -458,9 +468,12 @@ def __call__(self, mjd, norm=True):


class ConstantFootprint(Footprint):
def __init__(self, nside=DEFAULT_NSIDE, filters=None):
if filters is None:
filters = {"u": 0, "g": 1, "r": 2, "i": 3, "z": 4, "y": 5}
def __init__(self, nside=DEFAULT_NSIDE, filters=["u", "g", "r", "i", "z", "y"]):
if not isinstance(filters, dict):
filters_dict = {}
for i, filtername in enumerate(filters):
filters_dict[filtername] = i
filters = filters_dict
self.nside = nside
self.filters = filters
self.npix = hp.nside2npix(nside)
Expand Down

0 comments on commit 3fa1cc6

Please sign in to comment.