hdudata = pf.open(p_new)
tbdata = hdudata[1].data
hdudata.close()
MGII = unumpy.uarray(tbdata['LOGL_BROAD_MGII'],abs(tbdata['LOGL_BROAD_MGII_ERR']))
lum = unumpy.uarray(1.0 , 1.0)
for i in range (len(tbdata)):
if (tbdata['LOGL_BROAD_MGII'][i] != 0.0):
a = unumpy.nominal_values(unumpy.pow(10 , MGII[i])/34.0)
b = unumpy.std_devs(unumpy.pow(10 , MGII[i])/34.0)
lum[i] =+ ufloat(a[0] , b[0])
print 'MGII'
print unumpy.pow(10 , MGII[i])/34.0
print lum[i]
我收到了这个错误
IndexError Traceback (most recent call last)
C:\Users\Denny\Documents\Denny\Unimib\Tesina_triennale\Programma_fit\Fit_lin_log.py in <module>()
72 a = unumpy.nominal_values(unumpy.pow(10 , MGII[i])/34.0)
73 b = unumpy.std_devs(unumpy.pow(10 , MGII[i])/34.0)
---> 74 lum[i] =+ ufloat(a[0] , b[0])
75 print 'MGII'
76 print unumpy.pow(10 , MGII[i])/34.0
IndexError: too many indices for array
我插入了大量的印刷品来研究这个问题。 unumpy函数给出一个数组类型对象。