-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
version 1.7.0
- Loading branch information
Showing
3 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
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 @@ | ||
from .pointing import Pointing |
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,75 @@ | ||
from __future__ import annotations | ||
import logging | ||
from typing import Any, Optional, Union, TYPE_CHECKING, Dict | ||
|
||
from pyobs.interfaces import ITelescope | ||
from pyobs.robotic.scripts import Script | ||
from pyobs.utils.skyflats.pointing import SkyFlatsBasePointing | ||
|
||
if TYPE_CHECKING: | ||
from pyobs.robotic import TaskSchedule, TaskArchive, TaskRunner | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
class Pointing(Script): | ||
"""Script for pointing the telescope for flats.""" | ||
|
||
def __init__( | ||
self, | ||
telescope: Union[str, ITelescope], | ||
pointing: Union[Dict[str, Any], SkyFlatsBasePointing], | ||
**kwargs: Any, | ||
): | ||
"""Init a new Pointing script. | ||
Args: | ||
telescope: telescope to move. | ||
pointing: pointing class to use. | ||
""" | ||
if "configuration" not in kwargs: | ||
kwargs["configuration"] = {} | ||
Script.__init__(self, **kwargs) | ||
|
||
# store modules | ||
self._telescope = telescope | ||
self._pointing = self.get_object(pointing) | ||
|
||
async def can_run(self) -> bool: | ||
"""Whether this config can currently run. | ||
Returns: | ||
True if script can run now. | ||
""" | ||
|
||
# get modules | ||
try: | ||
tel = await self.comm.proxy(self._telescope, ITelescope) | ||
except ValueError: | ||
return False | ||
|
||
# we need a camera | ||
if not await tel.is_ready(): | ||
return False | ||
|
||
# seems alright | ||
return True | ||
|
||
async def run( | ||
self, | ||
task_runner: TaskRunner, | ||
task_schedule: Optional[TaskSchedule] = None, | ||
task_archive: Optional[TaskArchive] = None, | ||
) -> None: | ||
"""Run script. | ||
Raises: | ||
InterruptedError: If interrupted | ||
""" | ||
# get modules | ||
log.info("Getting proxy for telescope...") | ||
telescope = await self.comm.proxy(self._telescope, ITelescope) | ||
|
||
# point | ||
await self._pointing(telescope) | ||
log.info("Finished pointing telescope.") | ||
|
||
|
||
__all__ = ["Pointing"] |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[tool.poetry] | ||
name = "pyobs-core" | ||
packages = [{ include = "pyobs" }] | ||
version = "1.6.15" | ||
version = "1.7.0" | ||
description = "robotic telescope software" | ||
authors = ["Tim-Oliver Husser <[email protected]>"] | ||
license = "MIT" | ||
|