Skip to content

Commit

Permalink
Merge pull request #2 from pyobs/develop
Browse files Browse the repository at this point in the history
v0.14
  • Loading branch information
thusser committed Nov 3, 2021
2 parents d244cc1 + 306b32a commit 205aaf0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
48 changes: 24 additions & 24 deletions pyobs_asi/asicamera.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from typing import List, Tuple, Any, Dict, Optional

import numpy as np
import zwoasi as asi
import zwoasi as asi # type: ignore

from pyobs.interfaces import ICamera, ICameraWindow, ICameraBinning, ICooling, IImageFormat
from pyobs.interfaces import ICamera, IWindow, IBinning, ICooling, IImageFormat
from pyobs.modules.camera.basecamera import BaseCamera
from pyobs.utils.enums import ImageFormat, ExposureStatus
from pyobs.images import Image
Expand All @@ -23,18 +23,18 @@
}


class AsiCamera(BaseCamera, ICamera, ICameraWindow, ICameraBinning, IImageFormat):
class AsiCamera(BaseCamera, ICamera, IWindow, IBinning, IImageFormat):
"""A pyobs module for ASI cameras."""
__module__ = 'pyobs_asi'

def __init__(self, camera: str, sdk: str = '/usr/local/lib/libASICamera2.so', *args, **kwargs):
def __init__(self, camera: str, sdk: str = '/usr/local/lib/libASICamera2.so', **kwargs: Any):
"""Initializes a new AsiCamera.
Args:
camera: Name of camera to use.
sdk: Path to .so file from ASI SDK.
"""
BaseCamera.__init__(self, *args, **kwargs)
BaseCamera.__init__(self, **kwargs)

# variables
self._camera_name = camera
Expand All @@ -47,7 +47,7 @@ def __init__(self, camera: str, sdk: str = '/usr/local/lib/libASICamera2.so', *a
self._binning = 1
self._image_format = ImageFormat.INT16

def open(self):
def open(self) -> None:
"""Open module."""
BaseCamera.open(self)

Expand Down Expand Up @@ -96,35 +96,35 @@ def open(self):
self._binning = self._camera.get_bin()
self._window = self._camera.get_roi()

def close(self):
def close(self) -> None:
"""Close the module."""
BaseCamera.close(self)

def get_full_frame(self, *args, **kwargs) -> Tuple[int, int, int, int]:
def get_full_frame(self, **kwargs: Any) -> Tuple[int, int, int, int]:
"""Returns full size of CCD.
Returns:
Tuple with left, top, width, and height set.
"""
return 0, 0, self._camera_info['MaxWidth'], self._camera_info['MaxHeight']

def get_window(self, *args, **kwargs) -> Tuple[int, int, int, int]:
def get_window(self, **kwargs: Any) -> Tuple[int, int, int, int]:
"""Returns the camera window.
Returns:
Tuple with left, top, width, and height set.
"""
return self._window

def get_binning(self, *args, **kwargs) -> Tuple[int, int]:
def get_binning(self, **kwargs: Any) -> Tuple[int, int]:
"""Returns the camera binning.
Returns:
Tuple with x and y.
"""
return self._binning, self._binning

def set_window(self, left: int, top: int, width: int, height: int, *args, **kwargs):
def set_window(self, left: int, top: int, width: int, height: int, **kwargs: Any) -> None:
"""Set the camera window.
Args:
Expand All @@ -139,7 +139,7 @@ def set_window(self, left: int, top: int, width: int, height: int, *args, **kwar
self._window = (left, top, width, height)
log.info('Setting window to %dx%d at %d,%d...', width, height, left, top)

def set_binning(self, x: int, y: int, *args, **kwargs):
def set_binning(self, x: int, y: int, **kwargs: Any) -> None:
"""Set the camera binning.
Args:
Expand All @@ -152,7 +152,7 @@ def set_binning(self, x: int, y: int, *args, **kwargs):
self._binning = x
log.info('Setting binning to %dx%d...', x, x)

def list_binnings(self, *args, **kwargs) -> List[Tuple[int, int]]:
def list_binnings(self, **kwargs: Any) -> List[Tuple[int, int]]:
"""List available binnings.
Returns:
Expand Down Expand Up @@ -289,7 +289,7 @@ def _expose(self, exposure_time: float, open_shutter: bool, abort_event: threadi
self._change_exposure_status(ExposureStatus.IDLE)
return image

def _abort_exposure(self):
def _abort_exposure(self) -> None:
"""Abort the running exposure. Should be implemented by derived class.
Raises:
Expand All @@ -301,18 +301,18 @@ def _abort_exposure(self):
class AsiCoolCamera(AsiCamera, ICooling):
"""A pyobs module for ASI cameras with cooling."""

def __init__(self, setpoint: int = -20, *args, **kwargs):
def __init__(self, setpoint: int = -20, **kwargs: Any):
"""Initializes a new AsiCoolCamera.
Args:
setpoint: Cooling temperature setpoint.
"""
AsiCamera.__init__(self, *args, **kwargs)
AsiCamera.__init__(self, **kwargs)

# variables
self._temp_setpoint = setpoint

def open(self):
def open(self) -> None:
"""Open module."""
AsiCamera.open(self)

Expand All @@ -323,7 +323,7 @@ def open(self):
# activate cooling
self.set_cooling(True, self._temp_setpoint)

def get_cooling_status(self, *args, **kwargs) -> Tuple[bool, float, float]:
def get_cooling_status(self, **kwargs: Any) -> Tuple[bool, float, float]:
"""Returns the current status for the cooling.
Returns:
Expand All @@ -343,7 +343,7 @@ def get_cooling_status(self, *args, **kwargs) -> Tuple[bool, float, float]:
power = self._camera.get_control_value(asi.ASI_COOLER_POWER_PERC)[0]
return enabled, temp, power

def get_temperatures(self, *args, **kwargs) -> dict:
def get_temperatures(self, **kwargs: Any) -> Dict[str, float]:
"""Returns all temperatures measured by this module.
Returns:
Expand All @@ -359,7 +359,7 @@ def get_temperatures(self, *args, **kwargs) -> dict:
'CCD': self._camera.get_control_value(asi.ASI_TEMPERATURE)[0] / 10.
}

def set_cooling(self, enabled: bool, setpoint: float, *args, **kwargs):
def set_cooling(self, enabled: bool, setpoint: float, **kwargs: Any) -> None:
"""Enables/disables cooling and sets setpoint.
Args:
Expand All @@ -381,9 +381,9 @@ def set_cooling(self, enabled: bool, setpoint: float, *args, **kwargs):
self._camera.set_control_value(asi.ASI_COOLER_ON, 1)
else:
log.info('Disabling cooling...')
self._camera.set_control_value(asi.ASI_COOLER_ON, 1)
self._camera.set_control_value(asi.ASI_COOLER_ON, 0)

def set_image_format(self, format: ImageFormat, *args, **kwargs):
def set_image_format(self, format: ImageFormat, **kwargs: Any) -> None:
"""Set the camera image format.
Args:
Expand All @@ -396,15 +396,15 @@ def set_image_format(self, format: ImageFormat, *args, **kwargs):
raise ValueError('Unsupported image format.')
self._image_format = format

def get_image_format(self, *args, **kwargs) -> ImageFormat:
def get_image_format(self, **kwargs: Any) -> ImageFormat:
"""Returns the camera image format.
Returns:
Current image format.
"""
return self._image_format

def list_image_formats(self, *args, **kwargs) -> List[str]:
def list_image_formats(self, **kwargs: Any) -> List[str]:
"""List available image formats.
Returns:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='pyobs-asi',
version='0.13',
version='0.14',
description='pyobs component for ASI cameras',
author='Tim-Oliver Husser',
author_email='thusser@uni-goettingen.de',
Expand Down

0 comments on commit 205aaf0

Please sign in to comment.