pyobs-sbig 1.2.2__tar.gz → 2.0.0.dev2__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.
Files changed (33) hide show
  1. pyobs_sbig-2.0.0.dev2/.github/workflows/pypi.yml +26 -0
  2. pyobs_sbig-2.0.0.dev2/.pre-commit-config.yaml +10 -0
  3. pyobs_sbig-2.0.0.dev2/.readthedocs.yml +15 -0
  4. pyobs_sbig-2.0.0.dev2/CHANGELOG.rst +2 -0
  5. pyobs_sbig-2.0.0.dev2/CMakeLists.txt +80 -0
  6. pyobs_sbig-2.0.0.dev2/PKG-INFO +15 -0
  7. pyobs_sbig-2.0.0.dev2/README.md +49 -0
  8. pyobs_sbig-2.0.0.dev2/docs/Makefile +31 -0
  9. pyobs_sbig-2.0.0.dev2/docs/make.bat +36 -0
  10. pyobs_sbig-2.0.0.dev2/docs/requirements.txt +1 -0
  11. pyobs_sbig-2.0.0.dev2/docs/source/_static/pyobs.gif +0 -0
  12. pyobs_sbig-2.0.0.dev2/docs/source/conf.py +118 -0
  13. pyobs_sbig-2.0.0.dev2/docs/source/index.rst +84 -0
  14. pyobs_sbig-2.0.0.dev2/pyproject.toml +56 -0
  15. pyobs_sbig-2.0.0.dev2/src/pyobs_sbig/__init__.py +3 -0
  16. pyobs_sbig-2.0.0.dev2/src/pyobs_sbig/gui.py +109 -0
  17. {pyobs_sbig-1.2.2 → pyobs_sbig-2.0.0.dev2/src}/pyobs_sbig/sbig6303e.py +5 -10
  18. {pyobs_sbig-1.2.2 → pyobs_sbig-2.0.0.dev2/src}/pyobs_sbig/sbigcamera.py +52 -84
  19. {pyobs_sbig-1.2.2 → pyobs_sbig-2.0.0.dev2/src}/pyobs_sbig/sbigfiltercamera.py +39 -67
  20. {pyobs_sbig-1.2.2 → pyobs_sbig-2.0.0.dev2/src}/pyobs_sbig/sbigudrv.pxd +2 -2
  21. pyobs_sbig-2.0.0.dev2/src/sbigudrv/csbigcam.cpp +1934 -0
  22. pyobs_sbig-2.0.0.dev2/src/sbigudrv/csbigcam.h +222 -0
  23. pyobs_sbig-2.0.0.dev2/src/sbigudrv/csbigimg.cpp +2116 -0
  24. pyobs_sbig-2.0.0.dev2/src/sbigudrv/csbigimg.h +268 -0
  25. pyobs_sbig-2.0.0.dev2/src/sbigudrv/lpardrv.h +36 -0
  26. pyobs_sbig-2.0.0.dev2/src/sbigudrv/sbigudrv.h +1077 -0
  27. pyobs_sbig-2.0.0.dev2/uv.lock +2947 -0
  28. pyobs_sbig-1.2.2/PKG-INFO +0 -16
  29. pyobs_sbig-1.2.2/build.py +0 -50
  30. pyobs_sbig-1.2.2/pyobs_sbig/__init__.py +0 -3
  31. pyobs_sbig-1.2.2/pyproject.toml +0 -30
  32. {pyobs_sbig-1.2.2 → pyobs_sbig-2.0.0.dev2}/LICENSE +0 -0
  33. {pyobs_sbig-1.2.2 → pyobs_sbig-2.0.0.dev2/src}/pyobs_sbig/sbigudrv.pyx +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
+ - name: Check out repository code
12
+ uses: actions/checkout@v4
13
+
14
+ - name: Set up Python
15
+ uses: astral-sh/setup-uv@v5
16
+ with:
17
+ enable-cache: true
18
+ python-version: "3.13"
19
+
20
+ - name: Build
21
+ run: uv build --sdist
22
+
23
+ - name: Publish
24
+ env:
25
+ PYPI_TOKEN: ${{ secrets.pypi_password }}
26
+ run: uv publish --token $PYPI_TOKEN
@@ -0,0 +1,10 @@
1
+ repos:
2
+ - repo: https://github.com/psf/black-pre-commit-mirror
3
+ rev: 25.1.0
4
+ hooks:
5
+ - id: black
6
+ language_version: python3.11
7
+ - repo: https://github.com/astral-sh/ruff-pre-commit
8
+ rev: v0.9.0
9
+ hooks:
10
+ - id: ruff
@@ -0,0 +1,15 @@
1
+ version: 2
2
+
3
+ build:
4
+ os: ubuntu-22.04
5
+ tools:
6
+ python: "3.11"
7
+
8
+ sphinx:
9
+ configuration: docs/source/conf.py
10
+
11
+ python:
12
+ install:
13
+ - method: pip
14
+ path: .
15
+ - requirements: docs/requirements.txt
@@ -0,0 +1,2 @@
1
+ v1.0.0 (2022-09-13)
2
+ *******************
@@ -0,0 +1,80 @@
1
+ cmake_minimum_required(VERSION 3.21)
2
+ project(pyobs_sbig LANGUAGES CXX)
3
+
4
+ # --- Ensure we use the build environment Python ---
5
+ set(Python3_FIND_VIRTUALENV ONLY)
6
+ set(Python3_FIND_STRATEGY LOCATION)
7
+
8
+ find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module)
9
+
10
+ # --- Paths ---
11
+ set(PYX_FILE "${CMAKE_CURRENT_SOURCE_DIR}/src/pyobs_sbig/sbigudrv.pyx")
12
+ set(CXX_FILE "${CMAKE_CURRENT_BINARY_DIR}/sbigudrv.cpp")
13
+ set(CSBIGCAM_FILE "${CMAKE_CURRENT_SOURCE_DIR}/src/sbigudrv/csbigcam.cpp")
14
+ set(CSBIGIMG_FILE "${CMAKE_CURRENT_SOURCE_DIR}/src/sbigudrv/csbigimg.cpp")
15
+
16
+ # --- Run Cython manually ---
17
+ add_custom_command(
18
+ OUTPUT ${CXX_FILE}
19
+ COMMAND "${Python3_EXECUTABLE}" -m cython
20
+ ${PYX_FILE}
21
+ --output-file ${CXX_FILE}
22
+ --cplus
23
+ DEPENDS ${PYX_FILE}
24
+ COMMENT "Running Cython on sbigudrv.pyx"
25
+ )
26
+
27
+ # --- Get NumPy include dir ---
28
+ execute_process(
29
+ COMMAND "${Python3_EXECUTABLE}" -c
30
+ "import numpy; print(numpy.get_include())"
31
+ OUTPUT_VARIABLE NUMPY_INCLUDE_DIR
32
+ OUTPUT_STRIP_TRAILING_WHITESPACE
33
+ )
34
+
35
+ # --- Build extension module ---
36
+ add_library(sbigudrv MODULE
37
+ ${CXX_FILE}
38
+ ${CSBIGCAM_FILE}
39
+ ${CSBIGIMG_FILE}
40
+ )
41
+ set_source_files_properties(${CXX_FILE} PROPERTIES LANGUAGE CXX)
42
+ target_include_directories(sbigudrv PRIVATE
43
+ ${Python3_INCLUDE_DIRS}
44
+ ${NUMPY_INCLUDE_DIR}
45
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/sbigudrv/
46
+ )
47
+
48
+ # --- Correct Python module naming (VERY IMPORTANT) ---
49
+ execute_process(
50
+ COMMAND "${Python3_EXECUTABLE}" -c
51
+ "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))"
52
+ OUTPUT_VARIABLE PY_EXT_SUFFIX
53
+ OUTPUT_STRIP_TRAILING_WHITESPACE
54
+ )
55
+ set_target_properties(sbigudrv PROPERTIES
56
+ PREFIX ""
57
+ OUTPUT_NAME "sbigudrv"
58
+ SUFFIX "${PY_EXT_SUFFIX}"
59
+ POSITION_INDEPENDENT_CODE ON
60
+ )
61
+ message(STATUS "ext: ${PY_EXT_SUFFIX}")
62
+
63
+ # --- sbigudrv ---
64
+ target_include_directories(sbigudrv PRIVATE
65
+ ${CMAKE_CURRENT_SOURCE_DIR}/lib/usr/local/include/
66
+ )
67
+
68
+ # --- Link ---
69
+ find_library(CFITSIO_LIB cfitsio REQUIRED)
70
+ find_path(CFITSIO_INCLUDE_DIR fitsio.h REQUIRED)
71
+ target_include_directories(sbigudrv PRIVATE ${CFITSIO_INCLUDE_DIR})
72
+ target_link_libraries(sbigudrv PRIVATE ${CFITSIO_LIB})
73
+
74
+ find_library(SBIGUDRV_LIB sbigudrv REQUIRED PATHS /usr/local/lib)
75
+ target_link_libraries(sbigudrv PRIVATE ${SBIGUDRV_LIB})
76
+
77
+ # --- Install into package ---
78
+ install(TARGETS sbigudrv
79
+ LIBRARY DESTINATION ${SKBUILD_PROJECT_NAME}
80
+ )
@@ -0,0 +1,15 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyobs-sbig
3
+ Version: 2.0.0.dev2
4
+ Summary: pyobs module for SBIG cameras
5
+ Author-Email: Tim-Oliver Husser <thusser@uni-goettingen.de>
6
+ License-Expression: MIT
7
+ Requires-Python: <3.15,>=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
+ Provides-Extra: gui
12
+ Requires-Dist: qfitswidget>=0.13.1; extra == "gui"
13
+ Requires-Dist: pyside6>=6.11.0; extra == "gui"
14
+ Requires-Dist: qasync>=0.28.0; extra == "gui"
15
+
@@ -0,0 +1,49 @@
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.
@@ -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
@@ -0,0 +1,118 @@
1
+ #
2
+ # Configuration file for the Sphinx documentation builder.
3
+ #
4
+ # This file does only contain a selection of the most common options. For a
5
+ # full list see the documentation:
6
+ # http://www.sphinx-doc.org/en/stable/config
7
+
8
+ # -- Path setup --------------------------------------------------------------
9
+
10
+ # If extensions (or modules to document with autodoc) are in another directory,
11
+ # add these directories to sys.path here. If the directory is relative to the
12
+ # documentation root, use os.path.abspath to make it absolute, like shown here.
13
+ #
14
+ import os
15
+ import sys
16
+
17
+ sys.path.insert(0, os.path.abspath("../../"))
18
+
19
+
20
+ # -- Project information -----------------------------------------------------
21
+
22
+ project = "pyobs-sbig"
23
+ copyright = "2022, Tim-Oliver Husser"
24
+ author = "Tim-Oliver Husser"
25
+
26
+ # The short X.Y version
27
+ version = "0.16"
28
+ # The full version, including alpha/beta/rc tags
29
+ release = "0.16.0"
30
+
31
+
32
+ # -- General configuration ---------------------------------------------------
33
+
34
+ add_module_names = False
35
+
36
+ # If your documentation needs a minimal Sphinx version, state it here.
37
+ #
38
+ # needs_sphinx = '1.0'
39
+
40
+ # Add any Sphinx extension module names here, as strings. They can be
41
+ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
42
+ # ones.
43
+ extensions = [
44
+ "sphinx.ext.autodoc",
45
+ "sphinx.ext.githubpages",
46
+ "sphinx.ext.napoleon",
47
+ "sphinx.ext.viewcode",
48
+ "sphinx.ext.autosectionlabel",
49
+ "sphinx.ext.intersphinx",
50
+ #'sphinx_autodoc_typehints'
51
+ ]
52
+
53
+ intersphinx_mapping = {"http://docs.python.org/3": None}
54
+
55
+ # napoleon settings
56
+ napoleon_google_docstring = True
57
+ napoleon_numpy_docstring = False
58
+ napoleon_use_param = False
59
+ napoleon_use_ivar = True
60
+
61
+ # typehints
62
+ # set_type_checking_flag = True
63
+ # autodoc_typehints = "description"
64
+
65
+ # show c'tor parameters in class only
66
+ autoclass_content = "both"
67
+
68
+ # Add any paths that contain templates here, relative to this directory.
69
+ templates_path = ["_templates"]
70
+
71
+ # The suffix(es) of source filenames.
72
+ # You can specify multiple suffix as a list of string:
73
+ #
74
+ source_suffix = ".rst"
75
+
76
+ # The master toctree document.
77
+ master_doc = "index"
78
+
79
+ # The language for content autogenerated by Sphinx. Refer to documentation
80
+ # for a list of supported languages.
81
+ #
82
+ # This is also used if you do content translation via gettext catalogs.
83
+ # Usually you set "language" from the command line for these cases.
84
+ language = "en"
85
+
86
+ # List of patterns, relative to source directory, that match files and
87
+ # directories to ignore when looking for source files.
88
+ # This pattern also affects html_static_path and html_extra_path .
89
+ exclude_patterns = []
90
+
91
+ # The name of the Pygments (syntax highlighting) style to use.
92
+ pygments_style = "sphinx"
93
+
94
+ # Be a little nitpicky
95
+ nitpicky = True
96
+ nitpick_ignore = []
97
+
98
+ # intersphinx
99
+ intersphinx_mapping = {
100
+ "pyobs": ("https://pyobs-core.readthedocs.io/en/latest/", None),
101
+ }
102
+
103
+ # -- Options for HTML output -------------------------------------------------
104
+
105
+ # The theme to use for HTML and HTML Help pages. See the documentation for
106
+ # a list of builtin themes.
107
+ html_theme = "sphinx_rtd_theme"
108
+ html_theme_options = {
109
+ "collapse_navigation": False,
110
+ "sticky_navigation": True,
111
+ "navigation_depth": 4,
112
+ "display_version": False,
113
+ "logo_only": False,
114
+ "prev_next_buttons_location": "bottom",
115
+ "titles_only": False,
116
+ "style_nav_header_background": "#cccccc",
117
+ }
118
+ html_logo = "_static/pyobs.gif"
@@ -0,0 +1,84 @@
1
+ pyobs-sbig
2
+ ##########
3
+
4
+ This is a `pyobs <https://www.pyobs.org>`_ (`documentation <https://docs.pyobs.org>`_) module for SBIG cameras.
5
+
6
+
7
+ Example configuration
8
+ *********************
9
+
10
+ This is an example configuration for a SBIG-6303E camera::
11
+
12
+ class: pyobs_sbig.Sbig6303eCamera
13
+
14
+ # cooling setpoint
15
+ setpoint: -10
16
+
17
+ # file naming
18
+ filenames: /cache/pyobs-{DAY-OBS|date:}-{FRAMENUM|string:04d}-{IMAGETYP|type}00.fits
19
+
20
+ # additional fits headers
21
+ fits_headers:
22
+ 'INSTRUME': ['sbig', 'Name of instrument']
23
+ 'DET-PIXL': [0.009, 'Size of detector pixels (square) [mm]']
24
+ 'DET-NAME': ['KAF-6303E', 'Name of detector']
25
+ 'DET-RON': [13.5, 'Detector readout noise [e-]']
26
+ 'DET-SATU': [100000, 'Detector saturation limit [e-]']
27
+ 'DET-DARK': [0.3, 'Detector dark current [e-/s]']
28
+
29
+ # opto-mechanical centre
30
+ centre: [1536.0, 1024.0]
31
+
32
+ # rotation (east of north)
33
+ rotation: -1.76
34
+ flip: True
35
+
36
+ # filter wheel
37
+ filter_wheel: AUTO
38
+ filter_names: [Red, Green, Blue, Clear, Halpha]
39
+
40
+ # location
41
+ timezone: utc
42
+ location:
43
+ longitude: 9.944333
44
+ latitude: 51.560583
45
+ elevation: 201.
46
+
47
+ # communication
48
+ comm:
49
+ jid: test@example.com
50
+ password: ***
51
+
52
+ # virtual file system
53
+ vfs:
54
+ class: pyobs.vfs.VirtualFileSystem
55
+ roots:
56
+ cache:
57
+ class: pyobs.vfs.HttpFile
58
+ upload: http://localhost:37075/
59
+
60
+
61
+ Available classes
62
+ *****************
63
+
64
+ The base class for all SBIG cameras is :ref:`SbigCamera`, which can be used for all camera types without an integrated
65
+ filter wheel. For those that do have one, you must use :ref:`SbigFilterCamera`. There is a special implementation
66
+ for SBIG-6303E cameras in :ref:`Sbig6303eCamera`.
67
+
68
+ SbigCamera
69
+ ==========
70
+ .. autoclass:: pyobs_sbig.SbigCamera
71
+ :members:
72
+ :show-inheritance:
73
+
74
+ SbigFilterCamera
75
+ ================
76
+ .. autoclass:: pyobs_sbig.SbigFilterCamera
77
+ :members:
78
+ :show-inheritance:
79
+
80
+ Sbig6303eCamera
81
+ ===============
82
+ .. autoclass:: pyobs_sbig.Sbig6303eCamera
83
+ :members:
84
+ :show-inheritance:
@@ -0,0 +1,56 @@
1
+ [project]
2
+ name = "pyobs-sbig"
3
+ version = "2.0.0.dev2"
4
+ description = "pyobs module for SBIG cameras"
5
+ authors = [{ name = "Tim-Oliver Husser", email = "thusser@uni-goettingen.de" }]
6
+ requires-python = ">=3.11,<3.15"
7
+ license = "MIT"
8
+ dependencies = [
9
+ "astropy>=7.0.1,<8",
10
+ "numpy>=2.2.5,<3",
11
+ "pyobs-core>=2.0.0.dev6,<3",
12
+ ]
13
+
14
+ [project.optional-dependencies]
15
+ gui = [
16
+ "qfitswidget>=0.13.1",
17
+ "pyside6>=6.11.0",
18
+ "qasync>=0.28.0",
19
+ ]
20
+
21
+ [dependency-groups]
22
+ dev = [
23
+ "black>=25.1.0,<26",
24
+ "ruff>=0.9.0",
25
+ "pyrefly>=1.1.1",
26
+ "pre-commit>=4.2.0,<5",
27
+ "cython>=3.0.0,<4",
28
+ ]
29
+
30
+ [project.scripts]
31
+ sbig-gui = 'pyobs_sbig.gui:main'
32
+
33
+ [tool.setuptools]
34
+ py-modules = []
35
+
36
+ [tool.scikit-build]
37
+ wheel.packages = ["src/pyobs_sbig"]
38
+
39
+ [build-system]
40
+ requires = ["scikit_build_core>=0.12", "cython>=3.0", "cython-cmake", "numpy>=2.0"]
41
+ build-backend = "scikit_build_core.build"
42
+
43
+ [tool.black]
44
+ line-length = 120
45
+ target-version = ['py313']
46
+
47
+ [tool.ruff]
48
+ target-version = "py311"
49
+ line-length = 120
50
+
51
+ [tool.ruff.lint]
52
+ select = ["E", "F", "W", "I", "UP", "G"]
53
+
54
+ [tool.pyrefly]
55
+ python-version = "3.11"
56
+ ignore-missing-imports = ["PySide6.*", "qasync.*"]
@@ -0,0 +1,3 @@
1
+ from .sbig6303e import Sbig6303eCamera as Sbig6303eCamera
2
+ from .sbigcamera import SbigCamera as SbigCamera
3
+ from .sbigfiltercamera import SbigFilterCamera as SbigFilterCamera
@@ -0,0 +1,109 @@
1
+ import asyncio
2
+ import sys
3
+
4
+ import qasync # type: ignore
5
+ from astropy.io import fits
6
+ from pyobs.utils.gui.camera import (
7
+ BinningWidget,
8
+ DataDisplayWidget,
9
+ ExposeWidget,
10
+ ExposureTimeWidget,
11
+ )
12
+ from pyobs.utils.gui.camera.windowingwidget import WindowingWidget
13
+ from PySide6 import QtWidgets
14
+
15
+ from .sbigudrv import SBIGCam, SBIGImg # type: ignore
16
+
17
+
18
+ class MainWindow(QtWidgets.QMainWindow):
19
+ def __init__(self) -> None:
20
+ super().__init__()
21
+
22
+ # create image and cam
23
+ self._img = SBIGImg()
24
+ self._cam = SBIGCam()
25
+
26
+ self._cam.establish_link()
27
+ full_frame = self._cam.full_frame
28
+
29
+ self.central_widget = QtWidgets.QWidget()
30
+ self.setCentralWidget(self.central_widget)
31
+
32
+ global_layout = QtWidgets.QHBoxLayout()
33
+ self.central_widget.setLayout(global_layout)
34
+ self.widgets_frame = QtWidgets.QGroupBox()
35
+ self.data_display_widget = DataDisplayWidget()
36
+ global_layout.addWidget(self.widgets_frame)
37
+ global_layout.addWidget(self.data_display_widget)
38
+
39
+ layout = QtWidgets.QVBoxLayout()
40
+ self.widgets_frame.setLayout(layout)
41
+ self.window_widget = WindowingWidget(full_frame[2], full_frame[3])
42
+ layout.addWidget(self.window_widget)
43
+ self.binning_widget = BinningWidget([(1, 1), (2, 2)])
44
+ self.binning_widget.binning_changed.connect(self.window_widget.set_binning)
45
+ layout.addWidget(self.binning_widget)
46
+ self.exposure_time = ExposureTimeWidget()
47
+ layout.addWidget(self.exposure_time)
48
+ self.expose = ExposeWidget()
49
+ layout.addWidget(self.expose)
50
+
51
+ self.abort_exposure = asyncio.Event()
52
+ self.expose.expose_clicked.connect(self._expose_clicked)
53
+ self.expose.abort_clicked.connect(self._abort_clicked)
54
+
55
+ @qasync.asyncSlot() # type: ignore
56
+ async def _expose_clicked(self) -> None:
57
+ # init image
58
+ self._img.image_can_close = False
59
+
60
+ # set exposure time, window and binning
61
+ self._cam.exposure_time = self.exposure_time.value
62
+ self._cam.window = self.window_widget.values
63
+ self._cam.binning = (1, 1)
64
+
65
+ # start exposure
66
+ self._cam.start_exposure(self._img, False)
67
+
68
+ # wait for it
69
+ while not self._cam.has_exposure_finished():
70
+ await asyncio.sleep(0.01)
71
+
72
+ # finish exposure
73
+ self._cam.end_exposure()
74
+
75
+ # wait for readout
76
+ loop = asyncio.get_running_loop()
77
+ await loop.run_in_executor(None, self._cam.readout, self._img, False)
78
+
79
+ # finalize image
80
+ self._img.image_can_close = True
81
+
82
+ # download data
83
+ data = self._img.data
84
+
85
+ self.expose.set_exposures_left()
86
+ image = fits.PrimaryHDU(data)
87
+ self.data_display_widget.set_data(image)
88
+
89
+ @qasync.asyncSlot() # type: ignore
90
+ async def _abort_clicked(self) -> None:
91
+ self.abort_exposure.set()
92
+ self.abort_exposure = asyncio.Event()
93
+
94
+
95
+ async def async_main(app: QtWidgets.QApplication) -> None:
96
+ app_close_event = asyncio.Event()
97
+ app.aboutToQuit.connect(app_close_event.set)
98
+ main_window = MainWindow()
99
+ main_window.show()
100
+ await app_close_event.wait()
101
+
102
+
103
+ def main() -> None:
104
+ app = QtWidgets.QApplication(sys.argv)
105
+ asyncio.run(async_main(app), loop_factory=qasync.QEventLoop) # type: ignore
106
+
107
+
108
+ if __name__ == "__main__":
109
+ main()
@@ -1,10 +1,10 @@
1
1
  import asyncio
2
2
  import logging
3
- from typing import Any, Optional
3
+ from typing import Any
4
4
 
5
5
  from pyobs.images import Image
6
- from .sbigfiltercamera import SbigFilterCamera
7
6
 
7
+ from .sbigfiltercamera import SbigFilterCamera
8
8
 
9
9
  log = logging.getLogger(__name__)
10
10
 
@@ -29,13 +29,11 @@ class Sbig6303eCamera(SbigFilterCamera):
29
29
  GrabImageError: If exposure was not successful.
30
30
  """
31
31
 
32
- # do expsure
32
+ # do exposure
33
33
  img = await SbigFilterCamera._expose(self, exposure_time, open_shutter, abort_event)
34
34
 
35
- # get binning
36
- xbin, ybin = await self.get_binning()
37
-
38
35
  # gain is different in binned images
36
+ xbin, ybin = self._binning
39
37
  gain = (1.4, "Detector gain [e-/ADU]") if xbin == ybin == 1 else (2.3, "Detector gain [e-/ADU]")
40
38
  img.header["DET-GAIN"] = gain
41
39
 
@@ -48,11 +46,8 @@ class Sbig6303eCamera(SbigFilterCamera):
48
46
  async def park(self, **kwargs: Any) -> None:
49
47
  pass
50
48
 
51
- async def stop_motion(self, device: Optional[str] = None, **kwargs: Any) -> None:
49
+ async def stop_motion(self, device: str | None = None, **kwargs: Any) -> None:
52
50
  pass
53
51
 
54
- async def is_ready(self, **kwargs: Any) -> bool:
55
- return True
56
-
57
52
 
58
53
  __all__ = ["Sbig6303eCamera"]