structured-optics 0.6.2__tar.gz → 0.6.3__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.
- {structured_optics-0.6.2/structured_optics.egg-info → structured_optics-0.6.3}/PKG-INFO +1 -1
- {structured_optics-0.6.2 → structured_optics-0.6.3}/pyproject.toml +1 -1
- {structured_optics-0.6.2 → structured_optics-0.6.3}/structured_optics/struct_opt.py +1 -1
- {structured_optics-0.6.2 → structured_optics-0.6.3}/structured_optics/tools.py +0 -41
- {structured_optics-0.6.2 → structured_optics-0.6.3}/structured_optics/utils.py +39 -1
- {structured_optics-0.6.2 → structured_optics-0.6.3/structured_optics.egg-info}/PKG-INFO +1 -1
- {structured_optics-0.6.2 → structured_optics-0.6.3}/LICENSE +0 -0
- {structured_optics-0.6.2 → structured_optics-0.6.3}/README.md +0 -0
- {structured_optics-0.6.2 → structured_optics-0.6.3}/setup.cfg +0 -0
- {structured_optics-0.6.2 → structured_optics-0.6.3}/structured_optics/__init__.py +0 -0
- {structured_optics-0.6.2 → structured_optics-0.6.3}/structured_optics/bluestein.py +0 -0
- {structured_optics-0.6.2 → structured_optics-0.6.3}/structured_optics/diagnostics.py +0 -0
- {structured_optics-0.6.2 → structured_optics-0.6.3}/structured_optics/hologram.py +0 -0
- {structured_optics-0.6.2 → structured_optics-0.6.3}/structured_optics/masks.py +0 -0
- {structured_optics-0.6.2 → structured_optics-0.6.3}/structured_optics/modes.py +0 -0
- {structured_optics-0.6.2 → structured_optics-0.6.3}/structured_optics/polarization.py +0 -0
- {structured_optics-0.6.2 → structured_optics-0.6.3}/structured_optics/prop_methods.py +0 -0
- {structured_optics-0.6.2 → structured_optics-0.6.3}/structured_optics/slmdisplay.py +0 -0
- {structured_optics-0.6.2 → structured_optics-0.6.3}/structured_optics.egg-info/SOURCES.txt +0 -0
- {structured_optics-0.6.2 → structured_optics-0.6.3}/structured_optics.egg-info/dependency_links.txt +0 -0
- {structured_optics-0.6.2 → structured_optics-0.6.3}/structured_optics.egg-info/requires.txt +0 -0
- {structured_optics-0.6.2 → structured_optics-0.6.3}/structured_optics.egg-info/top_level.txt +0 -0
|
@@ -10,7 +10,7 @@ from .prop_methods import( propagate_fresnel_conv, propagate_fresnel_fft, propa
|
|
|
10
10
|
from .modes import (hg, hg_astigmatic, lg, nbessel, gbessel, lg_prod, frac_oam, frac_oam_qs,
|
|
11
11
|
IG_even, IG_odd, HInceG, circle, square, triangle, lp, lp_hel)
|
|
12
12
|
|
|
13
|
-
from .
|
|
13
|
+
from .utils import _build_from_coefs_and_basis
|
|
14
14
|
from .diagnostics import BeamDiagnostics
|
|
15
15
|
|
|
16
16
|
__all__ = ["Beam"]
|
|
@@ -257,45 +257,4 @@ def bessel_basis(Beam, Nmax, waist=None, norm1=False):
|
|
|
257
257
|
basis = basis / np.max(np.abs(basis))
|
|
258
258
|
return basis
|
|
259
259
|
|
|
260
|
-
def _build_from_coefs_and_basis(Beam, coefs, basis, pol_index = 0):
|
|
261
|
-
"""
|
|
262
|
-
Reconstruct a field as a weighted sum of basis modes and store it
|
|
263
|
-
into `Beam.field`.
|
|
264
|
-
|
|
265
|
-
Internal helper (not in `__all__`); used to turn a modal
|
|
266
|
-
decomposition (e.g. from `hg_proj`/`lg_proj`) plus its basis
|
|
267
|
-
(e.g. from `hg_basis`/`lg_basis`/`bessel_basis`) back into an
|
|
268
|
-
actual field.
|
|
269
|
-
|
|
270
|
-
Parameters
|
|
271
|
-
----------
|
|
272
|
-
Beam : object
|
|
273
|
-
Beam instance whose `.field` will be overwritten with the
|
|
274
|
-
reconstructed field.
|
|
275
|
-
coefs : np.ndarray
|
|
276
|
-
2D array of complex coefficients, shape (N, N), one per basis
|
|
277
|
-
mode.
|
|
278
|
-
basis : np.ndarray
|
|
279
|
-
Array of basis mode fields, shape (N, N, Dy, Dx), matching
|
|
280
|
-
`coefs` in its first two dimensions (e.g. as returned by
|
|
281
|
-
`hg_basis` or `lg_basis`).
|
|
282
|
-
pol_index : int, optional
|
|
283
|
-
Polarization/field-component index of `Beam.field` (and of the
|
|
284
|
-
internal auxiliary field) that the reconstructed sum is
|
|
285
|
-
written into. Defaults to 0.
|
|
286
|
-
|
|
287
|
-
Returns
|
|
288
|
-
-------
|
|
289
|
-
Beam : object
|
|
290
|
-
`Beam`, with `Beam.field` set to the auxiliary field after
|
|
291
|
-
accumulating `sum(coefs[i, j] * basis[i, j])` into component
|
|
292
|
-
`pol_index`.
|
|
293
|
-
"""
|
|
294
|
-
N = len(coefs)
|
|
295
|
-
aux = Beam.copy_clean()
|
|
296
|
-
for i in range(N):
|
|
297
|
-
for j in range(N):
|
|
298
|
-
aux.field[pol_index] = aux.field[pol_index] + coefs[i,j] * basis[i,j]
|
|
299
|
-
Beam.field = aux.field
|
|
300
|
-
return Beam
|
|
301
260
|
|
|
@@ -880,4 +880,42 @@ def zernikes_phase(beam, coefs, strengths,):
|
|
|
880
880
|
|
|
881
881
|
for (n, m), strength in zip(coefs, strengths):
|
|
882
882
|
phase += strength * zernike(n, m, r, phi)
|
|
883
|
-
return np.exp(1j * phase)
|
|
883
|
+
return np.exp(1j * phase)
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
#builder util
|
|
887
|
+
def _build_from_coefs_and_basis(Beam, coefs, basis, pol_index=0):
|
|
888
|
+
"""
|
|
889
|
+
Reconstruct a field as a weighted sum of basis modes.
|
|
890
|
+
|
|
891
|
+
Parameters
|
|
892
|
+
----------
|
|
893
|
+
Beam : object
|
|
894
|
+
Beam instance whose `.field` will be overwritten.
|
|
895
|
+
coefs : np.ndarray
|
|
896
|
+
Complex coefficient array, shape (N, N).
|
|
897
|
+
basis : np.ndarray
|
|
898
|
+
Basis modes, shape (N, N, Dy, Dx).
|
|
899
|
+
pol_index : int or None, optional
|
|
900
|
+
Polarization/field-component index to reconstruct. If None,
|
|
901
|
+
the reconstructed field is assigned to all polarization
|
|
902
|
+
components.
|
|
903
|
+
|
|
904
|
+
Returns
|
|
905
|
+
-------
|
|
906
|
+
Beam
|
|
907
|
+
Beam with the reconstructed field.
|
|
908
|
+
"""
|
|
909
|
+
field = np.einsum(
|
|
910
|
+
"ij,ijyx->yx",
|
|
911
|
+
coefs,
|
|
912
|
+
basis,
|
|
913
|
+
optimize=True,
|
|
914
|
+
)
|
|
915
|
+
|
|
916
|
+
if pol_index is None:
|
|
917
|
+
Beam.field[...] = field
|
|
918
|
+
else:
|
|
919
|
+
Beam.field[pol_index] = field
|
|
920
|
+
|
|
921
|
+
return Beam
|
|
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
|
{structured_optics-0.6.2 → structured_optics-0.6.3}/structured_optics.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{structured_optics-0.6.2 → structured_optics-0.6.3}/structured_optics.egg-info/top_level.txt
RENAMED
|
File without changes
|