Loading sas_temper/sas_calc.py +6 −6 Original line number Diff line number Diff line Loading @@ -28,10 +28,10 @@ def calc_profile(d, mc, usm): for i in range(0,len(d.x)): tot = 0.0 min = d.x[i] - 4.5*d.dx[i] minq = d.x[i] - 4.5*d.dx[i] qstep = 4.5*d.dx[i]/30.0 for j in range(0,61): qv = m.fabs(min + j*qstep) qv = m.fabs(minq + j*qstep) tmp = np.interp(qv,usm.x,usm.y) # the number on the next line is ~sqrt(2*Pi) tot += tmp*qstep*m.exp(-(qv-d.x[i])*(qv-d.x[i])/(2.0*d.dx[i]*d.dx[i]))/(2.506628273*d.dx[i]) Loading Loading @@ -105,12 +105,12 @@ def calc_profile_usm(d, mc): # mc is the model configuration, d is the input data, mi is the calculated model profile def chisq(mc, d, mi): # this is quite straightforward sum = 0 sumv = 0 for i in range(0,len(d.x)): sum += (d.y[i]-mi.y[i])*(d.y[i]-mi.y[i])/(d.dy[i]*d.dy[i]) sumv += (d.y[i]-mi.y[i])*(d.y[i]-mi.y[i])/(d.dy[i]*d.dy[i]) sum = m.sqrt(sum/(mc.free_params-1)) sumv = m.sqrt(sumv/(mc.free_params-1)) return sum return sumv Loading
sas_temper/sas_calc.py +6 −6 Original line number Diff line number Diff line Loading @@ -28,10 +28,10 @@ def calc_profile(d, mc, usm): for i in range(0,len(d.x)): tot = 0.0 min = d.x[i] - 4.5*d.dx[i] minq = d.x[i] - 4.5*d.dx[i] qstep = 4.5*d.dx[i]/30.0 for j in range(0,61): qv = m.fabs(min + j*qstep) qv = m.fabs(minq + j*qstep) tmp = np.interp(qv,usm.x,usm.y) # the number on the next line is ~sqrt(2*Pi) tot += tmp*qstep*m.exp(-(qv-d.x[i])*(qv-d.x[i])/(2.0*d.dx[i]*d.dx[i]))/(2.506628273*d.dx[i]) Loading Loading @@ -105,12 +105,12 @@ def calc_profile_usm(d, mc): # mc is the model configuration, d is the input data, mi is the calculated model profile def chisq(mc, d, mi): # this is quite straightforward sum = 0 sumv = 0 for i in range(0,len(d.x)): sum += (d.y[i]-mi.y[i])*(d.y[i]-mi.y[i])/(d.dy[i]*d.dy[i]) sumv += (d.y[i]-mi.y[i])*(d.y[i]-mi.y[i])/(d.dy[i]*d.dy[i]) sum = m.sqrt(sum/(mc.free_params-1)) sumv = m.sqrt(sumv/(mc.free_params-1)) return sum return sumv