Changeset 9404dd3 in sasmodels for sasmodels/resolution.py
- Timestamp:
- Dec 4, 2015 12:41:47 PM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- eaca9eb
- Parents:
- 7bb290c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/resolution.py
rd138d43 r9404dd3 134 134 Apply the resolution weight matrix to the computed theory function. 135 135 """ 136 #print "apply shapes", theory.shape, weight_matrix.shape136 #print("apply shapes", theory.shape, weight_matrix.shape) 137 137 Iq = np.dot(theory[None,:], weight_matrix) 138 #print "result shape",Iq.shape138 #print("result shape",Iq.shape) 139 139 return Iq.flatten() 140 140 … … 287 287 weights = np.zeros((len(q), len(q_calc)), 'd') 288 288 289 #print q_calc289 #print(q_calc) 290 290 for i, (qi, w, h) in enumerate(zip(q, width, height)): 291 291 if w == 0. and h == 0.: … … 301 301 in_x = 1.0 * ((q_calc >= qi-h) & (q_calc <= qi+h)) 302 302 abs_x = 1.0*(q_calc < abs(qi - h)) if qi < h else 0. 303 #print qi - h, qi + h304 #print in_x + abs_x303 #print(qi - h, qi + h) 304 #print(in_x + abs_x) 305 305 weights[i,:] = (in_x + abs_x) * np.diff(q_edges) / (2*h) 306 306 else: … … 320 320 u_edges[q_edges > u_limit] = u_limit**2 - qi**2 321 321 weights = np.diff(np.sqrt(u_edges))/w 322 #print "i, qi",i,qi,qi+width323 #print q_calc324 #print weights322 #print("i, qi",i,qi,qi+width) 323 #print(q_calc) 324 #print(weights) 325 325 return weights 326 326 … … 521 521 u = sqrt((qi+h_grid)**2 + w_grid**2) 522 522 Iu = np.interp(u, q_calc, Iq) 523 #print np.trapz(Iu, w_grid, axis=1)523 #print(np.trapz(Iu, w_grid, axis=1)) 524 524 Is = np.trapz(np.trapz(Iu, w_grid, axis=1), h_grid[:,0]) 525 525 result[i] = Is / (2*h*w) … … 675 675 #idx = abs(err) >= tolerance 676 676 #problem = zip(q[idx], output[idx], answer[idx], err[idx]) 677 #print "\n".join(str(v) for v in problem)677 #print("\n".join(str(v) for v in problem)) 678 678 np.testing.assert_allclose(output, answer, rtol=tolerance) 679 679 … … 786 786 output = resolution.apply(eval_form(resolution.q_calc, form, pars)) 787 787 # TODO: 10% is too much error; use better algorithm 788 #print np.max(abs(answer-output)/answer)788 #print(np.max(abs(answer-output)/answer)) 789 789 self.compare(q, output, answer, 0.1) 790 790
Note: See TracChangeset
for help on using the changeset viewer.