Skip to content

Commit

Permalink
v1.4.13
Browse files Browse the repository at this point in the history
version 1.4.13
  • Loading branch information
thusser authored Sep 12, 2023
2 parents c51fe1b + 5e286e5 commit de5bd8e
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 32 deletions.
6 changes: 6 additions & 0 deletions pyobs/images/processors/astrometry/dotnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,17 @@ async def __call__(self, image: Image) -> Image:
# get catalog
if img.catalog is None:
log.warning("No catalog found in image.")
if self.exceptions:
raise exc.ImageError("No catalog found in image.")
return image
cat = img.catalog[["x", "y", "flux", "peak"]].to_pandas().dropna()

# nothing?
if cat is None or len(cat) < 3:
log.warning("Not enough sources for astrometry.")
img.header["WCSERR"] = 1
if self.exceptions:
raise exc.ImageError("Not enough sources for astrometry.")
return img

# sort it, remove saturated stars and take N brightest sources
Expand All @@ -78,6 +82,8 @@ async def __call__(self, image: Image) -> Image:
if "CDELT1" not in img.header:
log.warning("No CDELT1 found in header.")
img.header["WCSERR"] = 1
if self.exceptions:
raise exc.ImageError("No CDELT1 found in header.")
return img

# build request data
Expand Down
13 changes: 0 additions & 13 deletions pyobs/modules/camera/basecamera.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,18 +425,5 @@ def set_biassec_trimsec(hdr: fits.Header, left: int, top: int, width: int, heigh
bottom_binned = np.ceil((is_top - hdr["YORGSUBF"]) / hdr["YBINNING"])
hdr["BIASSEC"] = ("[1:%d,1:%d]" % (hdr["NAXIS1"], bottom_binned), c1)

async def list_binnings(self, **kwargs: Any) -> List[Tuple[int, int]]:
"""List available binnings.
Returns:
List of available binnings as (x, y) tuples.
"""

warnings.warn(
"The default implementation for list_binnings() in BaseCamera will be removed in future versions",
DeprecationWarning,
)
return [(1, 1), (2, 2), (3, 3)]


__all__ = ["BaseCamera", "CameraException"]
11 changes: 10 additions & 1 deletion pyobs/modules/camera/dummycamera.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import glob
import logging
from datetime import datetime
from typing import Tuple, NamedTuple, Dict, Any, Optional, TYPE_CHECKING
from typing import Tuple, NamedTuple, Dict, Any, Optional, TYPE_CHECKING, List

from pyobs.interfaces import IWindow, IBinning, ICooling, IGain
from pyobs.modules.camera.basecamera import BaseCamera
Expand Down Expand Up @@ -192,6 +192,15 @@ async def set_window(self, left: int, top: int, width: int, height: int, **kwarg
log.info("Set window to %dx%d at %d,%d.", width, height, top, left)
self._camera.window = (left, top, width, height)

async def list_binnings(self, **kwargs: Any) -> List[Tuple[int, int]]:
"""List available binnings.
Returns:
List of available binnings as (x, y) tuples.
"""

return [(1, 1), (2, 2), (3, 3)]

async def get_binning(self, **kwargs: Any) -> Tuple[int, int]:
"""Returns the camera binning.
Expand Down
8 changes: 1 addition & 7 deletions pyobs/robotic/scripts/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import logging
from typing import Any, Dict, Optional, List

from pyobs.object import get_object
from pyobs.robotic import TaskRunner, TaskSchedule, TaskArchive
from pyobs.robotic.scripts import Script

Expand All @@ -25,12 +24,7 @@ def __init__(
Args:
scripts: list or dict of scripts to run in parallel.
"""
if "configuration" not in kwargs:
kwargs["configuration"] = {}
Script.__init__(self, **kwargs)

for script in scripts:
script["comm"] = self.comm
self.scripts = scripts

async def can_run(self) -> bool:
Expand All @@ -43,7 +37,7 @@ async def run(
task_archive: Optional[TaskArchive] = None,
) -> None:
tasks = [
asyncio.create_task(get_object(s, Script).run(task_runner, task_schedule, task_archive))
asyncio.create_task(self.get_object(s, Script).run(task_runner, task_schedule, task_archive))
for s in self.scripts
]
await asyncio.gather(*tasks)
Expand Down
4 changes: 2 additions & 2 deletions pyobs/robotic/scripts/script.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations
import logging
from typing import Any, TypeVar, Optional, List, Dict, TYPE_CHECKING
from typing import Any, TypeVar, Optional, List, Dict, TYPE_CHECKING, Union

from pyobs.object import Object

Expand All @@ -14,7 +14,7 @@


class Script(Object):
def __init__(self, configuration: Any, **kwargs: Any):
def __init__(self, configuration: Optional[Any], **kwargs: Any):
"""Init Script.
Args:
Expand Down
10 changes: 2 additions & 8 deletions pyobs/robotic/scripts/sequential.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import logging
from pyobs.modules.robotic import ScriptRunner
from typing import Any, Dict, Optional, Union, List
from typing import Any, Dict, Optional, List

from pyobs.object import get_object
from pyobs.robotic import TaskRunner, TaskSchedule, TaskArchive
Expand All @@ -24,12 +23,7 @@ def __init__(
Args:
script: list or dict of scripts to run in a sequence.
"""
if "configuration" not in kwargs:
kwargs["configuration"] = {}
Script.__init__(self, **kwargs)

for script in scripts:
script["comm"] = self.comm
self.scripts = scripts

async def can_run(self) -> bool:
Expand All @@ -42,7 +36,7 @@ async def run(
task_archive: Optional[TaskArchive] = None,
) -> None:
for s in self.scripts:
await get_object(s, Script).run(task_runner, task_schedule, task_archive)
await self.get_object(s, Script).run(task_runner, task_schedule, task_archive)


__all__ = ["SequentialRunner"]
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "pyobs-core"
packages = [{ include = "pyobs" }]
version = "1.4.12"
version = "1.4.13"
description = "robotic telescope software"
authors = ["Tim-Oliver Husser <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit de5bd8e

Please sign in to comment.