laserfields 0.4.2__tar.gz → 0.4.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.
- {laserfields-0.4.2 → laserfields-0.4.3}/PKG-INFO +1 -1
- {laserfields-0.4.2 → laserfields-0.4.3}/laserfields/__init__.py +1 -1
- {laserfields-0.4.2 → laserfields-0.4.3}/laserfields/laserfields.py +24 -19
- {laserfields-0.4.2 → laserfields-0.4.3}/.github/workflows/python-package.yml +0 -0
- {laserfields-0.4.2 → laserfields-0.4.3}/.gitignore +0 -0
- {laserfields-0.4.2 → laserfields-0.4.3}/LICENSE +0 -0
- {laserfields-0.4.2 → laserfields-0.4.3}/README.md +0 -0
- {laserfields-0.4.2 → laserfields-0.4.3}/examples/examples.ipynb +0 -0
- {laserfields-0.4.2 → laserfields-0.4.3}/examples/laserdat.dat +0 -0
- {laserfields-0.4.2 → laserfields-0.4.3}/pyproject.toml +0 -0
- {laserfields-0.4.2 → laserfields-0.4.3}/tests/__init__.py +0 -0
- {laserfields-0.4.2 → laserfields-0.4.3}/tests/laserdat.dat +0 -0
- {laserfields-0.4.2 → laserfields-0.4.3}/tests/test_all.py +0 -0
|
@@ -208,31 +208,36 @@ class SinExpLaserField(LaserField):
|
|
|
208
208
|
return self.T * gamma(0.5 + n_photon * self.exponent) / (sqrt(π) * gamma(1 + n_photon * self.exponent))
|
|
209
209
|
|
|
210
210
|
|
|
211
|
+
def _make_flattop_jit_envelope(ramponfunc, ramponfuncpr):
|
|
212
|
+
ramponfunc_jit = njit(ramponfunc)
|
|
213
|
+
ramponfuncpr_jit = njit(ramponfuncpr)
|
|
214
|
+
|
|
215
|
+
@vectorize(nopython=True)
|
|
216
|
+
def _jit_envelope(tr, E0, Tflat, Tramp, getprime):
|
|
217
|
+
if abs(tr) > Tflat / 2 + Tramp:
|
|
218
|
+
return 0.0
|
|
219
|
+
elif abs(tr) > Tflat / 2:
|
|
220
|
+
trel = (Tramp + Tflat / 2 - abs(tr)) / Tramp
|
|
221
|
+
if getprime:
|
|
222
|
+
return -E0 * np.sign(tr) * ramponfuncpr_jit(trel) / Tramp
|
|
223
|
+
else:
|
|
224
|
+
return E0 * ramponfunc_jit(trel)
|
|
225
|
+
else:
|
|
226
|
+
return 0.0 if getprime else E0
|
|
227
|
+
|
|
228
|
+
return _jit_envelope
|
|
229
|
+
|
|
230
|
+
|
|
211
231
|
@dataclass
|
|
212
232
|
class FlatTopLaserField(LaserField):
|
|
213
233
|
Tflat: float
|
|
214
234
|
Tramp: float
|
|
215
235
|
|
|
216
|
-
def
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
ramponfunc = njit(self.ramponfunc)
|
|
220
|
-
ramponfuncpr = njit(self.ramponfuncpr)
|
|
221
|
-
|
|
222
|
-
@vectorize(nopython=True)
|
|
223
|
-
def _jit_envelope(tr, E0, Tflat, Tramp, getprime):
|
|
224
|
-
if abs(tr) > Tflat / 2 + Tramp:
|
|
225
|
-
return 0.0
|
|
226
|
-
elif abs(tr) > Tflat / 2:
|
|
227
|
-
trel = (Tramp + Tflat / 2 - abs(tr)) / Tramp
|
|
228
|
-
if getprime:
|
|
229
|
-
return -E0 * np.sign(tr) * ramponfuncpr(trel) / Tramp
|
|
230
|
-
else:
|
|
231
|
-
return E0 * ramponfunc(trel)
|
|
232
|
-
else:
|
|
233
|
-
return 0.0 if getprime else E0
|
|
236
|
+
def __init_subclass__(cls, **kwargs):
|
|
237
|
+
super().__init_subclass__(**kwargs)
|
|
238
|
+
cls._jit_envelope = _make_flattop_jit_envelope(cls.ramponfunc, cls.ramponfuncpr)
|
|
234
239
|
|
|
235
|
-
|
|
240
|
+
def _envelope(self, tr):
|
|
236
241
|
env = self._jit_envelope(tr, self.E0, self.Tflat, self.Tramp, False)
|
|
237
242
|
envpr = self._jit_envelope(tr, self.E0, self.Tflat, self.Tramp, True)
|
|
238
243
|
return env, envpr
|
|
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
|