pyobs-fli 1.4.2__tar.gz → 2.0.0.dev1__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_fli-2.0.0.dev1/.github/workflows/pypi.yml +26 -0
- pyobs_fli-2.0.0.dev1/.pre-commit-config.yaml +15 -0
- pyobs_fli-2.0.0.dev1/.readthedocs.yml +15 -0
- pyobs_fli-2.0.0.dev1/CHANGELOG.rst +2 -0
- pyobs_fli-2.0.0.dev1/CMakeLists.txt +86 -0
- pyobs_fli-2.0.0.dev1/DEVELOPMENT.md +337 -0
- pyobs_fli-2.0.0.dev1/PKG-INFO +11 -0
- pyobs_fli-2.0.0.dev1/README.md +45 -0
- pyobs_fli-2.0.0.dev1/docs/Makefile +31 -0
- pyobs_fli-2.0.0.dev1/docs/make.bat +36 -0
- pyobs_fli-2.0.0.dev1/docs/requirements.txt +1 -0
- pyobs_fli-2.0.0.dev1/docs/source/_static/pyobs.gif +0 -0
- pyobs_fli-2.0.0.dev1/docs/source/conf.py +119 -0
- pyobs_fli-2.0.0.dev1/docs/source/index.rst +64 -0
- pyobs_fli-2.0.0.dev1/get-poetry.py +958 -0
- pyobs_fli-2.0.0.dev1/lib/Makefile +67 -0
- pyobs_fli-2.0.0.dev1/lib/docxx.sty +1104 -0
- pyobs_fli-2.0.0.dev1/lib/libfli-camera-parport.c +821 -0
- pyobs_fli-2.0.0.dev1/lib/libfli-camera-parport.h +102 -0
- pyobs_fli-2.0.0.dev1/lib/libfli-camera-usb.c +3148 -0
- pyobs_fli-2.0.0.dev1/lib/libfli-camera-usb.h +148 -0
- pyobs_fli-2.0.0.dev1/lib/libfli-camera.c +1304 -0
- pyobs_fli-2.0.0.dev1/lib/libfli-camera.h +171 -0
- pyobs_fli-2.0.0.dev1/lib/libfli-debug.h +60 -0
- pyobs_fli-2.0.0.dev1/lib/libfli-filter-focuser.c +1741 -0
- pyobs_fli-2.0.0.dev1/lib/libfli-filter-focuser.h +85 -0
- pyobs_fli-2.0.0.dev1/lib/libfli-libfli.h +275 -0
- pyobs_fli-2.0.0.dev1/lib/libfli-mem.c +332 -0
- pyobs_fli-2.0.0.dev1/lib/libfli-mem.h +59 -0
- pyobs_fli-2.0.0.dev1/lib/libfli-raw.c +84 -0
- pyobs_fli-2.0.0.dev1/lib/libfli-raw.h +51 -0
- pyobs_fli-2.0.0.dev1/lib/libfli.c +1905 -0
- pyobs_fli-2.0.0.dev1/lib/libfli.dxx +56 -0
- pyobs_fli-2.0.0.dev1/lib/libfli.h +339 -0
- pyobs_fli-2.0.0.dev1/lib/unix/bsd/libfli-usb-sys.c +208 -0
- pyobs_fli-2.0.0.dev1/lib/unix/libfli-debug.c +139 -0
- pyobs_fli-2.0.0.dev1/lib/unix/libfli-parport.h +61 -0
- pyobs_fli-2.0.0.dev1/lib/unix/libfli-serial.c +189 -0
- pyobs_fli-2.0.0.dev1/lib/unix/libfli-serial.h +51 -0
- pyobs_fli-2.0.0.dev1/lib/unix/libfli-sys.c +477 -0
- pyobs_fli-2.0.0.dev1/lib/unix/libfli-sys.h +121 -0
- pyobs_fli-2.0.0.dev1/lib/unix/libfli-usb.c +97 -0
- pyobs_fli-2.0.0.dev1/lib/unix/libfli-usb.h +87 -0
- pyobs_fli-2.0.0.dev1/lib/unix/linux/fli_ioctl.h +119 -0
- pyobs_fli-2.0.0.dev1/lib/unix/linux/fliusb_ioctl.h +87 -0
- pyobs_fli-2.0.0.dev1/lib/unix/linux/libfli-parport.c +133 -0
- pyobs_fli-2.0.0.dev1/lib/unix/linux/libfli-usb-sys.c +256 -0
- pyobs_fli-2.0.0.dev1/lib/unix/osx/libfli-usb-sys.c +917 -0
- pyobs_fli-2.0.0.dev1/lib/unix/osx/libfli-usb-sys.h +179 -0
- pyobs_fli-2.0.0.dev1/lib/windows/libfli-debug.c +241 -0
- pyobs_fli-2.0.0.dev1/lib/windows/libfli-parport.h +51 -0
- pyobs_fli-2.0.0.dev1/lib/windows/libfli-serial.c +129 -0
- pyobs_fli-2.0.0.dev1/lib/windows/libfli-serial.h +49 -0
- pyobs_fli-2.0.0.dev1/lib/windows/libfli-sys.h +88 -0
- pyobs_fli-2.0.0.dev1/lib/windows/libfli-usb.c +361 -0
- pyobs_fli-2.0.0.dev1/lib/windows/libfli-usb.h +195 -0
- pyobs_fli-2.0.0.dev1/lib/windows/libfli-windows-parport.c +548 -0
- pyobs_fli-2.0.0.dev1/lib/windows/libfli-windows.c +1371 -0
- pyobs_fli-2.0.0.dev1/lib/windows/libfli.def +75 -0
- pyobs_fli-2.0.0.dev1/lib/windows/libfli.rc +102 -0
- pyobs_fli-2.0.0.dev1/lib/windows/libfli.sln +38 -0
- pyobs_fli-2.0.0.dev1/lib/windows/libfli.vcproj +729 -0
- pyobs_fli-2.0.0.dev1/lib/windows/libfli64.def +74 -0
- pyobs_fli-2.0.0.dev1/lib/windows/resource.h +14 -0
- pyobs_fli-2.0.0.dev1/poetry.lock +2257 -0
- pyobs_fli-2.0.0.dev1/pyobs_fli/__init__.py +2 -0
- {pyobs_fli-1.4.2 → pyobs_fli-2.0.0.dev1}/pyobs_fli/flibase.py +7 -7
- {pyobs_fli-1.4.2 → pyobs_fli-2.0.0.dev1}/pyobs_fli/flicamera.py +81 -168
- {pyobs_fli-1.4.2 → pyobs_fli-2.0.0.dev1}/pyobs_fli/flifilterwheel.py +43 -83
- pyobs_fli-2.0.0.dev1/pyproject.toml +42 -0
- pyobs_fli-2.0.0.dev1/uv.lock +2022 -0
- pyobs_fli-1.4.2/PKG-INFO +0 -16
- pyobs_fli-1.4.2/build.py +0 -50
- pyobs_fli-1.4.2/pyobs_fli/__init__.py +0 -10
- pyobs_fli-1.4.2/pyproject.toml +0 -30
- {pyobs_fli-1.4.2 → pyobs_fli-2.0.0.dev1}/LICENSE +0 -0
- {pyobs_fli-1.4.2 → pyobs_fli-2.0.0.dev1}/pyobs_fli/flidriver.pyx +0 -0
- {pyobs_fli-1.4.2 → pyobs_fli-2.0.0.dev1}/pyobs_fli/libfli.pxd +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Publish package to PyPI
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
tags:
|
|
5
|
+
- 'v*'
|
|
6
|
+
jobs:
|
|
7
|
+
build-n-publish:
|
|
8
|
+
name: Build and publish package to PyPI
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v2
|
|
12
|
+
- name: Set up Python
|
|
13
|
+
uses: actions/setup-python@v1
|
|
14
|
+
with:
|
|
15
|
+
python-version: "3.11"
|
|
16
|
+
- name: Install poetry
|
|
17
|
+
run: |
|
|
18
|
+
curl -fsS -o get-poetry.py https://install.python-poetry.org
|
|
19
|
+
python get-poetry.py -y
|
|
20
|
+
- name: Publish
|
|
21
|
+
env:
|
|
22
|
+
PYPI_TOKEN: ${{ secrets.pypi_password }}
|
|
23
|
+
run: |
|
|
24
|
+
$HOME/.local/bin/poetry config pypi-token.pypi $PYPI_TOKEN
|
|
25
|
+
$HOME/.local/bin/poetry build -f sdist
|
|
26
|
+
$HOME/.local/bin/poetry publish
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
# Using this mirror lets us use mypyc-compiled black, which is about 2x faster
|
|
3
|
+
- repo: https://github.com/psf/black-pre-commit-mirror
|
|
4
|
+
rev: 25.1.0
|
|
5
|
+
hooks:
|
|
6
|
+
- id: black
|
|
7
|
+
# It is recommended to specify the latest version of Python
|
|
8
|
+
# supported by your project here, or alternatively use
|
|
9
|
+
# pre-commit's default_language_version, see
|
|
10
|
+
# https://pre-commit.com/#top_level-default_language_version
|
|
11
|
+
language_version: python3.11
|
|
12
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
13
|
+
rev: v0.9.0
|
|
14
|
+
hooks:
|
|
15
|
+
- id: ruff
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.21)
|
|
2
|
+
project(pyobs_fli LANGUAGES C CXX)
|
|
3
|
+
|
|
4
|
+
# --- Ensure we use the build environment Python ---
|
|
5
|
+
set(Python3_FIND_VIRTUALENV ONLY)
|
|
6
|
+
set(Python3_FIND_STRATEGY LOCATION)
|
|
7
|
+
find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module)
|
|
8
|
+
|
|
9
|
+
# --- Paths ---
|
|
10
|
+
set(PYX_FILE "${CMAKE_CURRENT_SOURCE_DIR}/pyobs_fli/flidriver.pyx")
|
|
11
|
+
set(CXX_FILE "${CMAKE_CURRENT_BINARY_DIR}/flidriver.cpp")
|
|
12
|
+
|
|
13
|
+
# --- Get NumPy include dir ---
|
|
14
|
+
execute_process(
|
|
15
|
+
COMMAND "${Python3_EXECUTABLE}" -c "import numpy; print(numpy.get_include())"
|
|
16
|
+
OUTPUT_VARIABLE NUMPY_INCLUDE_DIR
|
|
17
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# --- Run Cython (C++ mode) ---
|
|
21
|
+
add_custom_command(
|
|
22
|
+
OUTPUT ${CXX_FILE}
|
|
23
|
+
COMMAND "${Python3_EXECUTABLE}" -m cython
|
|
24
|
+
${PYX_FILE}
|
|
25
|
+
--output-file ${CXX_FILE}
|
|
26
|
+
--cplus
|
|
27
|
+
-I "${CMAKE_CURRENT_SOURCE_DIR}/pyobs_fli"
|
|
28
|
+
DEPENDS ${PYX_FILE} "${CMAKE_CURRENT_SOURCE_DIR}/pyobs_fli/libfli.pxd"
|
|
29
|
+
COMMENT "Running Cython on flidriver.pyx"
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
# --- Build libfli from source ---
|
|
33
|
+
set(LIBFLI_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib")
|
|
34
|
+
add_library(fli_static STATIC
|
|
35
|
+
${LIBFLI_DIR}/libfli.c
|
|
36
|
+
${LIBFLI_DIR}/libfli-camera.c
|
|
37
|
+
${LIBFLI_DIR}/libfli-camera-parport.c
|
|
38
|
+
${LIBFLI_DIR}/libfli-camera-usb.c
|
|
39
|
+
${LIBFLI_DIR}/libfli-filter-focuser.c
|
|
40
|
+
${LIBFLI_DIR}/libfli-mem.c
|
|
41
|
+
${LIBFLI_DIR}/libfli-raw.c
|
|
42
|
+
${LIBFLI_DIR}/unix/libfli-debug.c
|
|
43
|
+
${LIBFLI_DIR}/unix/libfli-serial.c
|
|
44
|
+
${LIBFLI_DIR}/unix/libfli-sys.c
|
|
45
|
+
${LIBFLI_DIR}/unix/libfli-usb.c
|
|
46
|
+
${LIBFLI_DIR}/unix/linux/libfli-parport.c
|
|
47
|
+
${LIBFLI_DIR}/unix/linux/libfli-usb-sys.c
|
|
48
|
+
)
|
|
49
|
+
target_include_directories(fli_static PUBLIC
|
|
50
|
+
${LIBFLI_DIR}
|
|
51
|
+
${LIBFLI_DIR}/unix
|
|
52
|
+
)
|
|
53
|
+
target_compile_options(fli_static PRIVATE -Wall -O2 -fPIC)
|
|
54
|
+
|
|
55
|
+
# --- Build extension module ---
|
|
56
|
+
add_library(flidriver MODULE ${CXX_FILE})
|
|
57
|
+
set_source_files_properties(${CXX_FILE} PROPERTIES LANGUAGE CXX)
|
|
58
|
+
target_include_directories(flidriver PRIVATE
|
|
59
|
+
${Python3_INCLUDE_DIRS}
|
|
60
|
+
${NUMPY_INCLUDE_DIR}
|
|
61
|
+
${LIBFLI_DIR}
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
# --- Correct Python module naming ---
|
|
65
|
+
execute_process(
|
|
66
|
+
COMMAND "${Python3_EXECUTABLE}" -c
|
|
67
|
+
"import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))"
|
|
68
|
+
OUTPUT_VARIABLE PY_EXT_SUFFIX
|
|
69
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
70
|
+
)
|
|
71
|
+
set_target_properties(flidriver PROPERTIES
|
|
72
|
+
PREFIX ""
|
|
73
|
+
OUTPUT_NAME "flidriver"
|
|
74
|
+
SUFFIX "${PY_EXT_SUFFIX}"
|
|
75
|
+
POSITION_INDEPENDENT_CODE ON
|
|
76
|
+
)
|
|
77
|
+
message(STATUS "ext: ${PY_EXT_SUFFIX}")
|
|
78
|
+
|
|
79
|
+
# --- Link ---
|
|
80
|
+
find_library(CFITSIO_LIB cfitsio REQUIRED)
|
|
81
|
+
target_link_libraries(flidriver PRIVATE fli_static ${CFITSIO_LIB})
|
|
82
|
+
|
|
83
|
+
# --- Install into package ---
|
|
84
|
+
install(TARGETS flidriver
|
|
85
|
+
LIBRARY DESTINATION ${SKBUILD_PROJECT_NAME}
|
|
86
|
+
)
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
# pyobs 2.0 — Phase 5: External Hardware Modules
|
|
2
|
+
|
|
3
|
+
This document covers the migration of this pyobs hardware module to the
|
|
4
|
+
pyobs 2.0 API.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Step 0 — Branch main/master into 1.x for legacy support
|
|
9
|
+
|
|
10
|
+
Before making any changes, preserve the current state as a legacy branch.
|
|
11
|
+
First check which branch is the default — it may be `main` or `master`:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
git remote show origin | grep "HEAD branch"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**If the default branch is `master`, rename it to `main` first:**
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
git checkout master
|
|
21
|
+
git branch -m master main
|
|
22
|
+
git push origin main
|
|
23
|
+
git push origin --delete master
|
|
24
|
+
# Update the default branch in GitHub repository settings to main
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Then branch off for legacy support:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
git checkout main
|
|
31
|
+
git checkout -b 1.x
|
|
32
|
+
git push origin 1.x
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Create `develop` for all 2.0 work:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
git checkout main
|
|
39
|
+
git checkout -b develop
|
|
40
|
+
git push origin develop
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Set `develop` as the default branch in GitHub repository settings.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Step 1 — Add ruff, update tooling
|
|
48
|
+
|
|
49
|
+
### pyproject.toml changes
|
|
50
|
+
|
|
51
|
+
1. Bump `pyobs-core` to `>=2.0.0.dev1`.
|
|
52
|
+
|
|
53
|
+
2. In `[dependency-groups] dev`: add `ruff>=0.9.0`, remove `flake8` and any
|
|
54
|
+
mypy stub packages (`pandas-stubs`, `pyside6-stubs`, etc.) — pyrefly
|
|
55
|
+
doesn't use `.pyi` stubs from PyPI.
|
|
56
|
+
|
|
57
|
+
3. Add config sections (match pyobs-core develop exactly):
|
|
58
|
+
|
|
59
|
+
```toml
|
|
60
|
+
[tool.ruff]
|
|
61
|
+
target-version = "py311"
|
|
62
|
+
line-length = 120
|
|
63
|
+
|
|
64
|
+
[tool.ruff.lint]
|
|
65
|
+
select = ["E", "F", "W", "I", "UP", "G"]
|
|
66
|
+
|
|
67
|
+
[tool.pyrefly]
|
|
68
|
+
python-version = "3.11"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
> **Note on the `G` rule**: it flags `log.info(f"...")` — all logging calls
|
|
72
|
+
> must use `%`-style formatting: `log.info("value: %s", val)`.
|
|
73
|
+
|
|
74
|
+
### .pre-commit-config.yaml
|
|
75
|
+
|
|
76
|
+
Replace the flake8 hook with ruff:
|
|
77
|
+
|
|
78
|
+
```yaml
|
|
79
|
+
repos:
|
|
80
|
+
- repo: https://github.com/psf/black-pre-commit-mirror
|
|
81
|
+
rev: 25.1.0
|
|
82
|
+
hooks:
|
|
83
|
+
- id: black
|
|
84
|
+
language_version: python3.11
|
|
85
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
86
|
+
rev: v0.9.0
|
|
87
|
+
hooks:
|
|
88
|
+
- id: ruff
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Delete .flake8
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
rm .flake8
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Run once to fix existing issues
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
uv run ruff check --fix .
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Step 2 — Replace get_* with state and capabilities
|
|
106
|
+
|
|
107
|
+
### Remove getter methods
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
# BEFORE (pyobs 1.x)
|
|
111
|
+
async def get_binning(self) -> tuple[int, int]:
|
|
112
|
+
return self._binning
|
|
113
|
+
|
|
114
|
+
async def list_binnings(self) -> list[IBinning.State]:
|
|
115
|
+
return [IBinning.State(x=1, y=1), IBinning.State(x=2, y=2)]
|
|
116
|
+
|
|
117
|
+
async def get_full_frame(self) -> IWindow.State:
|
|
118
|
+
return IWindow.State(x=0, y=0, width=self._width, height=self._height)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
# AFTER (pyobs 2.0)
|
|
123
|
+
# In open():
|
|
124
|
+
await self.comm.set_capabilities(IWindow.Capabilities(
|
|
125
|
+
full_frame=IWindow.State(x=0, y=0, width=self._width, height=self._height)
|
|
126
|
+
))
|
|
127
|
+
await self.comm.set_capabilities(IBinning.Capabilities(
|
|
128
|
+
binnings=[IBinning.State(x=1, y=1), IBinning.State(x=2, y=2)]
|
|
129
|
+
))
|
|
130
|
+
# Initial states also in open():
|
|
131
|
+
await self.comm.set_state(IWindow.State(x=0, y=0, width=self._width, height=self._height))
|
|
132
|
+
await self.comm.set_state(IBinning.State(x=self._binning[0], y=self._binning[1]))
|
|
133
|
+
# In set_binning():
|
|
134
|
+
await self.comm.set_state(IBinning.State(x=x, y=y))
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Interface → change pattern
|
|
138
|
+
|
|
139
|
+
| Old getter | New pattern |
|
|
140
|
+
|---|---|
|
|
141
|
+
| `get_full_frame()` | `set_capabilities(IWindow.Capabilities(full_frame=...))` in `open()` |
|
|
142
|
+
| `get_window()` | remove — no equivalent; current window tracked in `_window` and published via `set_state(IWindow.State(...))` |
|
|
143
|
+
| `list_binnings()` | `set_capabilities(IBinning.Capabilities(binnings=[...]))` in `open()` |
|
|
144
|
+
| `list_image_formats()` | `set_capabilities(IImageFormat.Capabilities(image_formats=[...]))` in `open()` |
|
|
145
|
+
| `get_binning()` | `set_state(IBinning.State(...))` in `set_binning()` + `open()` |
|
|
146
|
+
| `get_exposure_status()` | `set_state(IExposure.State(...))` in `_change_exposure_status()` |
|
|
147
|
+
| `get_exposure_time()` | `set_state(IExposureTime.State(...))` in `set_exposure_time()` + `open()` |
|
|
148
|
+
| `get_image_type()` | `set_state(IImageType.State(...))` in `set_image_type()` + `open()` |
|
|
149
|
+
| `get_filter()` | `set_state(IFilters.State(...))` in `set_filter()` + `open()` |
|
|
150
|
+
| `list_filters()` | `set_capabilities(IFilters.Capabilities(filters=[...]))` in `open()` |
|
|
151
|
+
| `get_focus()` | `set_state(IFocuser.State(...))` in `set_focus()` + `open()` |
|
|
152
|
+
| `get_motion_status()` | handled by `MotionStatusMixin` — just call `_change_motion_status()` |
|
|
153
|
+
| `is_ready()` | `set_state(IReady.State(ready=...))` in `open()` and when it changes |
|
|
154
|
+
| `get_cooling()` | `set_state(ICooling.State(setpoint=..., power=..., enabled=...))` in `set_cooling()` and background task |
|
|
155
|
+
| `get_temperatures()` | `set_state(ITemperatures.State(readings=[ITemperatures.Temperature(name=..., value=...)]))` in background polling task |
|
|
156
|
+
| `get_gain()` / `get_offset()` | `set_state(IGain.State(gain=..., offset=...))` in `set_gain()`, `set_offset()` + `open()` |
|
|
157
|
+
| `get_video()` | `set_capabilities(IVideo.Capabilities(url=...))` in `open()` |
|
|
158
|
+
|
|
159
|
+
### ICooling and ITemperatures
|
|
160
|
+
|
|
161
|
+
`ICooling` extends `ITemperatures` but they have separate `State` dataclasses.
|
|
162
|
+
Both must be published independently:
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
# temperatures (from background polling loop)
|
|
166
|
+
await self.comm.set_state(
|
|
167
|
+
ITemperatures.State(readings=[ITemperatures.Temperature(name="CCD", value=temp)])
|
|
168
|
+
)
|
|
169
|
+
# cooling control state
|
|
170
|
+
await self.comm.set_state(
|
|
171
|
+
ICooling.State(setpoint=self._setpoint, power=round(power_pct), enabled=True)
|
|
172
|
+
)
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
`ICooling.State.power` is typed `int | None` — convert the raw PWM fraction
|
|
176
|
+
(`raw / 255 * 100`) with `round()` before passing it.
|
|
177
|
+
|
|
178
|
+
### __init__.py re-exports
|
|
179
|
+
|
|
180
|
+
Ruff's `F401` rule requires explicit re-exports. Change:
|
|
181
|
+
|
|
182
|
+
```python
|
|
183
|
+
# before
|
|
184
|
+
from .mymodule import MyClass
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
```python
|
|
188
|
+
# after
|
|
189
|
+
from .mymodule import MyClass as MyClass
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Step 3 — Add pyobs-independent GUI
|
|
195
|
+
|
|
196
|
+
Each hardware module should have a standalone Qt GUI that works without pyobs
|
|
197
|
+
running — useful for testing hardware directly (e.g. during commissioning).
|
|
198
|
+
|
|
199
|
+
The pattern from **pyobs-qhyccd** (`pyobs_qhyccd/gui.py`) is the reference.
|
|
200
|
+
It uses reusable widgets from `pyobs.utils.gui.*` and talks directly to the
|
|
201
|
+
hardware driver without going through pyobs Comm.
|
|
202
|
+
|
|
203
|
+
### Typical structure
|
|
204
|
+
|
|
205
|
+
```python
|
|
206
|
+
# mymodule/gui.py
|
|
207
|
+
import asyncio
|
|
208
|
+
import sys
|
|
209
|
+
import qasync
|
|
210
|
+
from PySide6 import QtWidgets
|
|
211
|
+
from pyobs.utils.gui.camera import (
|
|
212
|
+
DataDisplayWidget, BinningWidget, ImageFormatWidget,
|
|
213
|
+
ExposureTimeWidget, ExposeWidget,
|
|
214
|
+
)
|
|
215
|
+
from .driver import MyDriver
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
class MainWindow(QtWidgets.QMainWindow):
|
|
219
|
+
def __init__(self) -> None:
|
|
220
|
+
super().__init__()
|
|
221
|
+
self.driver = MyDriver()
|
|
222
|
+
self.driver.open()
|
|
223
|
+
# ... build UI from pyobs.utils.gui widgets ...
|
|
224
|
+
|
|
225
|
+
@qasync.asyncSlot()
|
|
226
|
+
async def _expose_clicked(self) -> None:
|
|
227
|
+
# ... call driver directly ...
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def main() -> None:
|
|
231
|
+
app = QtWidgets.QApplication(sys.argv)
|
|
232
|
+
asyncio.run(async_main(app), loop_factory=qasync.QEventLoop)
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
if __name__ == "__main__":
|
|
236
|
+
main()
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Register as a console script in `pyproject.toml`:
|
|
240
|
+
|
|
241
|
+
```toml
|
|
242
|
+
[project.scripts]
|
|
243
|
+
mymodule-gui = "mymodule.gui:main"
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Available pyobs GUI widgets (`pyobs.utils.gui`)
|
|
247
|
+
|
|
248
|
+
- `camera.DataDisplayWidget` — displays FITS images
|
|
249
|
+
- `camera.BinningWidget` — binning selector
|
|
250
|
+
- `camera.ImageFormatWidget` — INT8/INT16 selector
|
|
251
|
+
- `camera.ExposureTimeWidget` — exposure time spinner
|
|
252
|
+
- `camera.ExposeWidget` — expose/abort buttons with progress
|
|
253
|
+
- `camera.windowingwidget.WindowingWidget` — ROI selector
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Step 4 — Testing
|
|
258
|
+
|
|
259
|
+
Each module should have a `test/` directory with a `local.yaml` config that
|
|
260
|
+
uses `LocalComm` so it can be tested without an XMPP server:
|
|
261
|
+
|
|
262
|
+
```yaml
|
|
263
|
+
# test/local.yaml
|
|
264
|
+
class: pyobs.modules.MultiModule
|
|
265
|
+
|
|
266
|
+
vfs: &vfs
|
|
267
|
+
class: pyobs.vfs.VirtualFileSystem
|
|
268
|
+
roots:
|
|
269
|
+
cache:
|
|
270
|
+
class: pyobs.vfs.LocalFile
|
|
271
|
+
root: /tmp/pyobs-test/
|
|
272
|
+
|
|
273
|
+
modules:
|
|
274
|
+
camera: # or telescope, focuser, etc.
|
|
275
|
+
class: mymodule.MyCamera
|
|
276
|
+
name: camera
|
|
277
|
+
vfs: *vfs
|
|
278
|
+
comm:
|
|
279
|
+
class: pyobs.comm.local.LocalComm
|
|
280
|
+
name: camera
|
|
281
|
+
|
|
282
|
+
gui:
|
|
283
|
+
class: pyobs_gui.GUI
|
|
284
|
+
name: gui
|
|
285
|
+
vfs: *vfs
|
|
286
|
+
comm:
|
|
287
|
+
class: pyobs.comm.local.LocalComm
|
|
288
|
+
name: gui
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Run with:
|
|
292
|
+
```bash
|
|
293
|
+
pyobs test/local.yaml
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Repo checklist
|
|
299
|
+
|
|
300
|
+
For each external module repo, in order:
|
|
301
|
+
|
|
302
|
+
- [ ] Branch `main` → `1.x` (legacy)
|
|
303
|
+
- [ ] Create `develop` branch
|
|
304
|
+
- [ ] Bump `pyobs-core` to `>=2.0.0.dev1` in `pyproject.toml`
|
|
305
|
+
- [ ] Add `ruff>=0.9.0` to dev deps; remove `flake8` and mypy stub packages
|
|
306
|
+
- [ ] Add `[tool.ruff]`, `[tool.ruff.lint]`, `[tool.pyrefly]` sections to `pyproject.toml`
|
|
307
|
+
- [ ] Update `.pre-commit-config.yaml`: replace flake8 hook with ruff
|
|
308
|
+
- [ ] Delete `.flake8`
|
|
309
|
+
- [ ] Run `ruff check --fix .`
|
|
310
|
+
- [ ] Fix re-exports in `__init__.py` (`Foo as Foo`)
|
|
311
|
+
- [ ] Convert f-string log calls to `%`-style (`log.info("x: %s", x)`)
|
|
312
|
+
- [ ] Remove all `get_*` / `list_*` / `is_ready` methods
|
|
313
|
+
- [ ] Add `set_capabilities(...)` calls in `open()`
|
|
314
|
+
- [ ] Add `set_state(...)` calls in `open()` (initial values) and wherever values change
|
|
315
|
+
- [ ] Add standalone GUI in `<package>/gui.py`
|
|
316
|
+
- [ ] Add `test/local.yaml`
|
|
317
|
+
- [ ] Update `README.md` to mention pyobs 2.0 requirement
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## Key pyobs-core 2.0 APIs
|
|
322
|
+
|
|
323
|
+
```python
|
|
324
|
+
# In open() — publish static hardware info
|
|
325
|
+
await self.comm.set_capabilities(IWindow.Capabilities(...))
|
|
326
|
+
await self.comm.set_capabilities(IBinning.Capabilities(...))
|
|
327
|
+
|
|
328
|
+
# In open() and wherever values change — publish live state
|
|
329
|
+
await self.comm.set_state(IBinning.State(x=2, y=2))
|
|
330
|
+
await self.comm.set_state(ICooling.State(setpoint=-20, power=80, enabled=True))
|
|
331
|
+
|
|
332
|
+
# Presence — set by Module.set_state() automatically
|
|
333
|
+
# No manual action needed
|
|
334
|
+
|
|
335
|
+
# Reading remote state (e.g. telescope pointing for camera WCS)
|
|
336
|
+
await self.comm.subscribe_state("telescope", IPointingRaDec, self._on_pointing)
|
|
337
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyobs-fli
|
|
3
|
+
Version: 2.0.0.dev1
|
|
4
|
+
Summary: pyobs module for FLI cameras
|
|
5
|
+
Author-Email: Tim-Oliver Husser <thusser@uni-goettingen.de>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: <3.14,>=3.11
|
|
8
|
+
Requires-Dist: astropy<8,>=7.0.1
|
|
9
|
+
Requires-Dist: numpy<3,>=2.2.5
|
|
10
|
+
Requires-Dist: pyobs-core<3,>=2.0.0.dev6
|
|
11
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
FLI module for *pyobs*
|
|
2
|
+
======================
|
|
3
|
+
|
|
4
|
+
FLI kernel module
|
|
5
|
+
-----------------
|
|
6
|
+
The FLI kernel module needs to be installed in the system.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Install *pyobs-fli*
|
|
10
|
+
-------------------
|
|
11
|
+
Clone the repository:
|
|
12
|
+
|
|
13
|
+
git clone https://github.com/pyobs/pyobs-fli.git
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
Install dependencies:
|
|
17
|
+
|
|
18
|
+
cd pyobs-fli
|
|
19
|
+
pip3 install -r requirements
|
|
20
|
+
|
|
21
|
+
And install it:
|
|
22
|
+
|
|
23
|
+
python3 setup.py install
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
Configuration
|
|
27
|
+
-------------
|
|
28
|
+
The *FliCamera* class is derived from *BaseCamera* (see *pyobs* documentation) and adds a single new parameter:
|
|
29
|
+
|
|
30
|
+
setpoint:
|
|
31
|
+
The initial setpoint in degrees Celsius for the cooling of the camera.
|
|
32
|
+
|
|
33
|
+
The class works fine with its default parameters, so a basic module configuration would look like this:
|
|
34
|
+
|
|
35
|
+
module:
|
|
36
|
+
class: pyobs_fli.FliCamera
|
|
37
|
+
name: FLI camera
|
|
38
|
+
|
|
39
|
+
Dependencies
|
|
40
|
+
------------
|
|
41
|
+
* **pyobs** for the core funcionality. It is not included in the *requirements.txt*, so needs to be installed
|
|
42
|
+
separately.
|
|
43
|
+
* [Cython](https://cython.org/) for wrapping the SBIG Universal Driver.
|
|
44
|
+
* [Astropy](http://www.astropy.org/) for FITS file handling.
|
|
45
|
+
* [NumPy](http://www.numpy.org/) for array handling.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line.
|
|
5
|
+
SPHINXOPTS =
|
|
6
|
+
SPHINXBUILD = sphinx-build
|
|
7
|
+
SPHINXPROJ = pyobs
|
|
8
|
+
SOURCEDIR = source
|
|
9
|
+
BUILDDIR = ../.doc-build
|
|
10
|
+
|
|
11
|
+
#.EXPORT_ALL_VARIABLES:
|
|
12
|
+
|
|
13
|
+
#PYTHONPATH:=../pyobs-core/:../pyobs-sbig/:../pyobs-fli:../pyobs-weather:../pyobs-archive:${PYTHONPATH}
|
|
14
|
+
|
|
15
|
+
# Put it first so that "make" without argument is like "make help".
|
|
16
|
+
help:
|
|
17
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
18
|
+
|
|
19
|
+
.PHONY: help Makefile
|
|
20
|
+
|
|
21
|
+
html:
|
|
22
|
+
@$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS)
|
|
23
|
+
|
|
24
|
+
livehtml:
|
|
25
|
+
sphinx-autobuild -b html --watch ../pyobs_sbig $(ALLSPHINXOPTS) "$(SOURCEDIR)/" "$(BUILDDIR)/html/"
|
|
26
|
+
|
|
27
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
28
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
29
|
+
%: Makefile
|
|
30
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
31
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
@ECHO OFF
|
|
2
|
+
|
|
3
|
+
pushd %~dp0
|
|
4
|
+
|
|
5
|
+
REM Command file for Sphinx documentation
|
|
6
|
+
|
|
7
|
+
if "%SPHINXBUILD%" == "" (
|
|
8
|
+
set SPHINXBUILD=sphinx-build
|
|
9
|
+
)
|
|
10
|
+
set SOURCEDIR=source
|
|
11
|
+
set BUILDDIR=build
|
|
12
|
+
set SPHINXPROJ=pyobs
|
|
13
|
+
|
|
14
|
+
if "%1" == "" goto help
|
|
15
|
+
|
|
16
|
+
%SPHINXBUILD% >NUL 2>NUL
|
|
17
|
+
if errorlevel 9009 (
|
|
18
|
+
echo.
|
|
19
|
+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
|
20
|
+
echo.installed, then set the SPHINXBUILD environment variable to point
|
|
21
|
+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
|
22
|
+
echo.may add the Sphinx directory to PATH.
|
|
23
|
+
echo.
|
|
24
|
+
echo.If you don't have Sphinx installed, grab it from
|
|
25
|
+
echo.http://sphinx-doc.org/
|
|
26
|
+
exit /b 1
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
|
|
30
|
+
goto end
|
|
31
|
+
|
|
32
|
+
:help
|
|
33
|
+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
|
|
34
|
+
|
|
35
|
+
:end
|
|
36
|
+
popd
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sphinx-rtd-theme
|
|
Binary file
|