def calibrateNoise(self):
bg, bgstd, las, time, conc, ok = CalibrationDialog.setExt()
_np.asarray(bg)
_np.asarray(bgstd)
_np.asarray(las)
_np.asarray(time)
_np.asarray(conc)
x_3d = _np.array([conc, las, time])
p0 = [1, 1]
fitParamsBg, fitCovariances = curve_fit(fitFuncBg, x_3d, bg, p0)
print(' fit coefficients :\n', fitParamsBg)
# SET VALUES TO PARAMETER
self.lasercEdit.setValue(fitParamsBg[0])
self.imagercEdit.setValue(fitParamsBg[1])
x_3dStd = _np.array([las, time, bg])
p0S = [1, 1, 1]
fitParamsStd, fitCovariances = curve_fit(fitFuncStd, x_3dStd, bgstd, p0S)
print(' fit coefficients2:\n', fitParamsStd)
self.EquationAEdit.setValue(fitParamsStd[0])
self.EquationBEdit.setValue(fitParamsStd[1])
self.EquationCEdit.setValue(fitParamsStd[2])
# Noise model working point
figure4 = plt.figure()
# Background
bgmodel = fitFuncBg(x_3d, fitParamsBg[0], fitParamsBg[1])
ax1 = figure4.add_subplot(121)
ax1.cla()
ax1.plot(bg, bgmodel, 'o')
x = _np.linspace(*ax1.get_xlim())
ax1.plot(x, x)
title = "Background Model:"
ax1.set_title(title)
# Std
bgmodelstd = fitFuncStd(x_3dStd, fitParamsStd[0], fitParamsStd[1], fitParamsStd[2])
ax2 = figure4.add_subplot(122)
ax2.cla()
ax2.plot(bgstd, bgmodelstd, 'o')
x = _np.linspace(*ax2.get_xlim())
ax2.plot(x, x)
title = "Background Model Std:"
ax2.set_title(title)
figure4.show()
评论列表
文章目录