diff --git a/pyobs/modules/camera/basecamera.py b/pyobs/modules/camera/basecamera.py index 59a2a484..24640667 100644 --- a/pyobs/modules/camera/basecamera.py +++ b/pyobs/modules/camera/basecamera.py @@ -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, @@ -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 """ @@ -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 @@ -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" diff --git a/pyproject.toml b/pyproject.toml index ced8aaa0..0843b54d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 "] license = "MIT"