laserfields 0.4.1__tar.gz → 0.4.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.
- {laserfields-0.4.1 → laserfields-0.4.2}/PKG-INFO +1 -1
- {laserfields-0.4.1 → laserfields-0.4.2}/laserfields/__init__.py +1 -1
- {laserfields-0.4.1 → laserfields-0.4.2}/laserfields/laserfields.py +9 -4
- {laserfields-0.4.1 → laserfields-0.4.2}/tests/test_all.py +5 -5
- {laserfields-0.4.1 → laserfields-0.4.2}/.github/workflows/python-package.yml +0 -0
- {laserfields-0.4.1 → laserfields-0.4.2}/.gitignore +0 -0
- {laserfields-0.4.1 → laserfields-0.4.2}/LICENSE +0 -0
- {laserfields-0.4.1 → laserfields-0.4.2}/README.md +0 -0
- {laserfields-0.4.1 → laserfields-0.4.2}/examples/examples.ipynb +0 -0
- {laserfields-0.4.1 → laserfields-0.4.2}/examples/laserdat.dat +0 -0
- {laserfields-0.4.1 → laserfields-0.4.2}/pyproject.toml +0 -0
- {laserfields-0.4.1 → laserfields-0.4.2}/tests/__init__.py +0 -0
- {laserfields-0.4.1 → laserfields-0.4.2}/tests/laserdat.dat +0 -0
|
@@ -148,10 +148,15 @@ class GaussianLaserField(LaserField):
|
|
|
148
148
|
|
|
149
149
|
def expiatbt2_intT(a, b, T):
|
|
150
150
|
# returns the result of the integral Int(exp(i*(a*t+b*t**2)),{t,-T/2,T/2}) / sqrt(2*pi)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
bTsq = b * T**2
|
|
152
|
+
if abs(bTsq) <= 1e-5:
|
|
153
|
+
aT = a * T
|
|
154
|
+
# use first-order expansion for small b to avoid numerical errors
|
|
155
|
+
# + 1e-250 to avoid division by zero
|
|
156
|
+
x1 = 2j * b / (a**2 + 1e-250)
|
|
157
|
+
x2 = x1 * cos(aT / 2) + (1 - x1 + 0.25j * bTsq) * sinc(aT / (2 * π))
|
|
158
|
+
# avoid numerical errors for small aT
|
|
159
|
+
x2 = np.where(abs(aT) < 1e-8, 1 + 1j/12 * bTsq - bTsq**2/160, x2)
|
|
155
160
|
return x2 * T / sqrt(2 * π)
|
|
156
161
|
zz1 = (1 + 1j) / 4
|
|
157
162
|
z34 = (-1.0 + 1j) / sqrt(2) # == (-1)**(3/4)
|
|
@@ -109,13 +109,13 @@ def test_Teff():
|
|
|
109
109
|
def test_fourier():
|
|
110
110
|
# Test the Fourier transform of the laser fields
|
|
111
111
|
# Compare the analytical Fourier transform with the numerical one (computed using FFT)
|
|
112
|
-
for chirp in -1e-3, -1e-20, 0, 1e-20, 1e-3:
|
|
112
|
+
for chirp in -0.0011, -0.0009, -1e-3, -1e-20, 0, 1e-20, 1e-3, 0.0009, 0.0011:
|
|
113
113
|
general_args = dict(is_vecpot=True, E0=1.5, ω0=0.12, t0=500.0, chirp=chirp, ϕ0=0.8 * np.pi)
|
|
114
114
|
for lf in [
|
|
115
115
|
GaussianLaserField(**general_args, σ=100.0),
|
|
116
|
-
SinExpLaserField(**general_args, T=
|
|
117
|
-
SinExpLaserField(**general_args, T=
|
|
118
|
-
SinExpLaserField(**general_args, T=
|
|
116
|
+
SinExpLaserField(**general_args, T=100.0, exponent=2),
|
|
117
|
+
SinExpLaserField(**general_args, T=100.0, exponent=4),
|
|
118
|
+
SinExpLaserField(**general_args, T=100.0, exponent=7),
|
|
119
119
|
LinearFlatTopLaserField(**general_args, Tflat=400.0, Tramp=150),
|
|
120
120
|
Linear2FlatTopLaserField(**general_args, Tflat=400.0, Tramp=150),
|
|
121
121
|
]:
|
|
@@ -134,5 +134,5 @@ def test_fourier():
|
|
|
134
134
|
# FFT acts as if ts[0] was t=0, shift to the correct value
|
|
135
135
|
Eω2 *= np.exp(-1j * ts[0] * ωs)
|
|
136
136
|
|
|
137
|
-
atol = 0.02 if isinstance(lf, LinearFlatTopLaserField) else 1e-
|
|
137
|
+
atol = 0.02 if isinstance(lf, LinearFlatTopLaserField) else 1e-3
|
|
138
138
|
assert np.allclose(Eω, Eω2, atol=atol), f"Failed for {lf.__class__.__name__} with chirp {chirp}"
|
|
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
|