def get_smoothed_white(self, npix=2, save=True, show=False, **kwargs):
"""Gets an smoothed version (Gaussian of sig=npix)
of the white image. If save is True, it writes a file
to disk called `smoothed_white.fits`.
**kwargs are passed down to scipy.ndimage.gaussian_filter()
"""
hdulist = self.hdulist_white
im = self.white_data
if npix > 0:
smooth_im = ndimage.gaussian_filter(im, sigma=npix, **kwargs)
else:
smooth_im = im
if save:
hdulist[1].data = smooth_im
prihdr = hdulist[0].header
comment = 'Spatially smoothed with a Gaussian kernel of sigma={} spaxels (by MuseCube)'.format(npix)
# print(comment)
prihdr['history'] = comment
hdulist.writeto('smoothed_white.fits', clobber=True)
if show:
fig = aplpy.FITSFigure('smoothed_white.fits', figure=plt.figure())
fig.show_grayscale(vmin=self.vmin,vmax=self.vmax)
return smooth_im
评论列表
文章目录