-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create files for the MoveRotator script
- Loading branch information
Showing
4 changed files
with
197 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
python/lsst/ts/standardscripts/data/scripts/maintel/mtrotator/move_rotator.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <https://www.gnu.org/licenses/>. | ||
|
||
import asyncio | ||
|
||
from lsst.ts.standardscripts.maintel.mtrotator import MoveRotator | ||
|
||
asyncio.run(MoveRotator.amain()) |
22 changes: 22 additions & 0 deletions
22
python/lsst/ts/standardscripts/maintel/mtrotator/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# 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 <https://www.gnu.org/licenses/>. | ||
|
||
from .move_rotator import MoveRotator |
104 changes: 104 additions & 0 deletions
104
python/lsst/ts/standardscripts/maintel/mtrotator/move_rotator.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# 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 <https://www.gnu.org/licenses/>. | ||
|
||
__all__ = ["EnableComCam"] | ||
|
||
import asyncio | ||
import warnings | ||
|
||
import yaml | ||
from lsst.ts.observatory.control.maintel.mtcs import MTCS, MTCSUsages | ||
|
||
from ...base_block_script import BaseBlockScript | ||
|
||
|
||
class MoveRotator(BaseBlockScript): | ||
"""Move the rotator to a given angle. It has the option of completing the | ||
script before the rotator reaches the desired angle. | ||
Parameters | ||
---------- | ||
index : `int` | ||
Index of Script SAL component. | ||
Notes | ||
----- | ||
**Checkpoints** | ||
- "Start moving rotator to {angle} degrees.": Start moving rotator. | ||
- "Stop script and keep rotator moving.": Stop script. | ||
- "Rotator reached {angle} degrees.": Rotator reached angle. | ||
""" | ||
|
||
def __init__(self, index: int, add_remotes: bool = True) -> None: | ||
super().__init__(index=index, descr="Move Rotator") | ||
|
||
mtcs_usage = None if add_remotes else MTCSUsages.DryTest | ||
|
||
self.mtcs = MTCS(self.domain, intended_usage=mtcs_usage, log=self.log) | ||
|
||
for comp in self.mtcs.components_attr: | ||
if comp not in ["mtrotator", "mtmount"]: | ||
setattr(self.mtcs.check, comp, False) | ||
|
||
self.rotator_time_per_angle = 5.0 # seconds per degree | ||
|
||
@classmethod | ||
def get_schema(cls): | ||
url = "https://github.com/lsst-ts/" | ||
path = ( | ||
"ts_standardscripts/blob/main/python/lsst/ts/standardscripts/" | ||
"maintel/mtrotator/move_rotator.py" | ||
) | ||
schema_yaml = f""" | ||
$schema: http://json-schema.org/draft-07/schema# | ||
$id: {url}{path} | ||
title: MoveRotator v1 | ||
description: Configuration for Maintel move rotator SAL Script. | ||
type: object | ||
properties: | ||
angle: | ||
description: final angle of the rotator. | ||
type: number | ||
minimum: -90 | ||
maximum: 90 | ||
wait_for_complete: | ||
description: >- | ||
whether wait for the rotator to reach the desired angle or | ||
complete the script before the rotator reaches the desired | ||
angle. | ||
type: boolean | ||
default: true | ||
required: | ||
- angle | ||
additionalProperties: false | ||
""" | ||
schema_dict = yaml.safe_load(schema_yaml) | ||
|
||
base_schema_dict = super().get_schema() | ||
|
||
for properties in base_schema_dict["properties"]: | ||
schema_dict["properties"][properties] = base_schema_dict["properties"][ | ||
properties | ||
] | ||
|
||
return schema_dict |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# 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 <https://www.gnu.org/licenses/>. | ||
|
||
import unittest | ||
|
||
from lsst.ts import standardscripts | ||
from lsst.ts.standardscripts.maintel.mtrotator import MoveRotator | ||
|
||
|
||
class TestMoveRotator( | ||
standardscripts.BaseScriptTestCase, unittest.IsolatedAsyncioTestCase | ||
): | ||
async def basic_make_script(self, index): | ||
self.script = MoveRotator(index=index, add_remotes=False) | ||
|
||
return (self.script,) | ||
|
||
async def test_executable(self): | ||
scripts_dir = standardscripts.get_scripts_dir() | ||
script_path = scripts_dir / "maintel" / "mtrotator" / "move_rotator.py" | ||
print(script_path) | ||
await self.check_executable(script_path) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |