微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

通过 scipy trapz 数值积分寻找谱线通量返回错误的通量

如何解决通过 scipy trapz 数值积分寻找谱线通量返回错误的通量

我正在研究从恒星中提取光谱活动指数。为此,我查看恒星的光谱并计算必要的线通量。 放大感兴趣区域的频谱示例: Example spectrum

我试图找到照片中“倾角”的通量。 Y 轴代表通量的某个任意单位,x 代表波长。

要计算这条线的通量,必须以特定波长为中心并具有特定大小的方形带通进行积分。在照片的例子中,线以 6562 为中心,带通为 1.6,即积分区域为 6562-0.8 到 6562+0.8

为了计算这个面积,我使用了 scipy.integrate.trapz 可以在这里看到我的代码示例:


f = fits.open('C:/Users/Rp199/Desktop/DATA_NEW/HARPS.2018-04-08T00_27_51.130_s1d_A.fits') # opens the spectrum file
header = f[0].header


flux = f[0].data                # these next 4 lines obtain the flux and wavelength data from the fits file
ref = header['CRVAL1']          
step = header['CDELT1']
wave = np.arange(ref,ref + (len(flux) * step),step)
plt.plot(wave,flux) #plotting
plt.xlim(6550,6600)

wave2 = np.fabs(wave - (6580.310-4.375))    #ignore this,using this to find index of values in 
                                             integration limits
c = np.unravel_index(wave2.argmin(),wave2.shape)
print(wave[277438])


HA16L1 = scipy.integrate.trapz(flux[278015:278175],wave[278015:278175]) #flux of the line
HA16R1 = scipy.integrate.trapz(flux[276363:277438],wave[276363:277438]) #flux of the reference region 2
HA16R2 = scipy.integrate.trapz(flux[279407:280282],wave[279407:280282]) #flux of the reference region 2

sindex = ((HA16L1)/(HA16R1+HA16R2)) # the activity index i am calculating

我正在计算的指数可以在底部看到,由 (F1)/(F2+F3) 给出,其中 f1 是线的通量,f2 和 f3 是参考区域

HA16L1 = scipy.integrate.trapz(flux[278015:278175],wave[278015:278175]) 应该进行上下界的整合。 IE。对 6561.2 和 6562.8 之间的通量进行积分

计算指数(F1)/(F2+F3)返回:0.05455782266432463

已经有一个包可以计算这个,名为 ACTIN。 Github:https://github.com/gomesdasilva/ACTIN

它计算索引的方式与我的计算方式不同,但想法是相同的,集成以找到通量等。在我正在使用的同一文件上使用肌动蛋白时,ACTIN 返回索引:0.1745701108383216,这是非常与我所获得的相差甚远。

显然问题在于我计算线通量的方法,但我不明白为什么。

谢谢

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。