new pulse helper function
This commit is contained in:
@@ -645,7 +645,7 @@ def shot_noise(
|
|||||||
in W.
|
in W.
|
||||||
"""
|
"""
|
||||||
n = len(w)
|
n = len(w)
|
||||||
dw = w[1] - w[0]
|
dw = abs(w[1] - w[0])
|
||||||
dt = 2 * pi / (dw * n)
|
dt = 2 * pi / (dw * n)
|
||||||
if constant_amplitude:
|
if constant_amplitude:
|
||||||
std = np.sqrt(0.5 * units.hbar * np.abs(w[0]) / dw)
|
std = np.sqrt(0.5 * units.hbar * np.abs(w[0]) / dw)
|
||||||
@@ -1396,3 +1396,27 @@ def mask_with_noise(
|
|||||||
) -> T:
|
) -> T:
|
||||||
sn = shot_noise(w, *sn_params)
|
sn = shot_noise(w, *sn_params)
|
||||||
return spectrum * mask + np.sqrt(1.0 - mask**2) * sn
|
return spectrum * mask + np.sqrt(1.0 - mask**2) * sn
|
||||||
|
|
||||||
|
|
||||||
|
def new(
|
||||||
|
t: np.ndarray,
|
||||||
|
w: np.ndarray,
|
||||||
|
shot_noise: ShotNoiseParameter,
|
||||||
|
shape: str,
|
||||||
|
delay=0.0,
|
||||||
|
input_transmission=1.0,
|
||||||
|
ase_level=1.0,
|
||||||
|
peak_power: float | None = None,
|
||||||
|
mean_power: float | None = None,
|
||||||
|
repetition_rate: float | None = None,
|
||||||
|
energy: float | None = None,
|
||||||
|
width: float | None = None,
|
||||||
|
t0: float | None = None,
|
||||||
|
) -> np.ndarray:
|
||||||
|
t0 = t0 if t0 is not None else fwhm_to_T0_fac[shape] * width
|
||||||
|
|
||||||
|
if peak_power is None:
|
||||||
|
energy = energy if energy is not None else mean_power / repetition_rate
|
||||||
|
peak_power = E0_to_P0(energy, t0, shape)
|
||||||
|
pre = initial_field_envelope(t, shape, t0, peak_power, delay)
|
||||||
|
return finalize_pulse(pre, ShotNoiseParameter(shot_noise), w, input_transmission, ase_level)
|
||||||
|
|||||||
Reference in New Issue
Block a user