LightwaveExplorer 2026.1__tar.gz → 2026.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.
- {lightwaveexplorer-2026.1 → lightwaveexplorer-2026.2}/PKG-INFO +1 -1
- {lightwaveexplorer-2026.1 → lightwaveexplorer-2026.2}/pyproject.toml +1 -1
- {lightwaveexplorer-2026.1 → lightwaveexplorer-2026.2}/src/LightwaveExplorer/LightwaveExplorer.py +77 -9
- {lightwaveexplorer-2026.1 → lightwaveexplorer-2026.2}/src/LightwaveExplorer/__init__.py +4 -2
- {lightwaveexplorer-2026.1 → lightwaveexplorer-2026.2}/src/LightwaveExplorer.egg-info/PKG-INFO +1 -1
- {lightwaveexplorer-2026.1 → lightwaveexplorer-2026.2}/LICENSE +0 -0
- {lightwaveexplorer-2026.1 → lightwaveexplorer-2026.2}/README.md +0 -0
- {lightwaveexplorer-2026.1 → lightwaveexplorer-2026.2}/setup.cfg +0 -0
- {lightwaveexplorer-2026.1 → lightwaveexplorer-2026.2}/src/LightwaveExplorer.egg-info/SOURCES.txt +0 -0
- {lightwaveexplorer-2026.1 → lightwaveexplorer-2026.2}/src/LightwaveExplorer.egg-info/dependency_links.txt +0 -0
- {lightwaveexplorer-2026.1 → lightwaveexplorer-2026.2}/src/LightwaveExplorer.egg-info/requires.txt +0 -0
- {lightwaveexplorer-2026.1 → lightwaveexplorer-2026.2}/src/LightwaveExplorer.egg-info/top_level.txt +0 -0
{lightwaveexplorer-2026.1 → lightwaveexplorer-2026.2}/src/LightwaveExplorer/LightwaveExplorer.py
RENAMED
|
@@ -10,9 +10,9 @@ import matplotlib.pyplot as plt
|
|
|
10
10
|
import numpy as np
|
|
11
11
|
import yaml
|
|
12
12
|
from scipy.optimize import least_squares
|
|
13
|
+
import scipy.constants as constants
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
class lightwaveExplorerResult:
|
|
15
|
+
class LightwaveExplorerResult:
|
|
16
16
|
"""
|
|
17
17
|
A class which contains the result of a Lightwave Explorer simulation
|
|
18
18
|
The parameters of the simulation run are read from the .txt file
|
|
@@ -94,8 +94,7 @@ class lightwaveExplorerResult:
|
|
|
94
94
|
if filePath.endswith(".zip"):
|
|
95
95
|
isZip = True
|
|
96
96
|
archive = zipfile.ZipFile(filePath, "r")
|
|
97
|
-
|
|
98
|
-
fileBase, baseExtension = os.path.splitext(archiveName)
|
|
97
|
+
fileBase = next(name for name in archive.namelist() if name.lower().endswith(".txt"))[:-4]
|
|
99
98
|
settingsFile = archive.open(fileBase + ".txt")
|
|
100
99
|
settingsFile = io.TextIOWrapper(settingsFile, "utf-8")
|
|
101
100
|
|
|
@@ -528,12 +527,15 @@ class lightwaveExplorerResult:
|
|
|
528
527
|
|
|
529
528
|
self.timeVector = self.timeStep * np.arange(0, self.Ntime)
|
|
530
529
|
self.frequencyVector = np.fft.fftfreq(self.Ntime, d=self.timeStep)
|
|
531
|
-
self.frequencyVectorSpectrum = self.
|
|
532
|
-
self.
|
|
533
|
-
self.spaceVector = (
|
|
530
|
+
self.frequencyVectorSpectrum = np.fft.rfftfreq(self.Ntime, self.timeStep)
|
|
531
|
+
self.spaceVectorX = (
|
|
534
532
|
self.spatialStep * (np.arange(0, self.Nspace) - self.Nspace / 2)
|
|
535
533
|
+ 0.25 * self.spatialStep
|
|
536
534
|
)
|
|
535
|
+
self.spaceVectorY = (
|
|
536
|
+
self.spatialStep * (np.arange(0, self.Nspace2) - self.Nspace2 / 2)
|
|
537
|
+
+ 0.25 * self.spatialStep
|
|
538
|
+
)
|
|
537
539
|
|
|
538
540
|
|
|
539
541
|
def fwhm(x: np.ndarray, y: np.ndarray, height: float = 0.5) -> float:
|
|
@@ -703,7 +705,7 @@ def load(filePath: str, loadFieldArray=True):
|
|
|
703
705
|
:return: The class contianing the parameters and results
|
|
704
706
|
:rtype: LightwaveExplorerResult
|
|
705
707
|
"""
|
|
706
|
-
s =
|
|
708
|
+
s = LightwaveExplorerResult(filePath=filePath, loadFieldArray=loadFieldArray)
|
|
707
709
|
return s
|
|
708
710
|
|
|
709
711
|
|
|
@@ -827,7 +829,7 @@ def getTabulatedDataFromRII(url):
|
|
|
827
829
|
|
|
828
830
|
|
|
829
831
|
def EOS(
|
|
830
|
-
s:
|
|
832
|
+
s: LightwaveExplorerResult,
|
|
831
833
|
bandpass=None,
|
|
832
834
|
filterTransmissionNanometers=None,
|
|
833
835
|
detectorResponseNanometers=None,
|
|
@@ -1406,3 +1408,69 @@ def fuseZips(outputFile: str):
|
|
|
1406
1408
|
spectrum.close()
|
|
1407
1409
|
os.unlink(Ext.name)
|
|
1408
1410
|
os.unlink(spectrum.name)
|
|
1411
|
+
|
|
1412
|
+
def getFieldVector(s: LightwaveExplorerResult):
|
|
1413
|
+
"""
|
|
1414
|
+
Provides the vector components of the real-space field given the flattened representation saved by LWE.
|
|
1415
|
+
|
|
1416
|
+
Args:
|
|
1417
|
+
s (LightwaveExplorerResult): a loaded simulation result
|
|
1418
|
+
|
|
1419
|
+
Returns:
|
|
1420
|
+
Ex: The array of x-components of the field
|
|
1421
|
+
Ey: y-components
|
|
1422
|
+
Ez: z-components
|
|
1423
|
+
"""
|
|
1424
|
+
Ekw_x_in = np.fft.fftn(
|
|
1425
|
+
np.fft.rfft(
|
|
1426
|
+
s.Ext_x,
|
|
1427
|
+
axis=0),
|
|
1428
|
+
axes=[1,2])
|
|
1429
|
+
Ekw_y_in = np.fft.fftn(
|
|
1430
|
+
np.fft.rfft(
|
|
1431
|
+
s.Ext_y,
|
|
1432
|
+
axis=0),
|
|
1433
|
+
axes=[1,2])
|
|
1434
|
+
|
|
1435
|
+
inverse_k = (2.0 * np.pi/constants.speed_of_light) * s.frequencyVectorSpectrum
|
|
1436
|
+
np.divide(1.0, inverse_k, out=inverse_k, where=(inverse_k != 0.0))
|
|
1437
|
+
norm_x = np.outer(
|
|
1438
|
+
inverse_k,
|
|
1439
|
+
(2.0*np.pi)*np.fft.fftfreq(
|
|
1440
|
+
len(s.spaceVectorX),
|
|
1441
|
+
d=s.spatialStep))
|
|
1442
|
+
norm_y = np.outer(
|
|
1443
|
+
inverse_k,
|
|
1444
|
+
(2.0*np.pi)*np.fft.fftfreq(
|
|
1445
|
+
len(s.spaceVectorY),
|
|
1446
|
+
d=s.spatialStep))
|
|
1447
|
+
sqrt_mask = np.abs(norm_x) < 1.0
|
|
1448
|
+
tilt_x = np.zeros_like(norm_x)
|
|
1449
|
+
tilt_x = np.sqrt((1.0-norm_x)*(1.0+norm_x),out=tilt_x,where=sqrt_mask)
|
|
1450
|
+
sqrt_mask = np.abs(norm_y) < 1.0
|
|
1451
|
+
tilt_y = np.zeros_like(norm_y)
|
|
1452
|
+
tilt_y = np.sqrt((1.0-norm_y)*(1.0+norm_y),out=tilt_y,where=sqrt_mask)
|
|
1453
|
+
|
|
1454
|
+
Ex = np.fft.irfft(
|
|
1455
|
+
np.fft.ifftn(
|
|
1456
|
+
tilt_x[:,:,np.newaxis] * Ekw_x_in,
|
|
1457
|
+
axes=[2,1]
|
|
1458
|
+
),
|
|
1459
|
+
axis = 0
|
|
1460
|
+
)
|
|
1461
|
+
Ey = np.fft.irfft(
|
|
1462
|
+
np.fft.ifftn(
|
|
1463
|
+
tilt_y[:,np.newaxis,:] * Ekw_y_in,
|
|
1464
|
+
axes=[2,1]
|
|
1465
|
+
),
|
|
1466
|
+
axis = 0
|
|
1467
|
+
)
|
|
1468
|
+
Ez = np.fft.irfft(
|
|
1469
|
+
np.fft.ifftn(
|
|
1470
|
+
norm_x[:,:,np.newaxis] * Ekw_x_in + norm_y[:,np.newaxis,:] * Ekw_y_in,
|
|
1471
|
+
axes=[2,1]
|
|
1472
|
+
),
|
|
1473
|
+
axis = 0
|
|
1474
|
+
)
|
|
1475
|
+
|
|
1476
|
+
return Ex, Ey, Ez
|
|
@@ -13,7 +13,7 @@ from .LightwaveExplorer import (
|
|
|
13
13
|
getRII_object,
|
|
14
14
|
getSellmeierFromRII,
|
|
15
15
|
getTabulatedDataFromRII,
|
|
16
|
-
|
|
16
|
+
LightwaveExplorerResult,
|
|
17
17
|
load,
|
|
18
18
|
loadSplit,
|
|
19
19
|
norma,
|
|
@@ -24,6 +24,7 @@ from .LightwaveExplorer import (
|
|
|
24
24
|
printSellmeier,
|
|
25
25
|
sellmeier,
|
|
26
26
|
sellmeierFit,
|
|
27
|
+
getFieldVector,
|
|
27
28
|
)
|
|
28
29
|
|
|
29
30
|
__all__ = [
|
|
@@ -39,7 +40,7 @@ __all__ = [
|
|
|
39
40
|
"getRII_object",
|
|
40
41
|
"getSellmeierFromRII",
|
|
41
42
|
"getTabulatedDataFromRII",
|
|
42
|
-
"
|
|
43
|
+
"LightwaveExplorerResult",
|
|
43
44
|
"load",
|
|
44
45
|
"loadSplit",
|
|
45
46
|
"norma",
|
|
@@ -50,4 +51,5 @@ __all__ = [
|
|
|
50
51
|
"printSellmeier",
|
|
51
52
|
"sellmeier",
|
|
52
53
|
"sellmeierFit",
|
|
54
|
+
"getFieldVector",
|
|
53
55
|
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lightwaveexplorer-2026.1 → lightwaveexplorer-2026.2}/src/LightwaveExplorer.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{lightwaveexplorer-2026.1 → lightwaveexplorer-2026.2}/src/LightwaveExplorer.egg-info/requires.txt
RENAMED
|
File without changes
|
{lightwaveexplorer-2026.1 → lightwaveexplorer-2026.2}/src/LightwaveExplorer.egg-info/top_level.txt
RENAMED
|
File without changes
|