attempt at realisting bandpass attenuation (noise)
This commit is contained in:
@@ -6,5 +6,5 @@ Van der Waals constants : https://en.wikipedia.org/wiki/Van_der_Waals_constants_
|
|||||||
Chi3 : Wahlstrand 2012
|
Chi3 : Wahlstrand 2012
|
||||||
|
|
||||||
# `raman_response.csv`
|
# `raman_response.csv`
|
||||||
Raman impulse response recovered from measured gain spectrum. This is used then `raman_type` is set to `"measured"`.
|
Raman impulse response recovered from measured gain spectrum. This is used then `raman_type` is set to `"measured"` (Stolen1989).
|
||||||
|
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ def create_zoom_axis(
|
|||||||
return inset
|
return inset
|
||||||
|
|
||||||
|
|
||||||
def corner_annotation(text, ax, position="tl", pts_x=8, pts_y=8, **text_kwargs):
|
def corner_annotation(text, ax, position="tl", pts_x=4, pts_y=4, **text_kwargs):
|
||||||
"""puts an annotatin in a corner of an ax
|
"""puts an annotatin in a corner of an ax
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
|
|||||||
@@ -202,12 +202,23 @@ class Spectrum(np.ndarray):
|
|||||||
def energy(self) -> np.ndarray:
|
def energy(self) -> np.ndarray:
|
||||||
return np.trapz(self.time_int, x=self.t, axis=-1)
|
return np.trapz(self.time_int, x=self.t, axis=-1)
|
||||||
|
|
||||||
def mask_wl(self, pos: float, width: float) -> Spectrum:
|
def mask_wl(self, pos: float, width: float, preserve_sn: bool = False) -> Spectrum:
|
||||||
"""
|
"""
|
||||||
Filters the spectrum with a bandpass centered at `pos` of FWHM `width`.
|
Filters the spectrum with a bandpass centered at `pos` of FWHM `width`.
|
||||||
The FWHM is taken on the intensity profile, not on the complex amplitude
|
The FWHM is taken on the intensity profile, not on the complex amplitude
|
||||||
"""
|
"""
|
||||||
return self * np.exp(-(((self.l - pos) / (pulse.fwhm_to_T0_fac["gaussian"] * width)) ** 2))
|
band = np.exp(-(((self.l - pos) / (pulse.fwhm_to_T0_fac["gaussian"] * width)) ** 2))
|
||||||
|
if preserve_sn:
|
||||||
|
dt = self.t[1] - self.t[0]
|
||||||
|
sn = np.fft.fft(
|
||||||
|
np.reshape(
|
||||||
|
[pulse.shot_noise(self.w, dt) for _ in range(np.prod(self.shape[:-1]))],
|
||||||
|
self.shape,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return self * band + np.sqrt(1 - band**2) * sn
|
||||||
|
else:
|
||||||
|
return self * band
|
||||||
|
|
||||||
def measure(self) -> tuple[float, float, float]:
|
def measure(self) -> tuple[float, float, float]:
|
||||||
"""returns fwhm, peak power and energy"""
|
"""returns fwhm, peak power and energy"""
|
||||||
|
|||||||
Reference in New Issue
Block a user