def gaussian_smooth(self, fwhm, **kwargs):
profile_sigma = fwhm / (2 * (2*np.log(2))**0.5)
# The requested FWHM is in Angstroms, but the dispersion between each
# pixel is likely less than an Angstrom, so we must calculate the true
# smoothing value
true_profile_sigma = profile_sigma / np.median(np.diff(self.dispersion))
smoothed_flux = ndimage.gaussian_filter1d(self.flux, true_profile_sigma, **kwargs)
# TODO modify ivar based on smoothing?
return self.__class__(self.dispersion, smoothed_flux, self.ivar.copy(), metadata=self.metadata.copy())
评论列表
文章目录