def alt_results(self, samples, kplanets):
titles = sp.array(["Amplitude","Period","Longitude", "Phase","Eccentricity", 'Acceleration', 'Jitter', 'Offset', 'MACoefficient', 'MATimescale', 'Stellar Activity'])
namen = sp.array([])
ndim = kplanets * 5 + self.nins*2*(self.MOAV+1) + self.totcornum + 1
RESU = sp.zeros((ndim, 5))
for k in range(kplanets):
namen = sp.append(namen, [titles[i] + '_'+str(k) for i in range(5)])
namen = sp.append(namen, titles[5]) # for acc
for i in range(self.nins):
namen = sp.append(namen, [titles[ii] + '_'+str(i+1) for ii in sp.arange(2)+6])
for c in range(self.MOAV):
namen = sp.append(namen, [titles[ii] + '_'+str(i+1) + '_'+str(c+1) for ii in sp.arange(2)+8])
for h in range(self.totcornum):
namen = sp.append(namen, titles[-1]+'_'+str(h+1))
alt_res = map(lambda v: (v[2], v[3]-v[2], v[2]-v[1], v[4]-v[2], v[2]-v[0]),
zip(*np.percentile(samples, [2, 16, 50, 84, 98], axis=0)))
logdat = '\nAlternative results with uncertainties based on the 2nd, 16th, 50th, 84th and 98th percentiles of the samples in the marginalized distributions'
logdat = '\nFormat is like median +- 1-sigma, +- 2-sigma'
for res in range(ndim):
logdat += '\n'+namen[res]+' : '+str(alt_res[res][0])+' +- '+str(alt_res[res][1:3]) +' 2% +- '+str(alt_res[res][3:5])
RESU[res] = sp.percentile(samples, [2, 16, 50, 84, 98], axis=0)[:, res]
print(logdat)
return RESU
评论列表
文章目录