diff --git a/src/scgenerator/spectra.py b/src/scgenerator/spectra.py index a76841d..0976b8a 100644 --- a/src/scgenerator/spectra.py +++ b/src/scgenerator/spectra.py @@ -122,6 +122,11 @@ class Spectrum(np.ndarray): return self.l[np.argmax(self.wl_int, axis=-1)] 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: """ Filters the spectrum with a bandpass centered at `pos` of FWHM `width`.