Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version 0.1.19 #6

Merged
merged 2 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions config/asi_cam_runner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ width = 4144
height = 2822
bins = 1
types = "raw16"
# use this if you wish to use
# the camera's cooler also
# when the camera is inactive
InactiveCoolerOn = false
InactivateTargetTemp = 15
51 changes: 49 additions & 2 deletions nightskycam/asicams/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Module defining the AsiCamera, the camera used by the AsiCameraRunner.
"""

from typing import Union, Optional
from typing import Any, Dict, List, Tuple

import nptyping as npt
Expand Down Expand Up @@ -73,6 +74,53 @@ def cooler_on(self) -> None:
def cooler_off(self) -> None:
self._camera.set_control("CoolerOn", 0)

def _configure_inactive(self, config: Config) -> List[str]:
# not active, but maybe the configuration set a key
# "InactiveTargetTemp" which set the desired temperature
# when inactive. In this case cooler should be 'on' and
# TargetTemp set.

if "InactiveCoolerOn" not in config:
self.cooler_off()
return []
inactive_cooler_on = config["InactiveCoolerOn"]
if not type(inactive_cooler_on) == bool:
self.cooler_off()
return [
str(
f"unexpected value for key 'InactiveCoolerOn', expected bool, got {inactive_cooler_on}"
)
]
if not inactive_cooler_on:
self.cooler_off()
return []
try:
inactive_target_temp = config["InactiveTargetTemp"]
except KeyError:
self.cooler_off()
return [
str(
"InactiveCoolerOn has been set, but the corresponding InactiveTargetTemp key is missing"
)
]
if not type(inactive_target_temp) == int:
self.cooler_off()
return [
str(
f"unexpected value for key 'InactiveTargetTemp', expected int, got {inactive_target_temp}"
)
]
try:
self._camera.set_control("TargetTemp", inactive_target_temp)
self.cooler_on()
return []
except Exception as e:
return [
str(
f"failed to set the camera temperature to {inactive_target_temp}: {e}"
)
]

def configure(self, active: bool, config: Config) -> List[str]:
"""
Configure the camera (controllables and ROI) based on
Expand All @@ -84,8 +132,7 @@ def configure(self, active: bool, config: Config) -> List[str]:
if not issues)
"""
if not active:
self.cooler_off()
return []
return self._configure_inactive(config)
issues: List[str] = []
for key in _controllables:
try:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "nightskycam"
version = "0.1.18"
version = "0.1.19"
description = "taking pictures at night"
authors = ["Vincent Berenz <vberenz@tuebingen.mpg.de>"]
packages = [{ include = "nightskycam" }]
Expand Down
Loading