Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephParsons committed Jul 18, 2024
1 parent f71ab6e commit 767a12a
Show file tree
Hide file tree
Showing 32 changed files with 1,313 additions and 32 deletions.
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ config.log
*.pyc
*_wrap.cc
*Lib.py
*egg
*egg-info
ospl-info.log

# Built by sconsUtils
version.py
Expand All @@ -19,3 +22,20 @@ 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
.flake8
.isort.cfg
.mypy.ini
.ruff.toml
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: false
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 2023 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-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)
5 changes: 5 additions & 0 deletions bin/run_mtreflector
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env python

from lsst.ts.mtreflector import run_mtreflector

run_mtreflector()
48 changes: 48 additions & 0 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{% 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.3
- ts-xml {{ xml_version }}
- ts-utils
- ts-salobj {{ salobj_version }}
- labjack-ljm
- ts-ess-common
- ts-ess-labjack
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.3
run:
- python {{ python }}
- ts-xml
- ts-salobj
- ts-utils
- ts-ess-common
- ts-ess-labjack
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"
12 changes: 12 additions & 0 deletions doc/version_history.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.. py:currentmodule:: lsst.ts.mtreflector
.. _lsst.ts.version_history:

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

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,10 @@
# 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 .mt_reflector import *
from .mt_reflector_csc import *
87 changes: 87 additions & 0 deletions python/lsst/ts/mtreflector/config_schema.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# 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__ = ["CONFIG_SCHEMA"]

import yaml

# $schema: http://json-schema.org/draft-07/schema#
# $id: https://github.com/lsst-ts/
# ts_mtreflector/python/lsst/ts/mtreflector/config_schema.py
CONFIG_SCHEMA = yaml.safe_load(
"""
schema: http://json-schema.org/draft-07/schema#
title: MTReflector v1
description: Schema for MTReflector
type: object
properties:
device_type:
description: LabJack model
type: string
default: T7
connection_type:
description: Connection type
type: string
default: TCP
identifier:
description: >-
LabJack indentifier:
* A host name or IP address if connection_type = TCP or WIFI
* A serial number if connection_type = USB
* For testing in an environment with only one LabJack you may use ANY
type: string
topics:
description: >-
Array of batches of relevant sensors.
type: array
minItems: 1
items:
types: object
minItems: 1
properties:
topic_name:
description: Casual name for the sensor cluster.
type: string
sensor_name:
description: Value for the sensor_name field of the topic.
type: string
location:
description: >-
Location of sensors. A comma-separated list, with one item per non-null channel_name.
type: string
channel_name:
description: >-
LabJack channel names, in order of the field array.
type: string
required:
- topic_name
- sensor_name
- location
- channel_name
additionalProperties: false
required:
- device_type
- connection_type
- identifier
- topics
additionalProperties: false
"""
)
Loading

0 comments on commit 767a12a

Please sign in to comment.