opticalib 1.2.0__tar.gz → 1.2.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-1.2.0 → opticalib-1.2.2}/MANIFEST.in +1 -0
- {opticalib-1.2.0/opticalib.egg-info → opticalib-1.2.2}/PKG-INFO +12 -6
- {opticalib-1.2.0 → opticalib-1.2.2}/README.md +11 -5
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/__version__.py +1 -1
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/alignment.py +20 -133
- opticalib-1.2.2/opticalib/analyzer/__init__.py +3 -0
- opticalib-1.2.2/opticalib/analyzer/images_processing.py +779 -0
- opticalib-1.2.2/opticalib/analyzer/signals.py +249 -0
- opticalib-1.2.2/opticalib/analyzer/timeseries.py +382 -0
- opticalib-1.2.2/opticalib/analyzer_old.py +147 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/core/read_config.py +23 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/core/root.py +1 -1
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/devices/_API/i4d.py +5 -2
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/devices/_API/micAPI.py +3 -3
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/devices/_API/piAPI.py +49 -35
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/devices/cameras.py +13 -6
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/devices/deformable_mirrors.py +15 -6
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/devices/interferometer.py +16 -11
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/dmutils/flattening.py +79 -79
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/dmutils/iff_module.py +3 -7
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/dmutils/iff_processing.py +50 -46
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/dmutils/utils.py +2 -2
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/ground/__init__.py +2 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/ground/computerec.py +27 -9
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/ground/modal_decomposer.py +58 -35
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/ground/osutils.py +190 -84
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/ground/roi.py +20 -6
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/simulator/factory_functions.py +0 -2
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/simulator/fake_dms.py +6 -0
- {opticalib-1.2.0 → opticalib-1.2.2/opticalib.egg-info}/PKG-INFO +12 -6
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib.egg-info/SOURCES.txt +7 -6
- {opticalib-1.2.0 → opticalib-1.2.2}/setup.cfg +1 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/setup.py +1 -1
- {opticalib-1.2.0 → opticalib-1.2.2}/setup_calpy.py +30 -3
- {opticalib-1.2.0 → opticalib-1.2.2}/tests/test_dmutils_flattening.py +3 -3
- {opticalib-1.2.0 → opticalib-1.2.2}/tests/test_dmutils_iff_module.py +10 -55
- {opticalib-1.2.0 → opticalib-1.2.2}/tests/test_ground_osutils.py +58 -30
- opticalib-1.2.2/tests/test_setup_calpy.py +54 -0
- opticalib-1.2.0/opticalib/analyzer.py +0 -1344
- opticalib-1.2.0/opticalib/analyzers/__init__.py +0 -0
- opticalib-1.2.0/opticalib/analyzers/images_processing.py +0 -0
- opticalib-1.2.0/opticalib/analyzers/signals.py +0 -0
- opticalib-1.2.0/opticalib/analyzers/timeseries.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/LICENSE +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/__init__.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/core/__init__.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/core/_configurations/configuration.yaml +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/core/exceptions.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/core/fitsarray.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/devices/_API/__init__.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/devices/_API/alpaoAPI.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/devices/_API/base_devices.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/devices/_API/splattAPI.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/devices/__init__.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/dmutils/__init__.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/dmutils/actuator_identification_lib.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/dmutils/dm_analysis.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/dmutils/iff_acquisition_preparation.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/dmutils/pupil_calibration.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/ground/geo.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/ground/geometry.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/ground/logger.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/py.typed +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/simulator/_API/AdOpticaData/dp_cmdmat.fits +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/simulator/_API/AdOpticaData/dp_coords.fits +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/simulator/_API/AdOpticaData/dp_ffwd.fits +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/simulator/_API/__init__.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/simulator/_API/alpao_conf.yaml +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/simulator/_API/base_fake_adopticadm.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/simulator/_API/base_fake_alpao.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/simulator/__init__.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/simulator/fake_interf.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib/typings.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib.egg-info/dependency_links.txt +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib.egg-info/entry_points.txt +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib.egg-info/requires.txt +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/opticalib.egg-info/top_level.txt +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/requirements.txt +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/tests/__init__.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/tests/conftest.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/tests/test_core_exceptions.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/tests/test_core_fits.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/tests/test_core_read_config.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/tests/test_core_root.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/tests/test_dmutils_iff_acquisition_preparation.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/tests/test_dmutils_iff_processing.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/tests/test_ground_computerec.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/tests/test_ground_logger.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/tests/test_ground_modal_decomposer.py +0 -0
- {opticalib-1.2.0 → opticalib-1.2.2}/tests/test_ground_roi.py +0 -0
|
@@ -2,6 +2,7 @@ include README.md
|
|
|
2
2
|
include requirements.txt
|
|
3
3
|
include opticalib/core/_configurations/configuration.yaml
|
|
4
4
|
include setup_calpy.py
|
|
5
|
+
include opticalib/_init_script/initCalpy.py
|
|
5
6
|
include opticalib/simulator/_API/AdOpticaData/*
|
|
6
7
|
include opticalib/simulator/_API/alpao_conf.yaml
|
|
7
8
|
recursive-include labott *.py
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: opticalib
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.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 interferometers.
|
|
5
5
|
Home-page: https://github.com/ArcetriAdaptiveOptics/opticalib
|
|
6
6
|
Author: Adaptive Optics Group - INAF - Osservatorio Astrofisico di Arcetri
|
|
@@ -73,10 +73,10 @@ pip install opticalib
|
|
|
73
73
|
The in-development version can be installed directly from this repository:
|
|
74
74
|
|
|
75
75
|
```bash
|
|
76
|
-
pip install git+"https://github.com/
|
|
76
|
+
pip install git+"https://github.com/ArcetriAdaptiveOptics/opticalib.git"
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
**
|
|
79
|
+
**But do expect some bugs!**
|
|
80
80
|
|
|
81
81
|
Upon installation, the software will create an entry point script called `calpy`, which is usefull to set up a specific experiment's environment. Let's say we have an optical bench composed of an interferometer 4D PhaseCam6110 and an Alpao Deformable mirror, say DM820. We can create the experiment's environment just like:
|
|
82
82
|
|
|
@@ -86,6 +86,8 @@ calpy -f ~/alpao_experiment --create
|
|
|
86
86
|
|
|
87
87
|
This will create, in the `~/alpao_experiment` folder, the package's data folder tree, together with a configuration file in the `SysConfig` folder. The [configuration file](./opticalib/core/_configurations/configuration.yaml), documented [here](./opticalib/core/_configurations/DOCS.md), is where all devices must be specified.
|
|
88
88
|
|
|
89
|
+
### Example usage
|
|
90
|
+
|
|
89
91
|
Once done with the configuration, we can then start using out instruments:
|
|
90
92
|
|
|
91
93
|
```bash
|
|
@@ -93,14 +95,18 @@ calpy -f ~/alpao_experiment
|
|
|
93
95
|
```
|
|
94
96
|
|
|
95
97
|
```python
|
|
96
|
-
# The `calpy` function will automatically import opticalib (with `opt`
|
|
98
|
+
# The `calpy` function will automatically import opticalib (with `opt`
|
|
99
|
+
# as alias), as well as the `opticalib.dmutils` as dmutils
|
|
97
100
|
|
|
98
101
|
interf = opt.PhaseCam(6110) # set in the configuration file
|
|
99
102
|
dm = opt.AlpaoDm(820) # set in the configuration file
|
|
100
103
|
|
|
101
|
-
# Having the bench set up and the configuration file set, we can acquire
|
|
104
|
+
# Having the bench set up and the configuration file set, we can acquire
|
|
105
|
+
# an Influence Function by just doing
|
|
102
106
|
|
|
103
|
-
tn = dmutils.iff_module.iffDataAcquisition(dm, interf) # Optional paramenters
|
|
107
|
+
tn = dmutils.iff_module.iffDataAcquisition(dm, interf) # Optional paramenters
|
|
108
|
+
# are `modesList, modesAmplitude, template`, which if not specified are
|
|
109
|
+
# read from the configuration file
|
|
104
110
|
```
|
|
105
111
|
|
|
106
112
|
## Documentation
|
|
@@ -29,10 +29,10 @@ pip install opticalib
|
|
|
29
29
|
The in-development version can be installed directly from this repository:
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
pip install git+"https://github.com/
|
|
32
|
+
pip install git+"https://github.com/ArcetriAdaptiveOptics/opticalib.git"
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
**
|
|
35
|
+
**But do expect some bugs!**
|
|
36
36
|
|
|
37
37
|
Upon installation, the software will create an entry point script called `calpy`, which is usefull to set up a specific experiment's environment. Let's say we have an optical bench composed of an interferometer 4D PhaseCam6110 and an Alpao Deformable mirror, say DM820. We can create the experiment's environment just like:
|
|
38
38
|
|
|
@@ -42,6 +42,8 @@ calpy -f ~/alpao_experiment --create
|
|
|
42
42
|
|
|
43
43
|
This will create, in the `~/alpao_experiment` folder, the package's data folder tree, together with a configuration file in the `SysConfig` folder. The [configuration file](./opticalib/core/_configurations/configuration.yaml), documented [here](./opticalib/core/_configurations/DOCS.md), is where all devices must be specified.
|
|
44
44
|
|
|
45
|
+
### Example usage
|
|
46
|
+
|
|
45
47
|
Once done with the configuration, we can then start using out instruments:
|
|
46
48
|
|
|
47
49
|
```bash
|
|
@@ -49,14 +51,18 @@ calpy -f ~/alpao_experiment
|
|
|
49
51
|
```
|
|
50
52
|
|
|
51
53
|
```python
|
|
52
|
-
# The `calpy` function will automatically import opticalib (with `opt`
|
|
54
|
+
# The `calpy` function will automatically import opticalib (with `opt`
|
|
55
|
+
# as alias), as well as the `opticalib.dmutils` as dmutils
|
|
53
56
|
|
|
54
57
|
interf = opt.PhaseCam(6110) # set in the configuration file
|
|
55
58
|
dm = opt.AlpaoDm(820) # set in the configuration file
|
|
56
59
|
|
|
57
|
-
# Having the bench set up and the configuration file set, we can acquire
|
|
60
|
+
# Having the bench set up and the configuration file set, we can acquire
|
|
61
|
+
# an Influence Function by just doing
|
|
58
62
|
|
|
59
|
-
tn = dmutils.iff_module.iffDataAcquisition(dm, interf) # Optional paramenters
|
|
63
|
+
tn = dmutils.iff_module.iffDataAcquisition(dm, interf) # Optional paramenters
|
|
64
|
+
# are `modesList, modesAmplitude, template`, which if not specified are
|
|
65
|
+
# read from the configuration file
|
|
60
66
|
```
|
|
61
67
|
|
|
62
68
|
## Documentation
|
|
@@ -9,7 +9,7 @@ Pietro Ferraiuolo
|
|
|
9
9
|
__title__ = "opticalib"
|
|
10
10
|
__long_title__ = "OPTICALIB : adaptive OPTIcs package for dm CALibrationS"
|
|
11
11
|
__description__ = "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 interferometers."
|
|
12
|
-
__version__ = "1.2.
|
|
12
|
+
__version__ = "1.2.2"
|
|
13
13
|
__author__ = "Adaptive Optics Group - INAF - Osservatorio Astrofisico di Arcetri"
|
|
14
14
|
__maintainer__ = "Pietro Ferraiuolo"
|
|
15
15
|
__author_email__ = "pietro.ferraiuolo@inaf.it"
|
|
@@ -159,7 +159,9 @@ class Alignment:
|
|
|
159
159
|
self.recMat = None
|
|
160
160
|
self._cmdAmp = None
|
|
161
161
|
self._surface = (
|
|
162
|
-
_osu.load_fits(_sc.fitting_surface)
|
|
162
|
+
_osu.load_fits(_sc.fitting_surface)
|
|
163
|
+
if not _sc.fitting_surface == ""
|
|
164
|
+
else None
|
|
163
165
|
)
|
|
164
166
|
self._zfit = _zfitter(self._surface)
|
|
165
167
|
self._moveFnc = self.__get_callables(self.mdev, _sc.devices_move_calls)
|
|
@@ -254,14 +256,19 @@ class Alignment:
|
|
|
254
256
|
print("Alignment Corrected\n")
|
|
255
257
|
self.read_positions()
|
|
256
258
|
if save:
|
|
257
|
-
files: list[str] = [
|
|
259
|
+
files: list[str] = ["AlignmentDeltaCmd.fits"]
|
|
258
260
|
for dev in self._devName:
|
|
259
261
|
files.append(f"{dev}DeltaCmd.fits")
|
|
260
262
|
commands = [f_cmd] + self._extract_cmds_to_apply(f_cmd)
|
|
261
263
|
header = {}
|
|
262
|
-
header[
|
|
264
|
+
header["CALIBTN"] = self._calibtn if self._calibtn is not None else "None"
|
|
263
265
|
for cmd, filename in zip(commands, files):
|
|
264
|
-
_osu.save_fits(
|
|
266
|
+
_osu.save_fits(
|
|
267
|
+
_os.path.join(self._dataPath, filename),
|
|
268
|
+
cmd,
|
|
269
|
+
overwrite=True,
|
|
270
|
+
header=header,
|
|
271
|
+
)
|
|
265
272
|
self._logger.info(f"'{filename}' saved!")
|
|
266
273
|
return f_cmd
|
|
267
274
|
|
|
@@ -376,7 +383,11 @@ class Alignment:
|
|
|
376
383
|
print(f"Calibration loaded from '{tn}'")
|
|
377
384
|
|
|
378
385
|
def _images_production(
|
|
379
|
-
self,
|
|
386
|
+
self,
|
|
387
|
+
template: _ot.ArrayLike | list[int],
|
|
388
|
+
n_frames: int,
|
|
389
|
+
n_repetitions: int,
|
|
390
|
+
tn: str = None,
|
|
380
391
|
) -> _ot.CubeData:
|
|
381
392
|
"""
|
|
382
393
|
Acquire images based on the provided template and number of repetitions.
|
|
@@ -413,60 +424,18 @@ class Alignment:
|
|
|
413
424
|
print(f"Matrix Column {k+1} : {self.cmdMat.T[k]}\n")
|
|
414
425
|
imglist = self._img_acquisition(k, template, n_frames)
|
|
415
426
|
template.insert(0, 1)
|
|
416
|
-
image = _ppr(
|
|
417
|
-
imglist, template, normalization=6*self._cmdAmp[k]
|
|
418
|
-
)
|
|
427
|
+
image = _ppr(imglist, template, normalization=6 * self._cmdAmp[k])
|
|
419
428
|
template.pop(0)
|
|
420
429
|
results.append(image)
|
|
421
|
-
_osu.save_fits(
|
|
430
|
+
_osu.save_fits(
|
|
431
|
+
_os.path.join(self._dataPath, tn, f"mode_{k:02d}"), image
|
|
432
|
+
)
|
|
422
433
|
if n_repetitions != 1:
|
|
423
434
|
n_results.append(results)
|
|
424
435
|
else:
|
|
425
436
|
n_results = results
|
|
426
437
|
return n_results
|
|
427
438
|
|
|
428
|
-
#### OLD ALGORITHM - TO BE DELETED LATER
|
|
429
|
-
# def _zern_routine(
|
|
430
|
-
# self, imglist: list[_ot.ImageData] | _ot.CubeData
|
|
431
|
-
# ) -> _ot.MatrixLike:
|
|
432
|
-
# """
|
|
433
|
-
# Creates the interaction matrix from the provided image list.
|
|
434
|
-
|
|
435
|
-
# Parameters
|
|
436
|
-
# ----------
|
|
437
|
-
# imglist : CubeData
|
|
438
|
-
# The list of images used to create the interaction matrix.
|
|
439
|
-
|
|
440
|
-
# Returns
|
|
441
|
-
# -------
|
|
442
|
-
# intMat : MatrixLike
|
|
443
|
-
# The interaction matrix created from the images.
|
|
444
|
-
# """
|
|
445
|
-
# _logger.log(f"{self._zern_routine.__qualname__}")
|
|
446
|
-
# coefflist = []
|
|
447
|
-
# if not isinstance(imglist, list):
|
|
448
|
-
# imglist = [imglist]
|
|
449
|
-
# for img in imglist:
|
|
450
|
-
# if self._surface is None:
|
|
451
|
-
# coeff, _ = _zern.zernikeFit(img, self._zvec2fit)
|
|
452
|
-
# _logger.log(f"{_zern.zernikeFit.__qualname__}")
|
|
453
|
-
# else:
|
|
454
|
-
# if self._correct_cavity is True:
|
|
455
|
-
# img -= 2 * self._surface
|
|
456
|
-
# cir = _geo.qpupil(-1 * self._surface.mask + 1)
|
|
457
|
-
# mm = _geo.draw_mask(
|
|
458
|
-
# self._surface.data * 0, cir[0], cir[1], 1.44 / 0.00076 / 2, out=0
|
|
459
|
-
# ) # e questo blocco potrebbe essere in una funzione chiamata all'avvio,
|
|
460
|
-
# # così si crea anche la auxmask. i parametri da definire in conf sarebbero 1.44 / 0.00076 / 2 == pix on radius
|
|
461
|
-
# # coeff, _ = _zern.zernikeFitAuxmask(img, mm, self._zvec2fit) #mod RB20250917: this part has been substituted with zern_on_roi below
|
|
462
|
-
# coeff = self._global_zern_on_roi(img, auxmask=mm)
|
|
463
|
-
# _logger.log(f"{_zern.zernikeFitAuxmask.__qualname__}")
|
|
464
|
-
# coefflist.append(coeff[self._zvec2use])
|
|
465
|
-
# if len(coefflist) == 1:
|
|
466
|
-
# coefflist = _np.array([c for c in coefflist[0]])
|
|
467
|
-
# intMat = _np.array(coefflist).T
|
|
468
|
-
# return intMat
|
|
469
|
-
|
|
470
439
|
def _zern_routine(
|
|
471
440
|
self, imglist: list[_ot.ImageData] | _ot.CubeData
|
|
472
441
|
) -> _ot.MatrixLike:
|
|
@@ -501,50 +470,6 @@ class Alignment:
|
|
|
501
470
|
intMat = _np.array(coefflist).T
|
|
502
471
|
return intMat
|
|
503
472
|
|
|
504
|
-
#### Deprecated - to be deleted later
|
|
505
|
-
# def _global_zern_on_roi(
|
|
506
|
-
# self, img: _ot.ImageData, auxmask: _ot.Optional[_ot.ImageData] = None
|
|
507
|
-
# ):
|
|
508
|
-
# """
|
|
509
|
-
# Computes Zernike coefficients over a segmented fitting area, i.e. a pupil
|
|
510
|
-
# mask divided into Regions Of Interest (ROI). The computation is based on
|
|
511
|
-
# the fitting of Zernike modes independently on each ROI; the coefficients
|
|
512
|
-
# are then averaged together to return the global Zernike mode amplitude.
|
|
513
|
-
# An auxiliary mask (optional) may be passed. Such auxiliary mask allows
|
|
514
|
-
# creating the Zernike modes (or more precisely the coordinates grid) over
|
|
515
|
-
# a user-defined area, instead over the image mask (default option for zernikeFit).
|
|
516
|
-
|
|
517
|
-
# Parameters
|
|
518
|
-
# ----------
|
|
519
|
-
# img : ImageData
|
|
520
|
-
# Image to fit the Zernike modes on, over the ROIs.
|
|
521
|
-
# auxmask : ImageData, optional
|
|
522
|
-
# Image of the auxiliary mask, where the fitting coordinates are constructed
|
|
523
|
-
|
|
524
|
-
# Returns
|
|
525
|
-
# -------
|
|
526
|
-
# zcoeff : array
|
|
527
|
-
# The vector of the Zernike coefficients, corresponding to the selected modes id,
|
|
528
|
-
# fitted over the auxiliary mask and all the ROIs, averaged together.
|
|
529
|
-
# """
|
|
530
|
-
# print("Searching for Regions of Interest in the frame...")
|
|
531
|
-
# roiimg = roigen.roiGenerator(img)
|
|
532
|
-
# nroi = len(roiimg)
|
|
533
|
-
# print("Found " + str(nroi) + " ROI")
|
|
534
|
-
# if auxmask is None:
|
|
535
|
-
# auxmask2use = img.mask
|
|
536
|
-
# else:
|
|
537
|
-
# auxmask2use = auxmask
|
|
538
|
-
# zcoeff = _np.zeros([nroi, len(self._zvec2fit)])
|
|
539
|
-
# for i in range(nroi):
|
|
540
|
-
# img2fit = _np.ma.masked_array(img.data, roiimg[i])
|
|
541
|
-
# cc, _ = _zern.zernikeFitAuxmask(img2fit, auxmask2use, self._zvec2fit)
|
|
542
|
-
# zcoeff[i, :] = cc
|
|
543
|
-
# zcoeff = zcoeff.mean(axis=0)
|
|
544
|
-
# print("Global Zernike coeff:")
|
|
545
|
-
# print(str(zcoeff))
|
|
546
|
-
# return zcoeff
|
|
547
|
-
|
|
548
473
|
def _create_rec_mat(self, intMat: _ot.MatrixLike) -> _ot.MatrixLike:
|
|
549
474
|
"""
|
|
550
475
|
Creates the reconstruction matrix off the inversion of the interaction
|
|
@@ -656,44 +581,6 @@ class Alignment:
|
|
|
656
581
|
imglist.append(img)
|
|
657
582
|
return imglist
|
|
658
583
|
|
|
659
|
-
# def _push_pull_redux(
|
|
660
|
-
# self, imglist: _ot.CubeData, template: _ot.ArrayLike
|
|
661
|
-
# ) -> _ot.ImageData:
|
|
662
|
-
# """
|
|
663
|
-
# Reduces the push-pull images based on the given template.
|
|
664
|
-
|
|
665
|
-
# Parameters
|
|
666
|
-
# ----------
|
|
667
|
-
# imglist : ArrayLike
|
|
668
|
-
# The list of images to be reduced.
|
|
669
|
-
# template : ArrayLike
|
|
670
|
-
# The template used for image reduction.
|
|
671
|
-
|
|
672
|
-
# Returns
|
|
673
|
-
# -------
|
|
674
|
-
# image : ImageData
|
|
675
|
-
# The reduced image.
|
|
676
|
-
# """
|
|
677
|
-
# self._logger.info(f"Starting Push-Pull Reduction Algorithm...")
|
|
678
|
-
# template.insert(0, 1)
|
|
679
|
-
|
|
680
|
-
# ## OLD ALGORITHM - TO BE DELETED LATER
|
|
681
|
-
# # image = _np.zeros((imglist[0].shape[0], imglist[0].shape[1]))
|
|
682
|
-
# # for x in range(1, len(imglist)):
|
|
683
|
-
# # opd2add = imglist[x] * template[x] + imglist[x - 1] * template[x - 1]
|
|
684
|
-
# # mask2add = _np.ma.mask_or(imglist[x].mask, imglist[x - 1].mask)
|
|
685
|
-
# # if x == 1:
|
|
686
|
-
# # master_mask = mask2add
|
|
687
|
-
# # else:
|
|
688
|
-
# # master_mask = _np.ma.mask_or(master_mask, mask2add)
|
|
689
|
-
# # image += opd2add
|
|
690
|
-
# # image = _np.ma.masked_array(image, mask=master_mask) / 6
|
|
691
|
-
|
|
692
|
-
# image = _ppr(imglist, template, normalization=6)
|
|
693
|
-
|
|
694
|
-
# template.pop(0)
|
|
695
|
-
# return image
|
|
696
|
-
|
|
697
584
|
def __loadIntMat(self, calibtn: str | None) -> _ot.MatrixLike:
|
|
698
585
|
"""
|
|
699
586
|
Loads the interaction matrix from a FITS file based on the provided tracking number.
|