new: pulse center of gravity

This commit is contained in:
Benoît Sierro
2023-08-17 16:31:03 +02:00
parent 400f3be4ae
commit 313bb3295e

View File

@@ -122,6 +122,11 @@ class Spectrum(np.ndarray):
return self.l[np.argmax(self.wl_int, axis=-1)] return self.l[np.argmax(self.wl_int, axis=-1)]
return np.array([s.wl_max for s in self]) return np.array([s.wl_max for s in self])
@property
def center_of_gravity(self):
intensity = self.time_int
return np.sum(intensity * self.t) / np.sum(intensity)
def mask_wl(self, pos: float, width: float) -> Spectrum: def mask_wl(self, pos: float, width: float) -> 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`.