Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of reflector CSC #2

Merged
merged 5 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ config.log
*.pyc
*_wrap.cc
*Lib.py
*egg
*egg-info
ospl-info.log
ospl-*.log

# Built by sconsUtils
version.py
Expand All @@ -19,3 +23,16 @@ pytest_session.txt
.cache/
.pytest_cache
.coverage
.pre-commit-config.yaml
.clang-format
.flake8
.isort.cfg
.mypy.ini
.ruff.toml
towncrier.toml

# Jupyter Notebook
*.ipynb

# VsCode
*.vscode
10 changes: 10 additions & 0 deletions .ts_pre_commit_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
black: true
check-xml: true
check-yaml: true
clang-format: false
flake8: true
format-xmllint: false
isort: true
mypy: true
ruff: true
towncrier: true
2 changes: 1 addition & 1 deletion COPYRIGHT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Copyright 2024 Association of Universities for Research in Astronomy, Inc. (AURA)
Copyright 2024-25 Association of Universities for Research in Astronomy, Inc. (AURA)
2 changes: 2 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@Library('JenkinsShared')_
DevelopPipeline(name: "ts_mtreflector", module_name: "lsst.ts.mtreflector", idl_names: ["MTReflector"], extra_packages: ["lsst-ts/ts_ess_labjack", "lsst-ts/ts_ess_common"])
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_config_mtcalsys"], "ts-mtreflector", "lsst.ts.mtreflector", "noarch")
10 changes: 4 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
############
ts_reflector
############
###############
ts_mtreflector
###############



.. Add a brief (few sentence) description of what this package provides.
This CSC is used to connect to a labjack and operate the reflector
2 changes: 1 addition & 1 deletion SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- python -*-
from lsst.sconsUtils import scripts
# Python-only package
scripts.BasicSConstruct("ts_reflector", disableCc=True, noCfgFile=True)
scripts.BasicSConstruct("ts_mtreflector", disableCc=True, noCfgFile=True)
3 changes: 0 additions & 3 deletions bin.src/SConscript

This file was deleted.

26 changes: 26 additions & 0 deletions bin/run_mtreflector
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env python
wvreeven marked this conversation as resolved.
Show resolved Hide resolved

# This file is part of ts_mtreflector.
#
# Developed for the Vera C. Rubin Observatory Telescope and Site Systems.
# 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 lsst.ts.mtreflector import run_mtreflector

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

source:
path: ../

build:
noarch: python
script: {{ PYTHON }} -m pip install --no-deps --ignore-installed .
entry_points:
- run_mtreflector = lsst.ts.mtreflector:run_mtreflector

test:
requires:
- ts-conda-build =0.4
- ts-xml {{ xml_version }}
- ts-salobj {{ salobj_version }}
source_files:
- pyproject.toml
- python
- tests
commands:
- pytest

requirements:
host:
- python {{ python }}
- pip
- setuptools_scm
- setuptools
build:
- python {{ python }}
- setuptools_scm
- setuptools
- ts-conda-build =0.4
run:
- python {{ python }}
- ts-xml
- ts-salobj
- labjack-ljm =1.21
13 changes: 9 additions & 4 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@
https://developer.lsst.io/stack/building-single-package-docs.html
"""

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


project = "ts_reflector"
html_theme_options["logotext"] = project
project = "ts_mtreflector"
html_theme_options["logotext"] = project # type: ignore # noqa
html_title = project
html_short_title = project

intersphinx_mapping["ts_ess_common"] = ("https://ts-ess-common.lsst.io", None) # type: ignore # noqa
intersphinx_mapping["ts_salobj"] = ("https://ts-salobj.lsst.io", None) # type: ignore # noqa
intersphinx_mapping["ts_utils"] = ("https://ts-utils.lsst.io", None) # type: ignore # noqa
intersphinx_mapping["ts_ess_labjack"] = ("https://ts-ess-labjack.lsst.io", None) # type: ignore # noqa
28 changes: 14 additions & 14 deletions doc/index.rst
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
.. py:currentmodule:: lsst.ts.reflector
.. py:currentmodule:: lsst.ts.mtreflector

.. _lsst.ts.reflector:
.. _lsst.ts.mtreflector:

#################
lsst.ts.reflector
#################
####################
lsst.ts.mtreflector
####################

.. Paragraph that describes what this Python module does and links to related modules and frameworks.

.. .. _lsst.ts.reflector-using:
.. .. _lsst.ts.mtreflector-using:

.. Using lsst.ts.reflector
.. =======================
.. Using lsst.ts.mtreflector
.. ==========================

.. toctree linking to topics related to using the module's APIs.

.. .. toctree::
.. :maxdepth: 1

.. _lsst.ts.reflector-contributing:
.. _lsst.ts.mtreflector-contributing:

Contributing
============

``lsst.ts.reflector`` is developed at https://github.com/lsst-ts/ts_reflector.
You can find Jira issues for this module under the `ts_reflector <https://jira.lsstcorp.org/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20ts_reflector>`_ component.
``lsst.ts.mtreflector`` is developed at https://github.com/lsst-ts/ts_mtreflector.
You can find Jira issues for this module under the `ts_mtreflector <https://jira.lsstcorp.org/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20ts_mtreflector>`_ component.

.. If there are topics related to developing this module (rather than using it), link to this from a toctree placed here.

.. .. toctree::
.. :maxdepth: 1

.. .. _lsst.ts.reflector-scripts:
.. .. _lsst.ts.mtreflector-scripts:

.. Script reference
.. ================
Expand All @@ -41,11 +41,11 @@ You can find Jira issues for this module under the `ts_reflector <https://jira.l
.. .. toctree::
.. :maxdepth: 1

.. .. _lsst.ts.reflector-pyapi:
.. .. _lsst.ts.mtreflector-pyapi:

Python API reference
====================

.. automodapi:: lsst.ts.reflector
.. automodapi:: lsst.ts.mtreflector
:no-main-docstr:
:no-inheritance-diagram:
4 changes: 2 additions & 2 deletions doc/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# List of names of Python modules in this package.
# For each module there is a corresponding module doc subdirectory.
modules:
- "lsst.ts.reflector"
- "lsst.ts.mtreflector"

# Name of the static content directories (subdirectories of `_static`).
# Static content directories are usually named after the package.
# Most packages do not need a static content directory (leave commented out).
# statics:
# - "_static/ts_reflector"
# - "_static/ts_mtreflector"
1 change: 1 addition & 0 deletions doc/news/DM-48352.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed conda recipe to build correctly.
1 change: 1 addition & 0 deletions doc/news/DM-48352.misc.1.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Simplified handle_summary_state in csc.py.
1 change: 1 addition & 0 deletions doc/news/DM-48352.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed mtreflector prefix from module names.
14 changes: 14 additions & 0 deletions doc/version_history.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.. py:currentmodule:: lsst.ts.mtreflector

.. _lsst.ts.version_history:

###############
Version History
###############

.. towncrier release notes start

v0.1.0
------

* The first release.
35 changes: 33 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
# Pytest configuration required to prevent pytest from looking for
# configurations in parent directories. Can be empty.
[build-system]
requires = [ "setuptools", "setuptools_scm" ]
build-backend = "setuptools.build_meta"

[project]
name = "ts_mtreflector"
description = "CSC to operate switching of Reflector for calibration."
license = { text = "GPL" }
classifiers = [ "Programming Language :: Python :: 3" ]
urls = { documentation = "https://ts-mtreflector.lsst.io", repository = "https://github.com/lsst-ts/ts_mtreflector" }
dynamic = [ "version" ]

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

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

[project.scripts]
run_mtreflector = "lsst.ts.mtreflector:run_mtreflector"

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

[tool.pytest.ini_options]
asyncio_mode = "auto"

[project.optional-dependencies]
dev = ["documenteer[pipelines]"]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is part of ts_reflector.
# This file is part of ts_mtreflector.
#
# Developed for the LSST Data Management System.
# This product includes software developed by the LSST Project
Expand All @@ -19,4 +19,11 @@
# 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
try:
from .version import * # Generated by sconsUtils
except ModuleNotFoundError:
__version__ = "?"

from .config_schema import *
from .controller import *
from .csc import *
48 changes: 48 additions & 0 deletions python/lsst/ts/mtreflector/commander.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This file is part of ts_mtreflector.
#
# Developed for the Vera C. Rubin Observatory Telescope and Site Systems.
# 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__ = ["command_mtreflector"]

import asyncio

from lsst.ts import salobj


class MTReflectorCommander(salobj.CscCommander):
"""MTReflector commander.

Parameters
----------
enable : bool
Enable the CSC when first connecting to it?
"""

def __init__(self, enable: bool) -> None:
super().__init__(
name="MTReflector",
index=0,
enable=enable,
)


def command_mtreflector() -> None:
"""Run the MTReflector commander."""
asyncio.run(MTReflectorCommander.amain(index=None))
Loading
Loading