From d189213cc6c7eb28de2fc50ca67be4222afc7cf0 Mon Sep 17 00:00:00 2001 From: Ivo Vellekoop Date: Thu, 3 Oct 2024 11:55:01 +0200 Subject: [PATCH] removed t_f field that was not used any longer --- openwfs/devices/__init__.py | 7 +++++-- openwfs/devices/slm/__init__.py | 17 +++++++++++++++++ pyproject.toml | 9 +++------ 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/openwfs/devices/__init__.py b/openwfs/devices/__init__.py index 924c169..43c69e6 100644 --- a/openwfs/devices/__init__.py +++ b/openwfs/devices/__init__.py @@ -10,5 +10,8 @@ except ImportError: pass # ok, we don't have nidaqmx installed -from . import slm -from .slm import SLM +try: + from . import slm + from .slm import SLM +except ImportError: + pass # ok, we don't have glfw or PyOpenGL installed diff --git a/openwfs/devices/slm/__init__.py b/openwfs/devices/slm/__init__.py index 31142aa..02ef2d2 100644 --- a/openwfs/devices/slm/__init__.py +++ b/openwfs/devices/slm/__init__.py @@ -1,3 +1,20 @@ +try: + import glfw + import OpenGL +except ImportError: + raise ImportError( + """Could not initialize OpenGL because the glfw or PyOpenGL package is missing. + To install, make sure to install the required packages: + ```pip install glfw``` + ```pip install PyOpenGL``` + Alternatively, specify the opengl extra when installing openwfs: + ```pip install openwfs[opengl]``` + + Note that these installs will fail if no suitable OpenGL driver is found on the system. + Please make sure you have the latest video drivers installed. + """ + ) + from . import geometry from . import patch from . import shaders diff --git a/pyproject.toml b/pyproject.toml index b5fdf08..07ca0e1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,6 @@ build-backend = "poetry.core.masonry.api" python = ">=3.9,<4.0" numpy = ">=1.25.2" # also allow numpy 2.x.y astropy = ">=5.1.0" # assuming the astropy.units is stable -glfw = "^2.5.9" opencv-python = "^4.9.0.80" matplotlib = "^3.7.3" scipy = "^1.11.3" @@ -32,11 +31,8 @@ annotated-types = "^0.7.0" # optional dependencies for hardware components nidaqmx = { version = "^1.0.1", optional = true } harvesters = { version = "^1.4.2", optional = true } - -[tool.poetry.group.opengl.dependencies] -# also required, but can be omitted explicitly using the without option -# this is used for read the docs, which has trouble with the OpenGL dependency -PyOpenGL = "^3.1.7" +PyOpenGL = { version = "^3.1.7", optional = true } +glfw = { version = "^2.5.9", optional = true } [tool.poetry.extras] # optional dependencies for hardware components @@ -45,6 +41,7 @@ PyOpenGL = "^3.1.7" # or poetry install --extras "nidaq" --extras "genicam" nidaq = ["nidaqmx"] genicam = ["harvesters"] +opengl = ["PyOpenGL", "glfw"] [tool.black] line-length = 120