pyobs-sbig 2.0.0.dev4__tar.gz → 2.0.0.dev6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/PKG-INFO +2 -3
- pyobs_sbig-2.0.0.dev6/README.md +81 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/pyproject.toml +2 -3
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/src/pyobs_sbig/sbigcamera.py +116 -25
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/src/pyobs_sbig/sbigfiltercamera.py +38 -21
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/uv.lock +13 -8
- pyobs_sbig-2.0.0.dev4/README.md +0 -49
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/.github/workflows/pypi.yml +0 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/.github/workflows/ruff.yml +0 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/.pre-commit-config.yaml +0 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/.readthedocs.yml +0 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/CHANGELOG.rst +0 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/CMakeLists.txt +0 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/LICENSE +0 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/docs/Makefile +0 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/docs/make.bat +0 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/docs/requirements.txt +0 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/docs/source/_static/pyobs.gif +0 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/docs/source/conf.py +0 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/docs/source/index.rst +0 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/src/pyobs_sbig/__init__.py +0 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/src/pyobs_sbig/gui.py +0 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/src/pyobs_sbig/sbig6303e.py +0 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/src/pyobs_sbig/sbigudrv.pxd +0 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/src/pyobs_sbig/sbigudrv.pyx +0 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/src/sbigudrv/csbigcam.cpp +0 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/src/sbigudrv/csbigcam.h +0 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/src/sbigudrv/csbigimg.cpp +0 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/src/sbigudrv/csbigimg.h +0 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/src/sbigudrv/lpardrv.h +0 -0
- {pyobs_sbig-2.0.0.dev4 → pyobs_sbig-2.0.0.dev6}/src/sbigudrv/sbigudrv.h +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyobs-sbig
|
|
3
|
-
Version: 2.0.0.
|
|
3
|
+
Version: 2.0.0.dev6
|
|
4
4
|
Summary: pyobs module for SBIG cameras
|
|
5
5
|
Author-Email: Tim-Oliver Husser <thusser@uni-goettingen.de>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -9,7 +9,6 @@ Requires-Dist: astropy<8,>=7.0.1
|
|
|
9
9
|
Requires-Dist: numpy<3,>=2.2.5
|
|
10
10
|
Requires-Dist: pyobs-core<3,>=2.0.0.dev6
|
|
11
11
|
Provides-Extra: gui
|
|
12
|
-
Requires-Dist:
|
|
13
|
-
Requires-Dist: pyside6>=6.11.0; extra == "gui"
|
|
12
|
+
Requires-Dist: pyobs-core[gui]<3,>=2.0.0.dev6; extra == "gui"
|
|
14
13
|
Requires-Dist: qasync>=0.28.0; extra == "gui"
|
|
15
14
|
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
SBIG module for *pyobs*
|
|
2
|
+
========================
|
|
3
|
+
|
|
4
|
+
This is a [pyobs](https://www.pyobs.org) module for SBIG cameras.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Install SBIG driver
|
|
8
|
+
--------------------
|
|
9
|
+
Download the SBIG Universal Driver package from ftp://ftp.sbig.com/pub/devsw/LinuxDevKit.tar.gz and follow
|
|
10
|
+
the installation instructions in the README.txt.
|
|
11
|
+
|
|
12
|
+
**Note:** The files in the *src/pyobs_sbig/sbigudrv/* directory are part of this archive, and the *CSBIGCam*
|
|
13
|
+
class has been modified to include a *Readout()* method.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
Install *pyobs-sbig*
|
|
17
|
+
---------------------
|
|
18
|
+
Clone the repository:
|
|
19
|
+
|
|
20
|
+
git clone https://github.com/pyobs/pyobs-sbig.git
|
|
21
|
+
cd pyobs-sbig
|
|
22
|
+
|
|
23
|
+
Install it with [uv](https://docs.astral.sh/uv/):
|
|
24
|
+
|
|
25
|
+
uv sync
|
|
26
|
+
|
|
27
|
+
Alternatively, with plain `venv`/`pip`:
|
|
28
|
+
|
|
29
|
+
python3 -m venv .venv
|
|
30
|
+
source .venv/bin/activate
|
|
31
|
+
pip install .
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
Configuration
|
|
35
|
+
-------------
|
|
36
|
+
The base class for all SBIG cameras is *SbigCamera*, which can be used for camera types without an integrated
|
|
37
|
+
filter wheel and adds a single new parameter:
|
|
38
|
+
|
|
39
|
+
setpoint:
|
|
40
|
+
The initial setpoint in degrees Celsius for the cooling of the camera.
|
|
41
|
+
|
|
42
|
+
A basic module configuration would look like this:
|
|
43
|
+
|
|
44
|
+
class: pyobs_sbig.SbigCamera
|
|
45
|
+
name: SBIG camera
|
|
46
|
+
setpoint: -10
|
|
47
|
+
|
|
48
|
+
For cameras with an integrated filter wheel, use *SbigFilterCamera* instead, which adds:
|
|
49
|
+
|
|
50
|
+
filter_wheel:
|
|
51
|
+
Model of the filter wheel, e.g. CFW10.
|
|
52
|
+
filter_names:
|
|
53
|
+
List of filter names (default: numbered 1-10).
|
|
54
|
+
|
|
55
|
+
class: pyobs_sbig.SbigFilterCamera
|
|
56
|
+
name: SBIG camera
|
|
57
|
+
setpoint: -10
|
|
58
|
+
filter_wheel: CFW10
|
|
59
|
+
filter_names: [Red, Green, Blue, Clear, Halpha]
|
|
60
|
+
|
|
61
|
+
There is also a special implementation for SBIG-6303E cameras, *Sbig6303eCamera*, which takes the same parameters
|
|
62
|
+
as *SbigFilterCamera*.
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
GUI
|
|
66
|
+
---
|
|
67
|
+
For testing a camera without a full *pyobs* setup, install the optional `gui` extra:
|
|
68
|
+
|
|
69
|
+
uv sync --extra gui
|
|
70
|
+
|
|
71
|
+
and run:
|
|
72
|
+
|
|
73
|
+
uv run sbig-gui
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
Dependencies
|
|
77
|
+
------------
|
|
78
|
+
* [pyobs-core](https://github.com/pyobs/pyobs-core) for the core functionality.
|
|
79
|
+
* [Cython](https://cython.org/) for wrapping the SBIG Universal Driver.
|
|
80
|
+
* [Astropy](http://www.astropy.org/) for FITS file handling.
|
|
81
|
+
* [NumPy](http://www.numpy.org/) for array handling.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "pyobs-sbig"
|
|
3
|
-
version = "2.0.0.
|
|
3
|
+
version = "2.0.0.dev6"
|
|
4
4
|
description = "pyobs module for SBIG cameras"
|
|
5
5
|
authors = [{ name = "Tim-Oliver Husser", email = "thusser@uni-goettingen.de" }]
|
|
6
6
|
requires-python = ">=3.11,<3.15"
|
|
@@ -13,8 +13,7 @@ dependencies = [
|
|
|
13
13
|
|
|
14
14
|
[project.optional-dependencies]
|
|
15
15
|
gui = [
|
|
16
|
-
"
|
|
17
|
-
"pyside6>=6.11.0",
|
|
16
|
+
"pyobs-core[gui]>=2.0.0.dev6,<3",
|
|
18
17
|
"qasync>=0.28.0",
|
|
19
18
|
]
|
|
20
19
|
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
import logging
|
|
3
3
|
import math
|
|
4
|
+
import threading
|
|
5
|
+
import time
|
|
6
|
+
from collections.abc import Callable
|
|
4
7
|
from datetime import UTC, datetime
|
|
5
|
-
from typing import Any
|
|
8
|
+
from typing import Any, TypeVar, cast
|
|
6
9
|
|
|
7
10
|
import numpy as np
|
|
8
11
|
from pyobs.images import Image
|
|
@@ -12,10 +15,22 @@ from pyobs.interfaces.ICooling import CoolingState
|
|
|
12
15
|
from pyobs.interfaces.ITemperatures import SensorReading, TemperaturesState
|
|
13
16
|
from pyobs.interfaces.IWindow import WindowCapabilities, WindowState
|
|
14
17
|
from pyobs.modules.camera.basecamera import BaseCamera
|
|
18
|
+
from pyobs.utils import exceptions as exc
|
|
15
19
|
from pyobs.utils.enums import ExposureStatus
|
|
16
20
|
|
|
17
21
|
log = logging.getLogger(__name__)
|
|
18
22
|
|
|
23
|
+
_T = TypeVar("_T")
|
|
24
|
+
|
|
25
|
+
# SBIG SDK calls are blocking and are made directly on the event loop thread (see
|
|
26
|
+
# _run_blocking). If the camera has gone unresponsive, they can hang indefinitely, so they're
|
|
27
|
+
# bounded with a timeout rather than let a single dead camera freeze the whole module.
|
|
28
|
+
_SDK_CALL_TIMEOUT = 5.0
|
|
29
|
+
|
|
30
|
+
# the exposure-wait loop's own timeout needs to cover the actual exposure time plus some margin
|
|
31
|
+
# for overhead -- exposure_time alone would be too tight.
|
|
32
|
+
_EXPOSURE_WAIT_MARGIN = 30.0
|
|
33
|
+
|
|
19
34
|
|
|
20
35
|
class SbigCamera(BaseCamera, ICamera, IWindow, IBinning, ICooling, ITemperatures, IAbortable):
|
|
21
36
|
"""A pyobs module for SBIG cameras."""
|
|
@@ -50,6 +65,55 @@ class SbigCamera(BaseCamera, ICamera, IWindow, IBinning, ICooling, ITemperatures
|
|
|
50
65
|
# background task for polling cooling/temperature
|
|
51
66
|
self.add_background_task(self._poll_cooling)
|
|
52
67
|
|
|
68
|
+
@staticmethod
|
|
69
|
+
async def _run_blocking(func: Callable[[], None], timeout: float = _SDK_CALL_TIMEOUT) -> bool:
|
|
70
|
+
"""Run a blocking SBIG SDK call in a daemon thread, so a hung call can't freeze the module.
|
|
71
|
+
|
|
72
|
+
A plain executor isn't used here, since its worker threads are non-daemon and Python joins
|
|
73
|
+
them on interpreter shutdown -- a hung call would then just move the freeze to process exit.
|
|
74
|
+
|
|
75
|
+
Returns:
|
|
76
|
+
True if func completed within timeout, False if it's still running in the background.
|
|
77
|
+
"""
|
|
78
|
+
loop = asyncio.get_running_loop()
|
|
79
|
+
future: asyncio.Future[None] = loop.create_future()
|
|
80
|
+
|
|
81
|
+
def _wrapper() -> None:
|
|
82
|
+
try:
|
|
83
|
+
func()
|
|
84
|
+
finally:
|
|
85
|
+
loop.call_soon_threadsafe(future.set_result, None)
|
|
86
|
+
|
|
87
|
+
threading.Thread(target=_wrapper, daemon=True).start()
|
|
88
|
+
try:
|
|
89
|
+
await asyncio.wait_for(future, timeout=timeout)
|
|
90
|
+
return True
|
|
91
|
+
except TimeoutError:
|
|
92
|
+
return False
|
|
93
|
+
|
|
94
|
+
async def _run_blocking_or_raise(self, func: Callable[[], _T], timeout: float = _SDK_CALL_TIMEOUT) -> _T:
|
|
95
|
+
"""Run a blocking SBIG SDK call in a thread, returning its result or re-raising what it raised.
|
|
96
|
+
|
|
97
|
+
Unlike _run_blocking(), this also carries the callable's return value/exception back to the
|
|
98
|
+
caller -- several SBIG calls here drive control flow via their return value or a raised
|
|
99
|
+
ValueError (e.g. establishing the link), which a bare fire-and-forget thread call would
|
|
100
|
+
otherwise silently lose.
|
|
101
|
+
"""
|
|
102
|
+
outcome: list[Any] = []
|
|
103
|
+
|
|
104
|
+
def _wrapper() -> None:
|
|
105
|
+
try:
|
|
106
|
+
outcome.append(func())
|
|
107
|
+
except BaseException as e:
|
|
108
|
+
outcome.append(e)
|
|
109
|
+
|
|
110
|
+
if not await self._run_blocking(_wrapper, timeout=timeout):
|
|
111
|
+
raise TimeoutError(f"Timed out waiting for SBIG SDK call after {timeout}s.")
|
|
112
|
+
value = outcome[0]
|
|
113
|
+
if isinstance(value, BaseException):
|
|
114
|
+
raise value
|
|
115
|
+
return cast(_T, value)
|
|
116
|
+
|
|
53
117
|
async def open(self) -> None:
|
|
54
118
|
"""Open module.
|
|
55
119
|
|
|
@@ -60,17 +124,24 @@ class SbigCamera(BaseCamera, ICamera, IWindow, IBinning, ICooling, ITemperatures
|
|
|
60
124
|
|
|
61
125
|
# open driver
|
|
62
126
|
log.info("Opening SBIG driver...")
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
127
|
+
|
|
128
|
+
def _connect() -> None:
|
|
129
|
+
try:
|
|
130
|
+
self._cam.establish_link()
|
|
131
|
+
except ValueError as e:
|
|
132
|
+
raise ValueError(f"Could not establish link: {e}")
|
|
133
|
+
|
|
134
|
+
await self._run_blocking_or_raise(_connect)
|
|
67
135
|
|
|
68
136
|
# cooling
|
|
69
137
|
await self.set_cooling(self._setpoint is not None, self._setpoint)
|
|
70
138
|
|
|
71
139
|
# get full frame
|
|
72
|
-
|
|
73
|
-
|
|
140
|
+
def _get_full_frame() -> tuple[int, int, int, int]:
|
|
141
|
+
self._cam.binning = (1, 1)
|
|
142
|
+
return self._cam.full_frame
|
|
143
|
+
|
|
144
|
+
self._full_frame = await self._run_blocking_or_raise(_get_full_frame)
|
|
74
145
|
self._window = self._full_frame
|
|
75
146
|
|
|
76
147
|
# publish capabilities and initial state
|
|
@@ -144,26 +215,36 @@ class SbigCamera(BaseCamera, ICamera, IWindow, IBinning, ICooling, ITemperatures
|
|
|
144
215
|
log.info("Starting exposure with for %.2f seconds...", exposure_time)
|
|
145
216
|
date_obs = datetime.now(UTC).strftime("%Y-%m-%dT%H:%M:%S.%f")
|
|
146
217
|
|
|
147
|
-
|
|
148
|
-
|
|
218
|
+
def _start() -> None:
|
|
219
|
+
# init image
|
|
220
|
+
self._img.image_can_close = False
|
|
221
|
+
|
|
222
|
+
# set exposure time, window and binning
|
|
223
|
+
self._cam.exposure_time = exposure_time
|
|
224
|
+
self._cam.window = window
|
|
225
|
+
self._cam.binning = binning
|
|
149
226
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
self._cam.window = window
|
|
153
|
-
self._cam.binning = binning
|
|
227
|
+
# start exposure
|
|
228
|
+
self._cam.start_exposure(self._img, open_shutter)
|
|
154
229
|
|
|
155
|
-
|
|
156
|
-
self._cam.start_exposure(self._img, open_shutter)
|
|
230
|
+
await self._run_blocking_or_raise(_start)
|
|
157
231
|
|
|
158
|
-
# wait for it
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
232
|
+
# wait for it -- runs the whole poll loop as a single blocking call (see _run_blocking),
|
|
233
|
+
# rather than polling has_exposure_finished() every 10ms directly on the event loop
|
|
234
|
+
def _wait() -> bool:
|
|
235
|
+
while not self._cam.has_exposure_finished():
|
|
236
|
+
if abort_event.is_set():
|
|
237
|
+
return True
|
|
238
|
+
time.sleep(0.01)
|
|
239
|
+
return False
|
|
240
|
+
|
|
241
|
+
exposure_timeout = exposure_time + _EXPOSURE_WAIT_MARGIN
|
|
242
|
+
aborted = await self._run_blocking_or_raise(_wait, timeout=exposure_timeout)
|
|
243
|
+
if aborted:
|
|
244
|
+
raise exc.AbortedError("Exposure aborted.")
|
|
164
245
|
|
|
165
246
|
# finish exposure
|
|
166
|
-
self._cam.end_exposure
|
|
247
|
+
await self._run_blocking_or_raise(self._cam.end_exposure)
|
|
167
248
|
|
|
168
249
|
# wait for readout
|
|
169
250
|
log.info("Exposure finished, reading out...")
|
|
@@ -180,7 +261,10 @@ class SbigCamera(BaseCamera, ICamera, IWindow, IBinning, ICooling, ITemperatures
|
|
|
180
261
|
data = self._img.data
|
|
181
262
|
|
|
182
263
|
# temp & cooling
|
|
183
|
-
|
|
264
|
+
def _get_cooling() -> tuple[Any, float, float, Any]:
|
|
265
|
+
return self._cam.get_cooling()
|
|
266
|
+
|
|
267
|
+
_, temp, setpoint, _ = await self._run_blocking_or_raise(_get_cooling)
|
|
184
268
|
|
|
185
269
|
# create FITS image and set header
|
|
186
270
|
img = Image(data)
|
|
@@ -246,9 +330,12 @@ class SbigCamera(BaseCamera, ICamera, IWindow, IBinning, ICooling, ITemperatures
|
|
|
246
330
|
log.info("Disabling cooling and setting setpoint to 20°C...")
|
|
247
331
|
|
|
248
332
|
# do it
|
|
249
|
-
|
|
333
|
+
def _set() -> None:
|
|
250
334
|
self._cam.set_cooling(enabled, setpoint)
|
|
251
335
|
|
|
336
|
+
async with self._lock_active:
|
|
337
|
+
await self._run_blocking_or_raise(_set)
|
|
338
|
+
|
|
252
339
|
# publish state (power unknown until next poll)
|
|
253
340
|
await self.comm.set_state(ICooling, CoolingState(setpoint=setpoint, power=None, enabled=enabled))
|
|
254
341
|
|
|
@@ -256,8 +343,12 @@ class SbigCamera(BaseCamera, ICamera, IWindow, IBinning, ICooling, ITemperatures
|
|
|
256
343
|
"""Background task: periodically reads cooling status and publishes ICooling and ITemperatures state."""
|
|
257
344
|
while True:
|
|
258
345
|
try:
|
|
346
|
+
|
|
347
|
+
def _get() -> tuple[bool, float, float, float]:
|
|
348
|
+
return self._cam.get_cooling()
|
|
349
|
+
|
|
259
350
|
async with self._lock_active:
|
|
260
|
-
enabled, temp, setpoint, power = self.
|
|
351
|
+
enabled, temp, setpoint, power = await self._run_blocking_or_raise(_get)
|
|
261
352
|
await self.comm.set_state(
|
|
262
353
|
ICooling, CoolingState(setpoint=setpoint, power=round(power * 100), enabled=enabled)
|
|
263
354
|
)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
import logging
|
|
3
|
+
import time
|
|
3
4
|
from typing import Any
|
|
4
5
|
|
|
5
6
|
from pyobs.events import FilterChangedEvent
|
|
@@ -8,6 +9,7 @@ from pyobs.interfaces import IFilters, IReady
|
|
|
8
9
|
from pyobs.interfaces.IFilters import FiltersCapabilities, FilterState
|
|
9
10
|
from pyobs.interfaces.IReady import ReadyState
|
|
10
11
|
from pyobs.mixins import MotionStatusMixin
|
|
12
|
+
from pyobs.utils import exceptions as exc
|
|
11
13
|
from pyobs.utils.enums import MotionStatus
|
|
12
14
|
from pyobs.utils.threads import LockWithAbort
|
|
13
15
|
|
|
@@ -15,6 +17,10 @@ from .sbigcamera import SbigCamera
|
|
|
15
17
|
|
|
16
18
|
log = logging.getLogger(__name__)
|
|
17
19
|
|
|
20
|
+
# the filter-wheel wait loop's own timeout, since a physical filter change can legitimately take
|
|
21
|
+
# longer than SbigCamera's default SDK-call timeout.
|
|
22
|
+
_FILTER_WAIT_TIMEOUT = 30.0
|
|
23
|
+
|
|
18
24
|
|
|
19
25
|
class SbigFilterCamera(MotionStatusMixin, SbigCamera, IFilters):
|
|
20
26
|
"""A pyobs module for SBIG cameras."""
|
|
@@ -61,10 +67,14 @@ class SbigFilterCamera(MotionStatusMixin, SbigCamera, IFilters):
|
|
|
61
67
|
# set filter wheel model
|
|
62
68
|
if self.filter_wheel != FilterWheelModel.UNKNOWN:
|
|
63
69
|
log.info("Initialising filter wheel...")
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
|
|
71
|
+
def _set_wheel() -> None:
|
|
72
|
+
try:
|
|
73
|
+
self._cam.set_filter_wheel(self.filter_wheel)
|
|
74
|
+
except ValueError as e:
|
|
75
|
+
raise ValueError(f"Could not set filter wheel: {e}")
|
|
76
|
+
|
|
77
|
+
await self._run_blocking_or_raise(_set_wheel)
|
|
68
78
|
|
|
69
79
|
# open camera (connects to hardware, publishes IWindow/IBinning states)
|
|
70
80
|
await SbigCamera.open(self)
|
|
@@ -86,7 +96,7 @@ class SbigFilterCamera(MotionStatusMixin, SbigCamera, IFilters):
|
|
|
86
96
|
|
|
87
97
|
# query and publish current filter position
|
|
88
98
|
try:
|
|
89
|
-
self._position, _ = self._cam.get_filter_position_and_status
|
|
99
|
+
self._position, _ = await self._run_blocking_or_raise(self._cam.get_filter_position_and_status)
|
|
90
100
|
except (ValueError, Exception):
|
|
91
101
|
pass
|
|
92
102
|
await self.comm.set_state(IFilters, FilterState(filter=self._filter_names[self._position]))
|
|
@@ -127,7 +137,7 @@ class SbigFilterCamera(MotionStatusMixin, SbigCamera, IFilters):
|
|
|
127
137
|
filter_name: Name of filter to set.
|
|
128
138
|
|
|
129
139
|
Raises:
|
|
130
|
-
|
|
140
|
+
InvalidArgumentError: If filter_name is unknown.
|
|
131
141
|
NotImplementedError: If camera doesn't have a filter wheel.
|
|
132
142
|
"""
|
|
133
143
|
from .sbigudrv import FilterWheelModel, FilterWheelStatus
|
|
@@ -139,10 +149,10 @@ class SbigFilterCamera(MotionStatusMixin, SbigCamera, IFilters):
|
|
|
139
149
|
# reverse dict and search for name
|
|
140
150
|
filters = {y: x for x, y in self._filter_names.items()}
|
|
141
151
|
if filter_name not in filters:
|
|
142
|
-
raise
|
|
152
|
+
raise exc.InvalidArgumentError(f"Unknown filter: {filter_name}")
|
|
143
153
|
|
|
144
154
|
# there already?
|
|
145
|
-
position, status = self._cam.get_filter_position_and_status
|
|
155
|
+
position, status = await self._run_blocking_or_raise(self._cam.get_filter_position_and_status)
|
|
146
156
|
if position == filters[filter_name] and status == FilterWheelStatus.IDLE:
|
|
147
157
|
log.info("Filter changed.")
|
|
148
158
|
return
|
|
@@ -154,24 +164,31 @@ class SbigFilterCamera(MotionStatusMixin, SbigCamera, IFilters):
|
|
|
154
164
|
async with LockWithAbort(self._lock_motion, self._abort_motion):
|
|
155
165
|
# set it
|
|
156
166
|
log.info("Changing filter to %s...", filter_name)
|
|
157
|
-
|
|
167
|
+
target = filters[filter_name]
|
|
168
|
+
|
|
169
|
+
def _set_filter() -> None:
|
|
170
|
+
self._cam.set_filter(target)
|
|
158
171
|
|
|
159
|
-
|
|
160
|
-
while True:
|
|
161
|
-
# break, if wheel is idle and filter is set
|
|
162
|
-
position, status = self._cam.get_filter_position_and_status()
|
|
163
|
-
if position == filters[filter_name] and status == FilterWheelStatus.IDLE:
|
|
164
|
-
break
|
|
172
|
+
await self._run_blocking_or_raise(_set_filter)
|
|
165
173
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
174
|
+
# wait for it -- runs the whole poll loop as a single blocking call (see
|
|
175
|
+
# SbigCamera._run_blocking), rather than polling get_filter_position_and_status()
|
|
176
|
+
# every 100ms directly on the event loop
|
|
177
|
+
def _wait() -> bool:
|
|
178
|
+
while True:
|
|
179
|
+
position, status = self._cam.get_filter_position_and_status()
|
|
180
|
+
if position == target and status == FilterWheelStatus.IDLE:
|
|
181
|
+
return False
|
|
182
|
+
if self._abort_motion.is_set():
|
|
183
|
+
return True
|
|
184
|
+
time.sleep(0.1)
|
|
169
185
|
|
|
170
|
-
|
|
171
|
-
|
|
186
|
+
aborted = await self._run_blocking_or_raise(_wait, timeout=_FILTER_WAIT_TIMEOUT)
|
|
187
|
+
if aborted:
|
|
188
|
+
raise exc.AbortedError("Filter change aborted.")
|
|
172
189
|
|
|
173
190
|
# update cached position and publish new state
|
|
174
|
-
self._position =
|
|
191
|
+
self._position = target
|
|
175
192
|
log.info("Filter changed.")
|
|
176
193
|
await self.comm.send_event(FilterChangedEvent(filter_name))
|
|
177
194
|
await self.comm.set_state(IFilters, FilterState(filter=filter_name))
|
|
@@ -2199,7 +2199,7 @@ wheels = [
|
|
|
2199
2199
|
|
|
2200
2200
|
[[package]]
|
|
2201
2201
|
name = "pyobs-core"
|
|
2202
|
-
version = "2.0.0.
|
|
2202
|
+
version = "2.0.0.dev7"
|
|
2203
2203
|
source = { registry = "https://pypi.org/simple" }
|
|
2204
2204
|
dependencies = [
|
|
2205
2205
|
{ name = "aiohttp" },
|
|
@@ -2229,14 +2229,21 @@ dependencies = [
|
|
|
2229
2229
|
{ name = "tenacity" },
|
|
2230
2230
|
{ name = "typing-extensions" },
|
|
2231
2231
|
]
|
|
2232
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
2232
|
+
sdist = { url = "https://files.pythonhosted.org/packages/82/0a/9d1608eadbeaab65ec368020f0b7e0e9c09177fcb64c6c1da9a81745ddea/pyobs_core-2.0.0.dev7.tar.gz", hash = "sha256:81fd96248c671009e5c6e94e9acca89c6086f535d76ec5685e3eb2ff8c5b3f0a", size = 299897, upload-time = "2026-07-01T11:33:33.848Z" }
|
|
2233
2233
|
wheels = [
|
|
2234
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
2234
|
+
{ url = "https://files.pythonhosted.org/packages/c9/86/72db2671a8453b57b6580cb40c3ca19c6a9d5a050c1234f48fec22a58696/pyobs_core-2.0.0.dev7-py3-none-any.whl", hash = "sha256:b4aac0bb996d44e29556cd062774ab380c16c9220a972e0a6211d96b952dfed3", size = 508486, upload-time = "2026-07-01T11:33:32.235Z" },
|
|
2235
|
+
]
|
|
2236
|
+
|
|
2237
|
+
[package.optional-dependencies]
|
|
2238
|
+
gui = [
|
|
2239
|
+
{ name = "pyside6" },
|
|
2240
|
+
{ name = "qfitswidget" },
|
|
2241
|
+
{ name = "qtpy" },
|
|
2235
2242
|
]
|
|
2236
2243
|
|
|
2237
2244
|
[[package]]
|
|
2238
2245
|
name = "pyobs-sbig"
|
|
2239
|
-
version = "2.0.0.
|
|
2246
|
+
version = "2.0.0.dev6"
|
|
2240
2247
|
source = { editable = "." }
|
|
2241
2248
|
dependencies = [
|
|
2242
2249
|
{ name = "astropy" },
|
|
@@ -2246,9 +2253,8 @@ dependencies = [
|
|
|
2246
2253
|
|
|
2247
2254
|
[package.optional-dependencies]
|
|
2248
2255
|
gui = [
|
|
2249
|
-
{ name = "
|
|
2256
|
+
{ name = "pyobs-core", extra = ["gui"] },
|
|
2250
2257
|
{ name = "qasync" },
|
|
2251
|
-
{ name = "qfitswidget" },
|
|
2252
2258
|
]
|
|
2253
2259
|
|
|
2254
2260
|
[package.dev-dependencies]
|
|
@@ -2265,9 +2271,8 @@ requires-dist = [
|
|
|
2265
2271
|
{ name = "astropy", specifier = ">=7.0.1,<8" },
|
|
2266
2272
|
{ name = "numpy", specifier = ">=2.2.5,<3" },
|
|
2267
2273
|
{ name = "pyobs-core", specifier = ">=2.0.0.dev6,<3" },
|
|
2268
|
-
{ name = "
|
|
2274
|
+
{ name = "pyobs-core", extras = ["gui"], marker = "extra == 'gui'", specifier = ">=2.0.0.dev6,<3" },
|
|
2269
2275
|
{ name = "qasync", marker = "extra == 'gui'", specifier = ">=0.28.0" },
|
|
2270
|
-
{ name = "qfitswidget", marker = "extra == 'gui'", specifier = ">=0.13.1" },
|
|
2271
2276
|
]
|
|
2272
2277
|
provides-extras = ["gui"]
|
|
2273
2278
|
|
pyobs_sbig-2.0.0.dev4/README.md
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
SBIG module for *pytel*
|
|
2
|
-
=======================
|
|
3
|
-
|
|
4
|
-
Install SBIG driver
|
|
5
|
-
-------------------
|
|
6
|
-
Download the SBIG Universal Driver package from ftp://ftp.sbig.com/pub/devsw/LinuxDevKit.tar.gz and follow
|
|
7
|
-
the installation instructions in the README.txt.
|
|
8
|
-
|
|
9
|
-
**Note:** The files in the *src/* directory are part of this archive, and the *CSBIGCam* class has been modified to include a
|
|
10
|
-
*Readout()* method.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
Install *pyobs-sbig*
|
|
14
|
-
--------------------
|
|
15
|
-
Clone the repository:
|
|
16
|
-
|
|
17
|
-
git clone https://github.com/pyobs/pyobs-sbig.git
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Install dependencies:
|
|
21
|
-
|
|
22
|
-
cd pytel-sbig
|
|
23
|
-
pip3 install -r requirements
|
|
24
|
-
|
|
25
|
-
And install it:
|
|
26
|
-
|
|
27
|
-
python3 setup.py install
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
Configuration
|
|
31
|
-
-------------
|
|
32
|
-
The *SbigCamera* class is derived from *BaseCamera* (see *pyobs* documentation) and adds a single new parameter:
|
|
33
|
-
|
|
34
|
-
setpoint:
|
|
35
|
-
The initial setpoint in degrees Celsius for the cooling of the camera.
|
|
36
|
-
|
|
37
|
-
The class works fine with its default parameters, so a basic module configuration would look like this:
|
|
38
|
-
|
|
39
|
-
module:
|
|
40
|
-
class: pyobs_sbig.SbigCamera
|
|
41
|
-
name: SBIG camera
|
|
42
|
-
|
|
43
|
-
Dependencies
|
|
44
|
-
------------
|
|
45
|
-
* **pyobs** for the core funcionality. It is not included in the *requirements.txt*, so needs to be installed
|
|
46
|
-
separately.
|
|
47
|
-
* [Cython](https://cython.org/) for wrapping the SBIG Universal Driver.
|
|
48
|
-
* [Astropy](http://www.astropy.org/) for FITS file handling.
|
|
49
|
-
* [NumPy](http://www.numpy.org/) for array handling.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|