本文整理汇总了Python中spectral_cube.SpectralCube.mean方法的典型用法代码示例。如果您正苦于以下问题:Python SpectralCube.mean方法的具体用法?Python SpectralCube.mean怎么用?Python SpectralCube.mean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spectral_cube.SpectralCube
的用法示例。
在下文中一共展示了SpectralCube.mean方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SpectralCube
# 需要导入模块: from spectral_cube import SpectralCube [as 别名]
# 或者: from spectral_cube.SpectralCube import mean [as 别名]
tcube.write(hpath(outpath), overwrite=True)
rcube = SpectralCube(data=rcubedata, wcs=cubeA.wcs,
mask=cubeA.mask, meta={'unit':'K'},
header=cubeA.header,
)
outpath = 'RatioCube_DendrogramObjects{0}.fits'.format(sm)
rcube.write(hpath(outpath), overwrite=True)
max_temcube = tcube.max(axis=0)
max_temcube.hdu.writeto(hpath('TemperatureCube_DendrogramObjects{0}_Piecewise_max.fits'.format(sm)), clobber=True)
max_rcube = rcube.max(axis=0)
max_rcube.hdu.writeto(hpath('RatioCube_DendrogramObjects{0}_Piecewise_max.fits'.format(sm)), clobber=True)
mean_temcube = tcube.mean(axis=0)
mean_temcube.hdu.writeto(hpath('TemperatureCube_DendrogramObjects{0}_Piecewise_mean.fits'.format(sm)), clobber=True)
mean_rcube = rcube.mean(axis=0)
mean_rcube.hdu.writeto(hpath('RatioCube_DendrogramObjects{0}_Piecewise_mean.fits'.format(sm)), clobber=True)
hdu_template = mean_rcube.hdu
tcube = tcube.filled_data[:].value
weight_cube = cube303sm if 'smooth' in sm else cube303
weights = weight_cube.filled_data[:].value
weights[weights < 0] = 0
mean_temcube = np.nansum(tcube*weights, axis=0) / np.nansum(weights, axis=0)
hdu_template.data = mean_temcube
hdu_template.writeto(hpath('TemperatureCube_DendrogramObjects{0}_Piecewise_weightedmean.fits'.format(sm)), clobber=True)
mean_rcube = np.nansum(rcube*weights,axis=0) / np.nansum(weights, axis=0)
hdu_template.data = mean_rcube