Changeset 3f3df6c in sasmodels


Ignore:
Timestamp:
Mar 28, 2019 10:34:42 AM (5 years ago)
Author:
awashington
Branches:
master
Children:
ccbbc3b
Parents:
0c7b8d8
git-author:
Adam Washington <rprospero@…> (03/28/19 10:16:34)
git-committer:
Adam Washington <rprospero@…> (03/28/19 10:34:42)
Message:

Remove fancy integration

It's too much for a single commit and I can't be sure if it's fixing
things or making them worse.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/sesans.py

    r0c7b8d8 r3f3df6c  
    1414import numpy as np  # type: ignore 
    1515from numpy import pi  # type: ignore 
    16 from scipy.special import j1 
     16from scipy.special import j0 
    1717 
    1818 
     
    5959    def _set_hankel(self, SElength, lam, zaccept, Rmax): 
    6060        # type: (np.ndarray, float, float) -> None 
    61         SElength = np.asarray(SElength, dtype='float64') 
    62  
    63         # Rmax = #value in text box somewhere in FitPage? 
     61        SElength = np.asarray(SElength) 
    6462        q_max = 2*pi / (SElength[1] - SElength[0]) 
    6563        q_min = 0.1 * 2*pi / (np.size(SElength) * SElength[-1]) 
    66         # q = np.arange(q_min, q_max, q_min, dtype='float32') 
    67         # q = np.exp(np.arange(np.log(q_min), np.log(q_max), np.log(2), 
    68         #                      dtype=np.float32)) 
    69         q = np.exp(np.linspace(np.log(q_min), np.log(q_max), 10*SElength.size, 
    70                                dtype=np.float64)) 
    71         q = np.hstack([[0], q]) 
     64        q = np.exp(np.arange(np.log(q_min), np.log(q_max), np.log(1.0003))) 
    7265 
    73         H0 = (q[1:]**2 - q[:-1]**2) / (2 * np.pi) / 2 
     66        dq = q[1:]-q[:-1] 
     67        dq = np.hstack([[dq[0]], dq]) 
    7468 
    75         # repq = np.tile(q, (SElength.size, 1)).T 
     69        H0 = dq/(2*pi) * q 
     70 
    7671        H = np.outer(q, SElength) 
    77         j1(H, out=H) 
    78         H *= q.reshape((-1, 1)) 
    79         H = H[1:] - H[:-1] 
    80         H /= 2 * np.pi * SElength 
     72        j0(H, out=H) 
     73        H *= (dq * q).reshape((-1, 1)) 
     74        H /= 2*pi 
    8175 
    82         lam = np.asarray(lam, dtype=np.float64) 
    83         reptheta = np.outer(q[1:], lam) 
    84         reptheta /= np.float64(2*np.pi) 
     76        reptheta = np.outer(q, lam) 
     77        reptheta /= 2*np.pi 
    8578        np.arcsin(reptheta, out=reptheta) 
    86         # reptheta = np.arcsin(repq*replam/2*np.pi) 
    8779        mask = reptheta > zaccept 
    88         # H[mask] = 0 
     80        H[mask] = 0 
    8981 
    90         # H = np.zeros((q.size, SElength.size), dtype=np.float32) 
    91         # H0 = q * 0 
    92         assert(H.shape == (q.size-1, SElength.size)) 
    93  
    94         self.q_calc = q[1:] 
     82        self.q_calc = q 
    9583        self._H, self._H0 = H, H0 
Note: See TracChangeset for help on using the changeset viewer.