Changeset 9404dd3 in sasmodels for sasmodels/resolution.py


Ignore:
Timestamp:
Dec 4, 2015 12:41:47 PM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
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
Message:

python 3.x support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/resolution.py

    rd138d43 r9404dd3  
    134134    Apply the resolution weight matrix to the computed theory function. 
    135135    """ 
    136     #print "apply shapes", theory.shape, weight_matrix.shape 
     136    #print("apply shapes", theory.shape, weight_matrix.shape) 
    137137    Iq = np.dot(theory[None,:], weight_matrix) 
    138     #print "result shape",Iq.shape 
     138    #print("result shape",Iq.shape) 
    139139    return Iq.flatten() 
    140140 
     
    287287    weights = np.zeros((len(q), len(q_calc)), 'd') 
    288288 
    289     #print q_calc 
     289    #print(q_calc) 
    290290    for i, (qi, w, h) in enumerate(zip(q, width, height)): 
    291291        if w == 0. and h == 0.: 
     
    301301            in_x = 1.0 * ((q_calc >= qi-h) & (q_calc <= qi+h)) 
    302302            abs_x = 1.0*(q_calc < abs(qi - h)) if qi < h else 0. 
    303             #print qi - h, qi + h 
    304             #print in_x + abs_x 
     303            #print(qi - h, qi + h) 
     304            #print(in_x + abs_x) 
    305305            weights[i,:] = (in_x + abs_x) * np.diff(q_edges) / (2*h) 
    306306        else: 
     
    320320    u_edges[q_edges > u_limit] = u_limit**2 - qi**2 
    321321    weights = np.diff(np.sqrt(u_edges))/w 
    322     #print "i, qi",i,qi,qi+width 
    323     #print q_calc 
    324     #print weights 
     322    #print("i, qi",i,qi,qi+width) 
     323    #print(q_calc) 
     324    #print(weights) 
    325325    return weights 
    326326 
     
    521521            u = sqrt((qi+h_grid)**2 + w_grid**2) 
    522522            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)) 
    524524            Is = np.trapz(np.trapz(Iu, w_grid, axis=1), h_grid[:,0]) 
    525525            result[i] = Is / (2*h*w) 
     
    675675        #idx = abs(err) >= tolerance 
    676676        #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)) 
    678678        np.testing.assert_allclose(output, answer, rtol=tolerance) 
    679679 
     
    786786        output = resolution.apply(eval_form(resolution.q_calc, form, pars)) 
    787787        # 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)) 
    789789        self.compare(q, output, answer, 0.1) 
    790790 
Note: See TracChangeset for help on using the changeset viewer.