Traceback (most recent call last):
File "C:\Users\ASUS\anaconda3\lib\site-packages\emcee\ensemble.py", line 545, in __call__
return self.f(x, *self.args, **self.kwargs)
File "<ipython-input-95-627a7e4792e9>", line 11, in logposterior
return lp + log_likelihoodboss(theta, dataHd, covariance, BOSSDR12_z)
File "<ipython-input-94-8ffe5ede0b1c>", line 15, in log_likelihoodboss
ymu= dataHd-matriksmodel
numpy.core._exceptions.UFuncTypeError: ufunc 'subtract' did not contain a loop with signature matching types (dtype('<U32'), dtype('<U32')) -> dtype('<U32')
这是可能性
def log_likelihoodboss(theta, dataHd, covariance, BOSSDR12_z):
A, B, C, D, epsilon, rd= theta
Hfid = 67.
rd_fid = 147.78
teori = []
for i in range(len(BOSSDR12_z)):
H = Hfid*(A*(1+BOSSDR12_z[i])**3 + B + C*BOSSDR12_z[i] + D*(1+BOSSDR12_z[i])**epsilon)**0.5
integral = integrate.quad(lambda x: 1/H, 0, BOSSDR12_z[i])
DM = c*integral[0]
kuantitas1 = DM*(rd_fid/rd)
teori.append(kuantitas1)
kuantitas2 = H*rd/rd_fid
teori.append(kuantitas2)
matriksmodel= np.array(teori).reshape(6,1)
ymu= dataHd-matriksmodel
chisquare= np.dot(np.dot(ymu.T, np.linalg.inv(covariance)), ymu)
return -0.5 * chisquare
ymu是一个(6,1)矩阵。