Changeset 8bd379a in sasmodels


Ignore:
Timestamp:
Feb 2, 2018 9:19:14 AM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
032646d
Parents:
049e02d
Message:

explore/realspace: fix bug in numba version of x-y calculator

File:
1 edited

Legend:

Unmodified
Added
Removed
  • explore/realspace.py

    r7d0afa3 r8bd379a  
    274274    from numba import njit 
    275275    @njit("f8[:](f8[:],f8[:],f8[:],f8[:],f8[:],f8[:],f8[:])") 
    276     def _Iqxy_jit(values, x, y, z, qa, qb, qc): 
     276    def _Iqxy(values, x, y, z, qa, qb, qc): 
    277277        Iq = np.zeros_like(qa) 
    278278        for j in range(len(Iq)): 
    279279            total = 0. + 0j 
    280             for k in range(len(Iq)): 
     280            for k in range(len(values)): 
    281281                total += values[k]*np.exp(1j*(qa[j]*x[k] + qb[j]*y[k] + qc[j]*z[k])) 
    282282            Iq[j] = abs(total)**2 
     
    289289    values = rho*volume 
    290290    x, y, z = points.T 
     291    values, x, y, z, qa, qb, qc = [np.asarray(v, 'd') 
     292                                   for v in (values, x, y, z, qa, qb, qc)] 
    291293 
    292294    # I(q) = |sum V(r) rho(r) e^(1j q.r)|^2 / sum V(r) 
     
    385387    # P(r) with uniform steps in r is 3x faster; check if we are uniform 
    386388    # before continuing 
     389    r, rho, points = [np.asarray(v, 'd') for v in (r, rho, points)] 
    387390    if np.max(np.abs(np.diff(r) - r[0])) > r[0]*0.01: 
    388391        Pr = _calc_Pr_nonuniform(r, rho, points) 
Note: See TracChangeset for help on using the changeset viewer.