Skip to content

Commit f9b378b

Browse files
committed
Add minimal working example science program field survey
1 parent 6178b5a commit f9b378b

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed

python/lsst/ts/fbs/utils/maintel/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@
2121

2222
from .basis_functions import *
2323
from .make_scheduler import *
24+
from .make_fieldsurvey_scheduler import *
2425
from .surveys import *
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# This file is part of ts_fbs_utils.
2+
#
3+
# Developed for the Vera Rubin Observatory Telescope and Site System.
4+
# This product includes software developed by the LSST Project
5+
# (https://www.lsst.org).
6+
# See the COPYRIGHT file at the top-level directory of this distribution
7+
# for details of code ownership.
8+
#
9+
# This program is free software: you can redistribute it and/or modify
10+
# it under the terms of the GNU General Public License as published by
11+
# the Free Software Foundation, either version 3 of the License, or
12+
# (at your option) any later version.
13+
#
14+
# This program is distributed in the hope that it will be useful,
15+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
# GNU General Public License for more details.
18+
#
19+
# You should have received a copy of the GNU General Public License
20+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
21+
22+
__all__ = ["MakeFieldSurveyScheduler"]
23+
24+
import typing
25+
26+
from rubin_scheduler.scheduler.schedulers import CoreScheduler
27+
from rubin_scheduler.scheduler.surveys import FieldSurvey
28+
29+
from ..data import field_survey_centers
30+
31+
32+
class MakeFieldSurveyScheduler:
33+
"""Class to construct Feature Based Schedulers consisting of an ensemble of field surveys."""
34+
35+
def __init__(
36+
self,
37+
nside: int = 32,
38+
) -> None:
39+
40+
self.nside = 32
41+
self.surveys = []
42+
43+
44+
def _load_candidate_fields(self) -> typing.Dict:
45+
"""Docstring."""
46+
name_fields, ra_fields, dec_fields = zip(*field_survey_centers.fields)
47+
fields = {}
48+
for name, ra, dec in zip(name_fields, ra_fields, dec_fields):
49+
fields[name] = {"RA": ra, "dec": dec}
50+
return fields
51+
52+
53+
def add_field_surveys(
54+
self,
55+
field_names: typing.List[str],
56+
**kwargs,
57+
) -> None:
58+
"""Add a set of field surveys to the scheduler configuration."""
59+
60+
# Assert that survey_name is not included among the kwargs
61+
62+
basis_functions = []
63+
64+
fields = self._load_candidate_fields()
65+
66+
for field_name in field_names:
67+
RA = fields[field_name]["RA"]
68+
dec = fields[field_name]["dec"]
69+
70+
# Consider adding flexibility to add a prefix or suffix
71+
survey_name = field_name
72+
73+
self.surveys.append(
74+
FieldSurvey(
75+
basis_functions,
76+
RA,
77+
dec,
78+
survey_name=survey_name,
79+
**kwargs,
80+
)
81+
)
82+
83+
84+
def add_cwfs_survey(self) -> None:
85+
"""Add curvature wavefront sensing survey."""
86+
pass
87+
88+
89+
def get_scheduler(self) -> typing.Tuple[int, CoreScheduler]:
90+
"""Construct feature based scheduler for ensemble of field surveys."""
91+
92+
scheduler = CoreScheduler(self.surveys, nside=self.nside)
93+
94+
return self.nside, scheduler

0 commit comments

Comments
 (0)