Skip to content

Commit

Permalink
Merge branch 'release/v0.1.0'
Browse files Browse the repository at this point in the history
* release/v0.1.0: (23 commits)
  Release v0.1.0.
  Add version history.
  In conda recipe, run rs_download_data before unit tests to download rubin_sim data.
  Pin version of rubin_sim in conda recipe.
  Add Jenkinsfile for conda build.
  Add unit tests for MakeScheduler class.
  Add MakeScheduler class to help create scheduler configurations for AuxTel from list of Target/Tiles.
  Add type checking utility.
  Add Tiles class to define groups of targets for the scheduler.
  Add Target class to define single targets for the scheduler.
  Add unit tests for utils module.
  Add auxtel tiles definition.
  Add utils modules with utilities to get the path to the data dir and to read auxtel tiles.
  Ignore qa and type checking in conf.py
  Add basis functions for survey utility,
  Add unit tests for basis functions utilities.
  Add init file to define auxtel module.
  Add utility function to generate image survey for auxtel.
  Add auxtel utilities to generate basis functions for image, cwfs and spectroscopic surveys.
  Update package init to deal with version import.
  ...
  • Loading branch information
tribeiro committed Jun 7, 2022
2 parents e7e704e + 5519660 commit 52b8617
Show file tree
Hide file tree
Showing 23 changed files with 3,117 additions and 11 deletions.
2 changes: 2 additions & 0 deletions Jenkinsfile.conda
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@Library('JenkinsShared')_
CondaPipeline([], "ts-fbs-utils", "lsst.ts.fbs.utils", "noarch")
3 changes: 0 additions & 3 deletions bin.src/SConscript

This file was deleted.

36 changes: 36 additions & 0 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{% set data= load_setup_py_data() %}
package:
name: ts-fbs-utils
version: {{ data.get('version') }}

source:
path: ../

build:
noarch: python
script: python -m pip install --no-deps --ignore-installed .

test:
requires:
- ts-conda-build =0.3
- rubin-sim =0.8.0a2
source_files:
- python
- tests
- setup.cfg
- pyproject.toml
commands:
- rs_download_data
- pytest -vsx tests/

requirements:
host:
- python
- pip
- setuptools_scm
- setuptools
run:
- python
- setuptools
- setuptools_scm
- rubin-sim 0.8.0a2
4 changes: 2 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
https://developer.lsst.io/stack/building-single-package-docs.html
"""

from documenteer.conf.pipelinespkg import *
from documenteer.conf.pipelinespkg import * # type: ignore # noqa


project = "ts_fbs_utils"
html_theme_options["logotext"] = project
html_theme_options["logotext"] = project # type: ignore # noqa
html_title = project
html_short_title = project
9 changes: 9 additions & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ You can find Jira issues for this module under the `ts_fbs_utils <https://jira.l
.. .. TODO: Add an item to this toctree for each script reference topic in the scripts subdirectory.
.. _Version_History:

Version History
===============

.. toctree::
version-history
:maxdepth: 1

.. .. toctree::
.. :maxdepth: 1
Expand Down
10 changes: 10 additions & 0 deletions doc/version_history.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. _Version_History:

===============
Version History
===============

v0.1.0
------

* Initial version of Feature Based Scheduler Utility package focused on AuxTel.
45 changes: 45 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[build-system]
requires = [ "setuptools", "setuptools_scm" ]
build-backend = "setuptools.build_meta"

[project]
name = "ts-fbs-utils"
description = "Utility package for the Feature Based Scheduler."
license = { text = "GPL" }
classifiers = [ "Programming Language :: Python :: 3" ]
urls = { documentation = "https://ts-scheduler.lsst.io", repository = "https://github.com/lsst-ts/ts_fbs_utils" }
dynamic = [ "version" ]

[tools.setuptools]
package-data = {"" = "*.csv"}

[tool.setuptools.dynamic]
version = { attr = "setuptools_scm.get_version" }

[tool.setuptools.packages.find]
where = [ "python" ]

[tool.setuptools_scm]
write_to = "python/lsst/ts/fbs/utils/version.py"
write_to_template = """
# Generated by setuptools_scm
__all__ = ["__version__"]
__version__ = "{version}"
"""

[tool.pytest.ini_options]
addopts = "--black --flake8 --mypy --ignore-glob=*/version.py"
flake8-ignore = ["E133", "E203", "E226", "E228", "N802", "N803", "N806", "N812", "N813", "N815", "N816", "W503"]
flake8-max-line-length = 110
flake8-max-doc-length = 79
asyncio_mode = "auto"

[tool.mypy]
disallow_untyped_defs = "True"
ignore_missing_imports = "True"
exclude = "version.py"

[project.optional-dependencies]
dev = [
"documenteer[pipelines]",
]
17 changes: 15 additions & 2 deletions python/lsst/ts/fbs/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of ts_fbs_utils.
#
# Developed for the LSST Data Management System.
# Developed for the Vera Rubin Observatory Telescope and Site System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
Expand All @@ -19,4 +19,17 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

from .version import * # Generated by sconsUtils
import typing

if typing.TYPE_CHECKING:
__version__ = "?"
else:
try:
from .version import *
except ImportError:
__version__ = "?"

from .utils import *
from .target import *
from .tiles import *
from .typing_utils import *
24 changes: 24 additions & 0 deletions python/lsst/ts/fbs/utils/auxtel/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This file is part of ts_fbs_utils.
#
# Developed for the Vera Rubin Observatory Telescope and Site System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
# for details of code ownership.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

from .basis_functions import *
from .surveys import *
from .make_scheduler import *
189 changes: 189 additions & 0 deletions python/lsst/ts/fbs/utils/auxtel/basis_functions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
# This file is part of ts_fbs_utils.
#
# Developed for the Vera Rubin Observatory Telescope and Site System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
# for details of code ownership.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

__all__ = [
"get_basis_functions_image_survey",
"get_basis_functions_cwfs_survey",
"get_basis_functions_spectroscopic_survey",
]

import typing
from rubin_sim.scheduler import basis_functions


def get_basis_functions_image_survey(
ra: float,
nside: int,
note: str,
ha_limits: typing.List[typing.Tuple[float, float]],
wind_speed_maximum: float,
nobs_reference: int,
nobs_survey: int,
note_interest: str,
) -> typing.List[basis_functions.Base_basis_function]:
"""Get the basis functions for the image survey.
Parameters
----------
ra : `float`
Right Ascention for the observavtions, in degrees.
nside : `int`
The nside value for the healpix grid.
note : `str`
A identifier string to be attached to the survey observations.
ha_limits : 'list` of `float`
A two-element list with the hour angle limits, in hours.
wind_speed_maximu : `float`
Maximum wind speed tolerated for the observations of the survey,
in m/s.
nobs_reference : `int`
Reference number of observations.
nobs_survey : `int`
Total number of observations expected for the survey.
note_interest : `str`
A substring that maps to surveys to be accounted for agains the
reference number of observations.
Returns
-------
`list` of `basis_functions.Base_basis_function`
"""

sun_alt_limit = -12.0

return [
basis_functions.Not_twilight_basis_function(sun_alt_limit=sun_alt_limit),
basis_functions.Hour_Angle_limit_basis_function(RA=ra, ha_limits=ha_limits),
basis_functions.Slewtime_basis_function(nside=nside, filtername="g"),
basis_functions.Slewtime_basis_function(nside=nside, filtername="r"),
basis_functions.Slewtime_basis_function(nside=nside, filtername="i"),
basis_functions.Moon_avoidance_basis_function(nside=nside),
basis_functions.Zenith_shadow_mask_basis_function(
min_alt=20.0, max_alt=85.0, nside=nside
),
basis_functions.VisitGap(note=note, gap_min=1440.0),
basis_functions.AvoidDirectWind(
wind_speed_maximum=wind_speed_maximum, nside=nside
),
basis_functions.BalanceVisits(
nobs_reference=nobs_reference, note_survey=note, note_interest=note_interest
),
basis_functions.RewardNObsSequence(
n_obs_survey=nobs_survey,
note_survey=note,
nside=nside,
),
]


def get_basis_functions_cwfs_survey(
nside: int,
note: str,
time_gap_min: float,
wind_speed_maximum: float,
) -> typing.List[basis_functions.Base_basis_function]:
"""Get the basis functions for the CWFS survey.
This is a background survey that will activate at specific points in time
to make sure the telescope optics are aligned.
Parameters
----------
nside : `int`
The nside value for the healpix grid.
note : `str`
A identifier string to be attached to the survey observations.
time_gap_min : `float`
The gap between observations of this survey, in minutes.
wind_speed_maximu : `float`
Maximum wind speed tolerated for the observations of the survey,
in m/s.
Returns
-------
`list` of `basis_functions.Base_basis_function`
"""
sun_alt_limit = -12.0

return [
basis_functions.Not_twilight_basis_function(sun_alt_limit=sun_alt_limit),
basis_functions.Slewtime_basis_function(nside=nside, filtername="g"),
basis_functions.Slewtime_basis_function(nside=nside, filtername="r"),
basis_functions.Slewtime_basis_function(nside=nside, filtername="i"),
basis_functions.Moon_avoidance_basis_function(nside=nside),
basis_functions.Zenith_shadow_mask_basis_function(
min_alt=28.0, max_alt=85.0, nside=nside
),
basis_functions.VisitGap(note=note, gap_min=time_gap_min),
basis_functions.AvoidDirectWind(
wind_speed_maximum=wind_speed_maximum, nside=nside
),
]


def get_basis_functions_spectroscopic_survey(
ra: float,
nside: int,
note: str,
ha_limits: typing.List[typing.Tuple[float, float]],
wind_speed_maximum: float,
gap_min: float,
) -> typing.List[basis_functions.Base_basis_function]:
"""Get basis functions for spectroscopic survey.
Parameters
----------
ra : `float`
RA of the target, in degrees.
nside : `int`
Healpix maps resolution.
note : `str`
Survey note.
ha_limits : `list` of `tuple` of (`float`, `float`)
Hour angle limits, in hours.
wind_speed_maximum : `float`
Maximum wind speed, in m/s.
gap_min : `float`
Gap between subsequent observations, in minutes.
Returns
-------
list of basis_functions.Base_basis_function
List of basis functions.
"""
sun_alt_limit = -12.0

return [
basis_functions.Not_twilight_basis_function(sun_alt_limit=sun_alt_limit),
basis_functions.Hour_Angle_limit_basis_function(RA=ra, ha_limits=ha_limits),
basis_functions.M5_diff_basis_function(nside=nside),
basis_functions.Slewtime_basis_function(nside=nside, filtername="g"),
basis_functions.Slewtime_basis_function(nside=nside, filtername="r"),
basis_functions.Slewtime_basis_function(nside=nside, filtername="i"),
basis_functions.Moon_avoidance_basis_function(nside=nside),
basis_functions.Zenith_shadow_mask_basis_function(
min_alt=28.0, max_alt=85.0, nside=nside
),
basis_functions.VisitGap(note=note, gap_min=gap_min),
basis_functions.AvoidDirectWind(
wind_speed_maximum=wind_speed_maximum, nside=nside
),
]
Loading

0 comments on commit 52b8617

Please sign in to comment.