opticalib 2.5.1__tar.gz → 2.5.2__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.
- {opticalib-2.5.1/opticalib.egg-info → opticalib-2.5.2}/PKG-INFO +1 -1
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/_version.py +3 -3
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/ground/geometry.py +0 -2
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/kernel_side.py +36 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/widgets/device_panel.py +75 -6
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/simulator/_API/base_fake_adopticadm.py +22 -7
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/simulator/fake_dms.py +11 -3
- {opticalib-2.5.1 → opticalib-2.5.2/opticalib.egg-info}/PKG-INFO +1 -1
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib.egg-info/scm_version.json +2 -2
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_gui_devices.py +68 -3
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_gui_kernel_side.py +58 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/CITATION.bib +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/LICENSE +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/MANIFEST.in +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/README.md +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/__init__.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/__init_script__/initCalpy.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/__version__.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/analyzer/__init__.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/analyzer/image_processing.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/analyzer/signals.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/analyzer/timeseries.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/core/__init__.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/core/_configurations/DOCS.md +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/core/_configurations/configuration.yaml +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/core/_types.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/core/config.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/core/data_classes.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/core/decorators.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/core/exceptions.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/core/fitsarray.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/core/root.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/devices/_API/__init__.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/devices/_API/base_devices.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/devices/_API/cameras/GigE_live_viewer.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/devices/_API/cameras/__init__.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/devices/_API/cameras/frame_buffer.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/devices/_API/dms/__init__.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/devices/_API/dms/alpaoAPI.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/devices/_API/dms/micAPI.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/devices/_API/dms/nacoAPI.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/devices/_API/dms/piAPI.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/devices/_API/dms/splattAPI.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/devices/_API/wfs/__init__.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/devices/_API/wfs/i4dAPI.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/devices/_API/wfs/pupil_detector.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/devices/__init__.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/devices/cameras.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/devices/deformable_mirrors.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/devices/interferometer.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/devices/wfs.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/dmutils/__actuator_identification_wip.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/dmutils/__init__.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/dmutils/__pupil_calibration_wip.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/dmutils/_misc.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/dmutils/flattening.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/dmutils/iff_preparation.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/dmutils/iff_processing.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/dmutils/slaving.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/ground/__init__.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/ground/_stitching_algorithm.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/ground/logger.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/ground/modal_decomposer.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/ground/osutils.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/ground/reconstructor.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/ground/roi.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/__init__.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/activity.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/app.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/kernel.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/kernel_backend.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/plugins.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/procedures/__init__.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/procedures/alignment.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/procedures/base.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/procedures/dm_calibration.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/procedures/params.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/procedures/phasing.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/procedures/stitching.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/procedures/timeseries.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/resources/opticalib.ico +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/resources/opticalib.png +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/resources/opticalib.svg +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/theme.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/widgets/__init__.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/widgets/common.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/widgets/config_editor.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/widgets/connect_dialog.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/widgets/data_browser.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/widgets/device_registry.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/widgets/plot_viewer.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/gui/widgets/workspace.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/procedures/__init__.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/procedures/alignment.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/procedures/iff.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/procedures/measurements.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/procedures/phasing.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/procedures/stitching.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/py.typed +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/simulator/_API/__init__.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/simulator/_API/alpao_conf.yaml +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/simulator/_API/base_fake_alpao.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/simulator/_API/base_petalmirror.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/simulator/_API/base_simulated_dm.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/simulator/_API/simdata.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/simulator/__init__.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/simulator/factory.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/simulator/fake_interf.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib/visualization.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib.egg-info/SOURCES.txt +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib.egg-info/dependency_links.txt +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib.egg-info/entry_points.txt +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib.egg-info/requires.txt +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib.egg-info/scm_file_list.json +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/opticalib.egg-info/top_level.txt +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/pyproject.toml +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/pytest.ini +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/setup.cfg +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/setup_calpy.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/README.md +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/__init__.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/conftest.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_analyzer_images_processing.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_analyzer_signals.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_analyzer_timeseries.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_core_dataclass.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_core_exceptions.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_core_fits.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_core_read_config.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_core_root.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_devices_cameras.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_devices_cameras_no_vmbpy.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_devices_deformable_mirrors.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_devices_interferometer.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_devices_wfs.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_dmutils_flattening.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_dmutils_iff_acquisition_preparation.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_dmutils_iff_module.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_dmutils_iff_normalization.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_dmutils_iff_processing.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_dmutils_slaving.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_ground_computerec.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_ground_geometry.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_ground_logger.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_ground_modal_decomposer.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_ground_osutils.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_ground_roi.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_ground_stitching_algorithm.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_gui_activity.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_gui_app.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_gui_config_editor.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_gui_kernel_bridge.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_gui_procedures.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_gui_widgets.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_measurements.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_portability.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_setup_calpy.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_simulator_factory_functions.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_simulator_run_cmd_history.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_simulator_simdata.py +0 -0
- {opticalib-2.5.1 → opticalib-2.5.2}/tests/test_typings.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: opticalib
|
|
3
|
-
Version: 2.5.
|
|
3
|
+
Version: 2.5.2
|
|
4
4
|
Summary: This package is a python interface for laboratory adaptive optics systems, with a focus on the calibration of deformable mirrors (DMs) and the acquisition of wavefront data using wavefront sensors.
|
|
5
5
|
Author-email: Adaptive Optics Group - INAF - Osservatorio Astrofisico di Arcetri <pietro.ferraiuolo@inaf.it>
|
|
6
6
|
Maintainer-email: Pietro Ferraiuolo <pietro.ferraiuolo@inaf.it>
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '2.5.
|
|
22
|
-
__version_tuple__ = version_tuple = (2, 5,
|
|
21
|
+
__version__ = version = '2.5.2'
|
|
22
|
+
__version_tuple__ = version_tuple = (2, 5, 2)
|
|
23
23
|
|
|
24
|
-
__commit_id__ = commit_id = '
|
|
24
|
+
__commit_id__ = commit_id = 'g17841ea46'
|
|
@@ -26,6 +26,7 @@ MIME types below; the GUI console intercepts them.
|
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
28
|
import base64 as _base64
|
|
29
|
+
import gc as _gc
|
|
29
30
|
import io as _io
|
|
30
31
|
import itertools as _itertools
|
|
31
32
|
import json as _json
|
|
@@ -545,6 +546,41 @@ def backend() -> str:
|
|
|
545
546
|
)
|
|
546
547
|
|
|
547
548
|
|
|
549
|
+
def release(name: str, shell=None) -> None:
|
|
550
|
+
"""
|
|
551
|
+
Delete a variable and let go of the object it held (like ``%xdel``).
|
|
552
|
+
|
|
553
|
+
The object is deleted when nothing refers to it any more: its class can
|
|
554
|
+
then release the hardware (``__del__``). Besides the variable, IPython
|
|
555
|
+
keeps references to what it displayed (``Out[n]``, ``_``, the last
|
|
556
|
+
result), e.g. after *Show in console*: they are dropped too, with any
|
|
557
|
+
other name bound to the same object, and a garbage collection frees the
|
|
558
|
+
reference cycles. Holders outside the namespace (e.g. an interferometer
|
|
559
|
+
built on the DM) are left alone, and keep the object alive.
|
|
560
|
+
|
|
561
|
+
Parameters
|
|
562
|
+
----------
|
|
563
|
+
name : str
|
|
564
|
+
Variable to delete.
|
|
565
|
+
shell : InteractiveShell, optional
|
|
566
|
+
The IPython shell; defaults to the running one.
|
|
567
|
+
|
|
568
|
+
Raises
|
|
569
|
+
------
|
|
570
|
+
NameError
|
|
571
|
+
If the variable does not exist.
|
|
572
|
+
"""
|
|
573
|
+
shell = shell or _shell()
|
|
574
|
+
if name not in shell.user_ns:
|
|
575
|
+
raise NameError(f"name {name!r} is not defined")
|
|
576
|
+
try:
|
|
577
|
+
shell.del_var(name, by_name=False)
|
|
578
|
+
except AttributeError:
|
|
579
|
+
# IPython fails to look at the last result after a ``%reset``.
|
|
580
|
+
shell.user_ns.pop(name, None)
|
|
581
|
+
_gc.collect()
|
|
582
|
+
|
|
583
|
+
|
|
548
584
|
#: Experiment folder this module put on ``sys.path`` (see :func:`use_experiment`).
|
|
549
585
|
_experiment_path: Optional[str] = None
|
|
550
586
|
|
|
@@ -186,6 +186,18 @@ SIMULATED_DEVICES: List[DeviceInfo] = [
|
|
|
186
186
|
tooltip="Simulated AdOptica DP (2 segments). The first build "
|
|
187
187
|
"downloads data and computes the influence functions.",
|
|
188
188
|
),
|
|
189
|
+
DeviceInfo(
|
|
190
|
+
key="sim:m4",
|
|
191
|
+
title="M4 Adaptive Unit",
|
|
192
|
+
kind="dm",
|
|
193
|
+
var_name="dm",
|
|
194
|
+
class_name="M4AU",
|
|
195
|
+
module_prefix="opticalib.simulator",
|
|
196
|
+
build_code=_simulated("from opticalib.simulator import M4AU\ndm = M4AU()"),
|
|
197
|
+
simulated=True,
|
|
198
|
+
tooltip="Simulated AdOptica M4 Adaptive Unit (6 segments). The first build "
|
|
199
|
+
"downloads all the mirror's official simulated data.",
|
|
200
|
+
),
|
|
189
201
|
DeviceInfo(
|
|
190
202
|
key="sim:petal",
|
|
191
203
|
title="Petal mirror",
|
|
@@ -329,6 +341,7 @@ STATUS_STYLES: Dict[str, Tuple[str, str]] = {
|
|
|
329
341
|
"queued": ("Queued", "warning"),
|
|
330
342
|
"connecting": ("Connecting…", "accent"),
|
|
331
343
|
"connected": ("Connected", "success"),
|
|
344
|
+
"disconnecting": ("Disconnecting…", "warning"),
|
|
332
345
|
"error": ("Failed", "danger"),
|
|
333
346
|
"unavailable": ("Needs a DM", "text_muted"),
|
|
334
347
|
"setup": ("Needs setup", "warning"),
|
|
@@ -352,6 +365,8 @@ class DeviceCard(QFrame):
|
|
|
352
365
|
The user asked to connect the device (the card is passed).
|
|
353
366
|
setup_requested(object)
|
|
354
367
|
The user asked to connect with options (opens the connect dialog).
|
|
368
|
+
disconnect_requested(object)
|
|
369
|
+
The user asked to disconnect the device (the card is passed).
|
|
355
370
|
edit_requested(object)
|
|
356
371
|
The user asked to edit the configuration entry.
|
|
357
372
|
action_requested(str, str)
|
|
@@ -362,6 +377,7 @@ class DeviceCard(QFrame):
|
|
|
362
377
|
|
|
363
378
|
connect_requested = Signal(object)
|
|
364
379
|
setup_requested = Signal(object)
|
|
380
|
+
disconnect_requested = Signal(object)
|
|
365
381
|
edit_requested = Signal(object)
|
|
366
382
|
action_requested = Signal(str, str)
|
|
367
383
|
status_changed = Signal()
|
|
@@ -394,6 +410,10 @@ class DeviceCard(QFrame):
|
|
|
394
410
|
self._button = QPushButton("Connect")
|
|
395
411
|
self._button.setProperty("accent", True)
|
|
396
412
|
self._button.clicked.connect(self._on_button)
|
|
413
|
+
self._disconnect_button = QPushButton("Disconnect")
|
|
414
|
+
self._disconnect_button.clicked.connect(
|
|
415
|
+
lambda: self.disconnect_requested.emit(self)
|
|
416
|
+
)
|
|
397
417
|
self._more = QToolButton()
|
|
398
418
|
self._more.setToolTip("More actions")
|
|
399
419
|
self._more.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
|
|
@@ -407,11 +427,9 @@ class DeviceCard(QFrame):
|
|
|
407
427
|
header.addWidget(self._status)
|
|
408
428
|
actions = QHBoxLayout()
|
|
409
429
|
actions.setSpacing(6)
|
|
410
|
-
|
|
411
|
-
actions.addWidget(self._combo, 1)
|
|
412
|
-
else:
|
|
413
|
-
actions.addStretch(1)
|
|
430
|
+
actions.addStretch(1)
|
|
414
431
|
actions.addWidget(self._button)
|
|
432
|
+
actions.addWidget(self._disconnect_button)
|
|
415
433
|
actions.addWidget(self._more)
|
|
416
434
|
layout = QVBoxLayout(self)
|
|
417
435
|
layout.setContentsMargins(10, 8, 8, 8)
|
|
@@ -419,6 +437,10 @@ class DeviceCard(QFrame):
|
|
|
419
437
|
layout.addLayout(header)
|
|
420
438
|
layout.addWidget(self._subtitle)
|
|
421
439
|
layout.addWidget(self._problem)
|
|
440
|
+
# The option has a row of its own: next to the Reconnect and
|
|
441
|
+
# Disconnect buttons it would not fit in a narrow panel.
|
|
442
|
+
if self._combo is not None:
|
|
443
|
+
layout.addWidget(self._combo)
|
|
422
444
|
layout.addLayout(actions)
|
|
423
445
|
|
|
424
446
|
theme().changed.connect(self._refresh)
|
|
@@ -496,8 +518,14 @@ class DeviceCard(QFrame):
|
|
|
496
518
|
self._status.setText(f"<span style='color:{t.tokens[token]}'>●</span> {label}")
|
|
497
519
|
self._status.setToolTip(self.message)
|
|
498
520
|
self._more.setIcon(t.icon("dots-vertical"))
|
|
499
|
-
busy = self.status in ("queued", "connecting")
|
|
521
|
+
busy = self.status in ("queued", "connecting", "disconnecting")
|
|
500
522
|
self._button.setEnabled(not busy and self.status != "unavailable")
|
|
523
|
+
# Only a connected device can be disconnected.
|
|
524
|
+
self._disconnect_button.setVisible(self.status == "connected")
|
|
525
|
+
self._disconnect_button.setToolTip(
|
|
526
|
+
f"Delete '{self.info.var_name}' from the kernel; the device class "
|
|
527
|
+
"releases the hardware when the object is deleted."
|
|
528
|
+
)
|
|
501
529
|
if shown == "setup":
|
|
502
530
|
self._button.setText("Set up…")
|
|
503
531
|
else:
|
|
@@ -748,6 +776,7 @@ class DevicePanel(QWidget):
|
|
|
748
776
|
card = DeviceCard(info)
|
|
749
777
|
card.connect_requested.connect(self._connect)
|
|
750
778
|
card.setup_requested.connect(self.open_connect_dialog)
|
|
779
|
+
card.disconnect_requested.connect(self._disconnect)
|
|
751
780
|
card.edit_requested.connect(
|
|
752
781
|
lambda c: self.edit_config_requested.emit(
|
|
753
782
|
c.info.entry.section, c.info.entry.name
|
|
@@ -895,6 +924,42 @@ class DevicePanel(QWidget):
|
|
|
895
924
|
if task is not None:
|
|
896
925
|
task.changed.connect(started)
|
|
897
926
|
|
|
927
|
+
def _disconnect(self, card: DeviceCard) -> None:
|
|
928
|
+
"""
|
|
929
|
+
Delete the variable of a connected device in the kernel.
|
|
930
|
+
|
|
931
|
+
The command is run (and echoed) in the console; the class of the
|
|
932
|
+
device closes the hardware when the object is deleted (see
|
|
933
|
+
:func:`~opticalib.gui.kernel_side.release`).
|
|
934
|
+
"""
|
|
935
|
+
key = card.info.key
|
|
936
|
+
var = card.info.var_name
|
|
937
|
+
|
|
938
|
+
def done(task):
|
|
939
|
+
c = self._cards.get(key)
|
|
940
|
+
if c is not None:
|
|
941
|
+
c.set_status("disconnected")
|
|
942
|
+
|
|
943
|
+
def failed(task):
|
|
944
|
+
c = self._cards.get(key)
|
|
945
|
+
if c is None:
|
|
946
|
+
return
|
|
947
|
+
error = task.error or {}
|
|
948
|
+
if error.get("ename") == "NameError":
|
|
949
|
+
# The variable was already gone: that is what was asked.
|
|
950
|
+
c.set_status("disconnected")
|
|
951
|
+
else:
|
|
952
|
+
c.set_status(
|
|
953
|
+
"error",
|
|
954
|
+
f"{error.get('ename', 'Error')}: {error.get('evalue', '')}",
|
|
955
|
+
)
|
|
956
|
+
|
|
957
|
+
task = self._runner(
|
|
958
|
+
f"_gui.release({var!r})", f"Disconnecting {card.info.title}", done, failed
|
|
959
|
+
)
|
|
960
|
+
if task is not None:
|
|
961
|
+
card.set_status("disconnecting")
|
|
962
|
+
|
|
898
963
|
def _mark_owner(self, owner: DeviceCard) -> None:
|
|
899
964
|
"""Only *owner* is connected to its variable after a (re)connection."""
|
|
900
965
|
for card in self._cards.values():
|
|
@@ -952,7 +1017,11 @@ class DevicePanel(QWidget):
|
|
|
952
1017
|
):
|
|
953
1018
|
candidates[0].set_status("connected")
|
|
954
1019
|
for card in cards:
|
|
955
|
-
if card.info.requires is None or card.status in (
|
|
1020
|
+
if card.info.requires is None or card.status in (
|
|
1021
|
+
"queued",
|
|
1022
|
+
"connecting",
|
|
1023
|
+
"disconnecting",
|
|
1024
|
+
):
|
|
956
1025
|
continue
|
|
957
1026
|
available = any(
|
|
958
1027
|
item.get("kind") == card.info.requires and name == card.info.requires
|
|
@@ -43,24 +43,34 @@ class BaseFakeM4(BaseSimulatedDM):
|
|
|
43
43
|
|
|
44
44
|
def __init__(self):
|
|
45
45
|
"""The constuctor"""
|
|
46
|
-
## -- DATA LOADING AND CREATION -- ##
|
|
47
|
-
self._name = "M4AU"
|
|
48
|
-
self._load_m4_data()
|
|
49
|
-
self._ZM = None
|
|
50
|
-
|
|
51
46
|
## -- DM properties -- ##
|
|
52
47
|
self.is_segmented = True
|
|
53
48
|
self.n_segments = 6
|
|
54
49
|
self.n_acts_per_segment = 892
|
|
55
50
|
self.n_acts = self.n_acts_per_segment * self.n_segments
|
|
51
|
+
self._slaveIds = []
|
|
52
|
+
self._borderIds = []
|
|
53
|
+
|
|
54
|
+
## -- DATA LOADING AND CREATION -- ##
|
|
55
|
+
self._name = "M4AU"
|
|
56
|
+
self._load_m4_data()
|
|
57
|
+
self._ZM = None
|
|
56
58
|
|
|
57
59
|
## -- INITIALIZATION -- ##
|
|
58
60
|
super().__init__()
|
|
59
61
|
self._shape = (
|
|
60
62
|
np.ma.masked_array(self._mask * 0, mask=self._mask, dtype=float)
|
|
61
|
-
)
|
|
63
|
+
)
|
|
62
64
|
self._seg_masks = roi.roi_generator(self._shape)
|
|
63
65
|
|
|
66
|
+
@property
|
|
67
|
+
def slave_ids(self):
|
|
68
|
+
return self._slaveIds
|
|
69
|
+
|
|
70
|
+
@property
|
|
71
|
+
def border_ids(self):
|
|
72
|
+
return self._borderIds
|
|
73
|
+
|
|
64
74
|
@property
|
|
65
75
|
def act_coord(self) -> _t.ArrayLike:
|
|
66
76
|
"""Actuator coordinates in pixels."""
|
|
@@ -288,7 +298,12 @@ class BaseFakeDp(BaseSimulatedDM):
|
|
|
288
298
|
img = np.ma.masked_array(pimg, mask=pmask)
|
|
289
299
|
return geo.rotate_image(img, angle_deg=-70)
|
|
290
300
|
|
|
291
|
-
def _mirror_command(
|
|
301
|
+
def _mirror_command(
|
|
302
|
+
self,
|
|
303
|
+
cmd: _t.ArrayLike,
|
|
304
|
+
differential: bool = False,
|
|
305
|
+
modal: bool=False
|
|
306
|
+
):
|
|
292
307
|
"""
|
|
293
308
|
Applies the given command to the deformable mirror.
|
|
294
309
|
|
|
@@ -241,7 +241,12 @@ class M4AU(BaseFakeM4):
|
|
|
241
241
|
def __repr__(self) -> str:
|
|
242
242
|
return f"{self._name}(n_segments={self.n_segments}, n_acts_per_segment={self.n_acts_per_segment})"
|
|
243
243
|
|
|
244
|
-
def _mirror_command(
|
|
244
|
+
def _mirror_command(
|
|
245
|
+
self,
|
|
246
|
+
cmd: _t.ArrayLike,
|
|
247
|
+
differential: bool = False,
|
|
248
|
+
modal: bool = False
|
|
249
|
+
):
|
|
245
250
|
"""
|
|
246
251
|
Applies the given command to the deformable mirror.
|
|
247
252
|
|
|
@@ -258,6 +263,7 @@ class M4AU(BaseFakeM4):
|
|
|
258
263
|
numpy.ndarray
|
|
259
264
|
Processed shape based on the command.
|
|
260
265
|
"""
|
|
266
|
+
shape = self._shape.flatten()
|
|
261
267
|
if not len(cmd) == self.n_acts:
|
|
262
268
|
raise CommandError(
|
|
263
269
|
f"Command length {len(cmd)} does not match the number of actuators {self.n_acts}."
|
|
@@ -274,8 +280,10 @@ class M4AU(BaseFakeM4):
|
|
|
274
280
|
else:
|
|
275
281
|
cmd_amp = cmd[seg * nsag : (seg + 1) * nsag]
|
|
276
282
|
|
|
277
|
-
if not
|
|
283
|
+
if not differential:
|
|
278
284
|
cmd_amp = cmd_amp - self._act_pos[seg * nsag : (seg + 1) * nsag]
|
|
279
285
|
|
|
280
|
-
|
|
286
|
+
shape[idx] += np.dot(cmd_amp, self.im[seg])
|
|
281
287
|
self._act_pos[seg * nsag : (seg + 1) * nsag] += cmd_amp
|
|
288
|
+
|
|
289
|
+
self._shape = shape.reshape(self._mask.shape)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: opticalib
|
|
3
|
-
Version: 2.5.
|
|
3
|
+
Version: 2.5.2
|
|
4
4
|
Summary: This package is a python interface for laboratory adaptive optics systems, with a focus on the calibration of deformable mirrors (DMs) and the acquisition of wavefront data using wavefront sensors.
|
|
5
5
|
Author-email: Adaptive Optics Group - INAF - Osservatorio Astrofisico di Arcetri <pietro.ferraiuolo@inaf.it>
|
|
6
6
|
Maintainer-email: Pietro Ferraiuolo <pietro.ferraiuolo@inaf.it>
|
|
@@ -355,6 +355,70 @@ class TestDevicePanel:
|
|
|
355
355
|
assert requested == [("INTERFEROMETERS", "Mystery")]
|
|
356
356
|
|
|
357
357
|
|
|
358
|
+
class TestDisconnect:
|
|
359
|
+
"""The Disconnect button of connected cards."""
|
|
360
|
+
|
|
361
|
+
@staticmethod
|
|
362
|
+
def _connect(panel, key="sim:petal"):
|
|
363
|
+
card = panel.card(key)
|
|
364
|
+
card._button.click()
|
|
365
|
+
task = panel.tasks[-1]
|
|
366
|
+
task._start("m")
|
|
367
|
+
task._finish("done")
|
|
368
|
+
assert card.status == "connected"
|
|
369
|
+
return card
|
|
370
|
+
|
|
371
|
+
def test_buttons_follow_the_connection(self, panel):
|
|
372
|
+
card = panel.card("sim:petal")
|
|
373
|
+
assert card._button.text() == "Connect" and card._disconnect_button.isHidden()
|
|
374
|
+
self._connect(panel)
|
|
375
|
+
assert card._button.text() == "Reconnect" and not card._disconnect_button.isHidden()
|
|
376
|
+
assert "'dm'" in card._disconnect_button.toolTip()
|
|
377
|
+
card.set_status("error", "boom")
|
|
378
|
+
assert card._disconnect_button.isHidden()
|
|
379
|
+
|
|
380
|
+
def test_disconnect_deletes_the_variable(self, panel):
|
|
381
|
+
card = self._connect(panel)
|
|
382
|
+
count = len(panel.tasks)
|
|
383
|
+
card._disconnect_button.click()
|
|
384
|
+
assert len(panel.tasks) == count + 1
|
|
385
|
+
task = panel.tasks[-1]
|
|
386
|
+
assert task.code == "_gui.release('dm')" and card.status == "disconnecting"
|
|
387
|
+
assert not card._button.isEnabled() and card._disconnect_button.isHidden()
|
|
388
|
+
task._start("m")
|
|
389
|
+
task._finish("done")
|
|
390
|
+
assert card.status == "disconnected" and card._button.text() == "Connect"
|
|
391
|
+
assert card._button.isEnabled()
|
|
392
|
+
|
|
393
|
+
def test_variable_already_gone(self, panel):
|
|
394
|
+
card = self._connect(panel)
|
|
395
|
+
card._disconnect_button.click()
|
|
396
|
+
task = panel.tasks[-1]
|
|
397
|
+
task._start("m")
|
|
398
|
+
task._finish("error", {"ename": "NameError", "evalue": "name 'dm' is not defined"})
|
|
399
|
+
assert card.status == "disconnected"
|
|
400
|
+
|
|
401
|
+
def test_failure_is_reported(self, panel):
|
|
402
|
+
card = self._connect(panel)
|
|
403
|
+
card._disconnect_button.click()
|
|
404
|
+
task = panel.tasks[-1]
|
|
405
|
+
task._start("m")
|
|
406
|
+
task._finish("error", {"ename": "RuntimeError", "evalue": "hardware busy"})
|
|
407
|
+
assert card.status == "error" and "hardware busy" in card.message
|
|
408
|
+
|
|
409
|
+
def test_dependent_cards_follow(self, panel):
|
|
410
|
+
self._connect(panel)
|
|
411
|
+
interf = panel.card("sim:interf")
|
|
412
|
+
panel.update_workspace([_ws("dm", "PetalMirror", "opticalib.simulator.fake_dms", "dm")])
|
|
413
|
+
assert interf.status == "disconnected"
|
|
414
|
+
card = panel.card("sim:petal")
|
|
415
|
+
card._disconnect_button.click()
|
|
416
|
+
panel.tasks[-1]._start("m")
|
|
417
|
+
panel.tasks[-1]._finish("done")
|
|
418
|
+
panel.update_workspace([])
|
|
419
|
+
assert interf.status == "unavailable"
|
|
420
|
+
|
|
421
|
+
|
|
358
422
|
class TestConnectDialog:
|
|
359
423
|
"""Tests for the connect dialog and how the panel applies it."""
|
|
360
424
|
|
|
@@ -907,15 +971,16 @@ class TestCollapsibleGroups:
|
|
|
907
971
|
|
|
908
972
|
def test_summary_follows_the_cards(self, panel):
|
|
909
973
|
section = panel.simulated_section
|
|
910
|
-
|
|
974
|
+
total = f"{len(dp.SIMULATED_DEVICES)} devices"
|
|
975
|
+
assert section._summary.text() == total
|
|
911
976
|
card = panel.card("sim:alpao")
|
|
912
977
|
card.set_status("connected")
|
|
913
|
-
assert
|
|
978
|
+
assert total in section._summary.text() and "1 connected" in section._summary.text()
|
|
914
979
|
panel.card("sim:dp").set_status("error", "boom")
|
|
915
980
|
assert "1 failed" in section._summary.text()
|
|
916
981
|
card.set_status("disconnected")
|
|
917
982
|
panel.card("sim:dp").set_status("disconnected")
|
|
918
|
-
assert section._summary.text() ==
|
|
983
|
+
assert section._summary.text() == total
|
|
919
984
|
# The configured group counts only its own cards.
|
|
920
985
|
assert "connected" not in panel.configured_section._summary.text()
|
|
921
986
|
|
|
@@ -438,3 +438,61 @@ class TestUseExperiment:
|
|
|
438
438
|
assert removed == ["my_driver"]
|
|
439
439
|
assert "installed_thing" in sys.modules and "opticalib.gui.kernel_side" in sys.modules
|
|
440
440
|
|
|
441
|
+
|
|
442
|
+
class TestRelease:
|
|
443
|
+
"""Deleting a device variable lets its class clean up."""
|
|
444
|
+
|
|
445
|
+
@pytest.fixture
|
|
446
|
+
def shell(self):
|
|
447
|
+
from IPython.core.interactiveshell import InteractiveShell
|
|
448
|
+
|
|
449
|
+
shell = InteractiveShell.instance()
|
|
450
|
+
shell.run_cell(
|
|
451
|
+
"released = []\n"
|
|
452
|
+
"class Device:\n"
|
|
453
|
+
" def __del__(self):\n"
|
|
454
|
+
" released.append(1)\n",
|
|
455
|
+
store_history=True,
|
|
456
|
+
)
|
|
457
|
+
yield shell
|
|
458
|
+
shell.reset()
|
|
459
|
+
|
|
460
|
+
@staticmethod
|
|
461
|
+
def _run(shell, *cells):
|
|
462
|
+
for cell in cells:
|
|
463
|
+
assert shell.run_cell(cell, store_history=True).success
|
|
464
|
+
|
|
465
|
+
def test_plain_del_is_not_enough_after_show_in_console(self, shell):
|
|
466
|
+
"""The case that motivates it: the displayed object sits in ``Out``."""
|
|
467
|
+
self._run(shell, "dm = Device()", "dm", "del dm\nimport gc; gc.collect()")
|
|
468
|
+
assert shell.user_ns["released"] == []
|
|
469
|
+
|
|
470
|
+
def test_release_frees_the_displayed_object(self, shell):
|
|
471
|
+
self._run(shell, "dm = Device()", "dm", "keep = 1")
|
|
472
|
+
ks.release("dm", shell)
|
|
473
|
+
assert shell.user_ns["released"] == [1]
|
|
474
|
+
assert "dm" not in shell.user_ns and shell.user_ns["keep"] == 1
|
|
475
|
+
assert not any(v.__class__.__name__ == "Device" for v in shell.user_ns["Out"].values())
|
|
476
|
+
|
|
477
|
+
def test_release_inside_a_cell(self, shell):
|
|
478
|
+
"""As the GUI runs it: in a cell of its own, after the display."""
|
|
479
|
+
shell.user_ns["_gui"] = ks
|
|
480
|
+
self._run(shell, "dm = Device()", "dm", "_gui.release('dm')")
|
|
481
|
+
assert shell.user_ns["released"] == [1] and "dm" not in shell.user_ns
|
|
482
|
+
|
|
483
|
+
def test_other_holders_keep_the_object(self, shell):
|
|
484
|
+
self._run(shell, "dm = Device()", "holder = [dm]")
|
|
485
|
+
ks.release("dm", shell)
|
|
486
|
+
assert "dm" not in shell.user_ns and shell.user_ns["released"] == []
|
|
487
|
+
self._run(shell, "holder.clear()", "import gc; gc.collect()")
|
|
488
|
+
assert shell.user_ns["released"] == [1]
|
|
489
|
+
|
|
490
|
+
def test_after_a_reset(self, shell):
|
|
491
|
+
self._run(shell, "dm = Device()")
|
|
492
|
+
shell.last_execution_result = None
|
|
493
|
+
ks.release("dm", shell)
|
|
494
|
+
assert "dm" not in shell.user_ns and shell.user_ns["released"] == [1]
|
|
495
|
+
|
|
496
|
+
def test_unknown_variable(self, shell):
|
|
497
|
+
with pytest.raises(NameError, match="dm"):
|
|
498
|
+
ks.release("dm", shell)
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|