Ejemplo n.º 1
0
 def residual_lmfit(self, pars, x, y):
     a = P4Rm()
     self.strain_DW(pars)
     res = f_Refl_fit(a.AllDataDict['geometry'], self.Data4f_Refl)
     y_cal = convolve(abs(res) ** 2, a.ParamDict['resol'], mode='same')
     y_cal = y_cal / y_cal.max() + a.AllDataDict['background']
     return (log10(y) - log10(y_cal))
Ejemplo n.º 2
0
 def residual_lmfit(self, pars, x, y):
     a = P4Rm()
     self.strain_DW(pars)
     res = f_Refl_fit(a.AllDataDict["geometry"], self.Data4f_Refl)
     y_cal = convolve(abs(res) ** 2, a.ParamDict["resol"], mode="same")
     y_cal = y_cal / y_cal.max() + a.AllDataDict["background"]
     return log10(y) - log10(y_cal)
Ejemplo n.º 3
0
 def residual_square(self, p, E_min, nb_minima):
     a = P4Rm()
     P4Rm.ParamDict['_fp_min'] = p
     self.strain_DW()
     res = f_Refl_fit(a.AllDataDict['geometry'], self.Data4f_Refl)
     y_cal = convolve(abs(res) ** 2, a.ParamDict['resol'], mode='same')
     y_cal = y_cal / y_cal.max() + a.AllDataDict['background']
     y_obs = a.ParamDict['Iobs']
     self.on_pass_data_to_thread(y_cal, p, E_min, nb_minima)
     return ((log10(y_obs) - log10(y_cal)) ** 2).sum() / len(y_cal)
Ejemplo n.º 4
0
 def residual_square(self, p, E_min, nb_minima):
     a = P4Rm()
     P4Rm.ParamDict["_fp_min"] = p
     self.strain_DW()
     res = f_Refl_fit(a.AllDataDict["geometry"], self.Data4f_Refl)
     y_cal = convolve(abs(res) ** 2, a.ParamDict["resol"], mode="same")
     y_cal = y_cal / y_cal.max() + a.AllDataDict["background"]
     y_obs = a.ParamDict["Iobs"]
     self.on_pass_data_to_thread(y_cal, p, E_min, nb_minima)
     return ((log10(y_obs) - log10(y_cal)) ** 2).sum() / len(y_cal)
Ejemplo n.º 5
0
 def residual_leastsq(self, p, y, x):
     a = P4Rm()
     P4Rm.ParamDict['_fp_min'] = p
     self.strain_DW()
     res = f_Refl_fit(a.AllDataDict['geometry'], self.Data4f_Refl)
     y_cal = convolve(abs(res) ** 2, a.ParamDict['resol'], mode='same')
     y_cal = y_cal / y_cal.max() + a.AllDataDict['background']
     self.count += 1
     if self.count % 50 == 0:
         self.f_strain_DW()
         sleep(0.2)
         deformation = [p]
         evt = LiveEvent(S4R.Live_COUNT, -1, y_cal, None, deformation)
         wx.PostEvent(self.parent, evt)
     if self.need_abort == 1:
         return (log10(y_cal) - log10(y_cal))
     else:
         return (log10(y) - log10(y_cal))
Ejemplo n.º 6
0
 def residual_leastsq(self, p, y, x):
     a = P4Rm()
     P4Rm.ParamDict["_fp_min"] = p
     self.strain_DW()
     res = f_Refl_fit(a.AllDataDict["geometry"], self.Data4f_Refl)
     y_cal = convolve(abs(res) ** 2, a.ParamDict["resol"], mode="same")
     y_cal = y_cal / y_cal.max() + a.AllDataDict["background"]
     self.count += 1
     if self.count % 50 == 0:
         self.f_strain_DW()
         sleep(0.2)
         deformation = [p]
         evt = LiveEvent(S4R.Live_COUNT, -1, y_cal, None, deformation)
         wx.PostEvent(self.parent, evt)
     if self.need_abort == 1:
         return log10(y_cal) - log10(y_cal)
     else:
         return log10(y) - log10(y_cal)
Ejemplo n.º 7
0
 def residual_lmfit4iteration(self, pars):
     a = P4Rm()
     res = f_Refl_fit(a.AllDataDict['geometry'], self.Data4f_Refl)
     y_cal = convolve(abs(res) ** 2, a.ParamDict['resol'], mode='same')
     y_cal = y_cal / y_cal.max() + a.AllDataDict['background']
     return y_cal
Ejemplo n.º 8
0
 def residual_lmfit4iteration(self, pars):
     a = P4Rm()
     res = f_Refl_fit(a.AllDataDict["geometry"], self.Data4f_Refl)
     y_cal = convolve(abs(res) ** 2, a.ParamDict["resol"], mode="same")
     y_cal = y_cal / y_cal.max() + a.AllDataDict["background"]
     return y_cal