added linear attenuation to mask_wl
This commit is contained in:
@@ -203,12 +203,16 @@ class Spectrum(np.ndarray):
|
||||
return np.trapz(self.time_int, x=self.t, axis=-1)
|
||||
|
||||
def mask_wl(
|
||||
self, pos: float, width: float, shot_noise: pulse.ShotNoiseParameter | None = None
|
||||
self,
|
||||
pos: float,
|
||||
width: float,
|
||||
shot_noise: pulse.ShotNoiseParameter | None = None,
|
||||
peak: float = 1.0,
|
||||
) -> Spectrum:
|
||||
"""
|
||||
Filters the spectrum with a bandpass centered at `pos` of FWHM `width`.
|
||||
The FWHM is taken on the intensity profile (as would be in an experiment), not on the
|
||||
complex amplitude
|
||||
complex amplitude.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@@ -216,12 +220,16 @@ class Spectrum(np.ndarray):
|
||||
peak of the gaussian bandpass filter in m
|
||||
width : float
|
||||
fwhm of the bandpass filter, in m
|
||||
sn_args : (bool, bool) | None, optional
|
||||
shot_noise : (bool, bool) | ShotNoiseParameter | None, optional
|
||||
if specified, shot noise is compensated in the attenuation process and this tuple
|
||||
corresponds to (constant_amplitude, phase_only) in `pulse.shot_noise`. By default, shot
|
||||
noise is not compensated.
|
||||
peak : float, optional
|
||||
relative height of the peak of the bandpass filter, by default 1.0, which means the
|
||||
spectrum is untouched at `pos` and attenuated elsewhere. If <1.0, will attenuate even
|
||||
the peak.
|
||||
"""
|
||||
band = np.exp(-(((self.l - pos) / (pulse.fwhm_to_T0_fac["gaussian"] * width)) ** 2))
|
||||
band = peak * np.exp(-(((self.l - pos) / (pulse.fwhm_to_T0_fac["gaussian"] * width)) ** 2))
|
||||
if shot_noise:
|
||||
sn = np.reshape(
|
||||
[pulse.shot_noise(self.w, *shot_noise) for _ in range(np.prod(self.shape[:-1]))],
|
||||
|
||||
Reference in New Issue
Block a user