From 40aa423fdde41f0c5548a9826c37a63ee88aff1f Mon Sep 17 00:00:00 2001 From: Igor Suarez-Sola Date: Fri, 20 Sep 2024 14:23:02 -0700 Subject: [PATCH 1/2] Add UnparkDome SAL Script --- .../scripts/maintel/mtdome/unpark_dome.py | 27 ++++++++ .../maintel/mtdome/__init__.py | 1 + .../maintel/mtdome/unpark_dome.py | 62 +++++++++++++++++++ tests/test_maintel_unpark_dome.py | 38 ++++++++++++ 4 files changed, 128 insertions(+) create mode 100755 python/lsst/ts/standardscripts/data/scripts/maintel/mtdome/unpark_dome.py create mode 100644 python/lsst/ts/standardscripts/maintel/mtdome/unpark_dome.py create mode 100644 tests/test_maintel_unpark_dome.py diff --git a/python/lsst/ts/standardscripts/data/scripts/maintel/mtdome/unpark_dome.py b/python/lsst/ts/standardscripts/data/scripts/maintel/mtdome/unpark_dome.py new file mode 100755 index 000000000..d41059bb9 --- /dev/null +++ b/python/lsst/ts/standardscripts/data/scripts/maintel/mtdome/unpark_dome.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# This file is part of ts_standardscripts +# +# Developed for the LSST 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 . + +import asyncio + +from lsst.ts.standardscripts.maintel.mtdome import UnparkDome + +asyncio.run(UnparkDome.amain()) diff --git a/python/lsst/ts/standardscripts/maintel/mtdome/__init__.py b/python/lsst/ts/standardscripts/maintel/mtdome/__init__.py index e2fc400c7..bfc5d7265 100644 --- a/python/lsst/ts/standardscripts/maintel/mtdome/__init__.py +++ b/python/lsst/ts/standardscripts/maintel/mtdome/__init__.py @@ -24,3 +24,4 @@ from .enable_dome_following import * from .park_dome import * from .slew_dome import * +from .unpark_dome import * diff --git a/python/lsst/ts/standardscripts/maintel/mtdome/unpark_dome.py b/python/lsst/ts/standardscripts/maintel/mtdome/unpark_dome.py new file mode 100644 index 000000000..0b24edd2b --- /dev/null +++ b/python/lsst/ts/standardscripts/maintel/mtdome/unpark_dome.py @@ -0,0 +1,62 @@ +# This file is part of ts_standardscripts +# +# Developed for the LSST 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 . + +__all__ = ["UnparkDome"] + +from lsst.ts import salobj +from lsst.ts.observatory.control.maintel.mtcs import MTCS + + +class UnparkDome(salobj.BaseScript): + """Unpark Dome for the MTDome. + + Parameters + ---------- + index : `int` + Index of Script SAL component. + + Notes + ----- + **Checkpoints** + + None + + """ + + def __init__(self, index): + super().__init__(index=index, descr="Unpark Dome for the MTDome.") + + self.mtcs = None + + @classmethod + def get_schema(cls): + # This script does not require any configuration + return None + + async def configure(self, config): + if self.mtcs is None: + self.mtcs = MTCS(domain=self.domain, log=self.log) + + def set_metadata(self, metadata): + metadata.duration = 5.0 + + async def run(self): + await self.mtcs.unpark_dome() diff --git a/tests/test_maintel_unpark_dome.py b/tests/test_maintel_unpark_dome.py new file mode 100644 index 000000000..d243c6a29 --- /dev/null +++ b/tests/test_maintel_unpark_dome.py @@ -0,0 +1,38 @@ +# This file is part of ts_standardscripts +# +# Developed for the LSST 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 . + +import unittest + +from lsst.ts import standardscripts +from lsst.ts.standardscripts.maintel.mtdome import UnparkDome + + +class TestUnparkDome( + standardscripts.BaseScriptTestCase, unittest.IsolatedAsyncioTestCase +): + async def basic_make_script(self, index): + self.script = UnparkDome(index=index) + return self.script + + async def test_executable(self): + scripts_dir = standardscripts.get_scripts_dir() + script_path = scripts_dir / "maintel" / "mtdome" / "unpark_dome.py" + await self.check_executable(script_path) From 639cd3727620268dd2925e4369e20f8d53490e14 Mon Sep 17 00:00:00 2001 From: Igor Suarez-Sola Date: Fri, 20 Sep 2024 14:27:07 -0700 Subject: [PATCH 2/2] Add news fragment --- doc/news/DM-45610.feature.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/news/DM-45610.feature.rst diff --git a/doc/news/DM-45610.feature.rst b/doc/news/DM-45610.feature.rst new file mode 100644 index 000000000..f1fb21fa3 --- /dev/null +++ b/doc/news/DM-45610.feature.rst @@ -0,0 +1 @@ +Add ``UnparkDome`` SAL Script for ``maintel``.