Skip to content

Commit

Permalink
v1.6.14
Browse files Browse the repository at this point in the history
version 1.6.14
  • Loading branch information
thusser authored Dec 11, 2023
2 parents c2bf24c + 733e017 commit e8dc2ae
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
21 changes: 15 additions & 6 deletions pyobs/modules/camera/basecamera.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ def __init__(
fits_headers: Optional[Dict[str, Any]] = None,
centre: Optional[Tuple[float, float]] = None,
rotation: float = 0.0,
flip: bool = False,
flip: Optional[bool] = None,
flip_x: bool = False,
flip_y: bool = False,
filenames: str = "/cache/pyobs-{DAY-OBS|date:}-{FRAMENUM|string:04d}-{IMAGETYP|type}00.fits.gz",
fits_namespaces: Optional[List[str]] = None,
**kwargs: Any,
Expand All @@ -57,7 +59,9 @@ def __init__(
fits_headers: Additional FITS headers.
centre: (x, y) tuple of camera centre.
rotation: Rotation east of north.
flip: Whether or not to flip the image along its first axis.
flip: Whether or not to flip the image along its first axis (deprecated, use flip_x).
flip_x: Whether or not to flip the image along its first axis.
flip_y: Whether or not to flip the image along its second axis.
filenames: Template for file naming.
fits_namespaces: List of namespaces for FITS headers that this camera should request
"""
Expand All @@ -76,7 +80,8 @@ def __init__(
log.warning("No comm module given, will not be able to signal new images!")

# store
self._flip = flip
self._flip_x = flip if flip is not None else flip_x
self._flip_y = flip_y
self._exposure_time: float = 0.0
self._image_type = ImageType.OBJECT

Expand Down Expand Up @@ -258,13 +263,17 @@ async def __expose(self, exposure_time: float, image_type: ImageType, broadcast:
header_futures_after = await self.request_fits_headers(before=False)

# flip it?
if self._flip:
if self._flip_x or self._flip_y:
# do we have three dimensions in array? need this for deciding which axis to flip
is_3d = len(image.data.shape) == 3

# flip image and make contiguous again
flipped: NDArray[Any] = np.flip(image.data, axis=1 if is_3d else 0)
image.data = np.ascontiguousarray(flipped)
tmp = image.data
if self._flip_x:
tmp = np.flip(tmp, axis=1 if is_3d else 0)
if self._flip_y:
tmp = np.flip(tmp, axis=2 if is_3d else 1)
image.data = np.ascontiguousarray(tmp)

# add HDU name
image.header["EXTNAME"] = "SCI"
Expand Down
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.6.13"
version = "1.6.14"
description = "robotic telescope software"
authors = ["Tim-Oliver Husser <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit e8dc2ae

Please sign in to comment.