Changeset d7af1c6 in sasmodels for sasmodels/sesans.py


Ignore:
Timestamp:
Jun 12, 2018 4:01:29 AM (6 years ago)
Author:
Adam Washington <adam.washington@…>
Branches:
master
Children:
ac995be
Parents:
02e3c54
Message:

First attempt at log spaced sesans

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/sesans.py

    r38935ec rd7af1c6  
    1414import numpy as np  # type: ignore 
    1515from numpy import pi  # type: ignore 
    16 from scipy.special import j0 
     16from scipy.special import j0, j1 
     17 
    1718 
    1819class SesansTransform(object): 
     
    5960        SElength = np.asarray(SElength, dtype='float32') 
    6061 
    61         #Rmax = #value in text box somewhere in FitPage? 
     62        # Rmax = #value in text box somewhere in FitPage? 
    6263        q_max = 2*pi / (SElength[1] - SElength[0]) 
    6364        q_min = 0.1 * 2*pi / (np.size(SElength) * SElength[-1]) 
    64         q = np.arange(q_min, q_max, q_min, dtype='float32') 
    65         dq = q_min 
     65        # q = np.arange(q_min, q_max, q_min, dtype='float32') 
     66        q = np.exp(np.arange(np.log(q_min), np.log(q_max), np.log(2), 
     67                             dtype=np.float32)) 
     68        q = np.hstack([0], q) 
    6669 
    67         H0 = np.float32(dq/(2*pi)) * q 
     70        H0 = np.pi * (q[1:]**2 - q[-1]**2) 
    6871 
    6972        # repq = np.tile(q, (SElength.size, 1)).T 
    7073        H = np.outer(q, SElength) 
    71         j0(H, out=H) 
    72         H *= np.float32(dq/(2*pi)) 
    73         H *= q.reshape((-1, 1)) 
     74        j1(H, out=H) 
     75        H *= q 
     76        H = H[1:] - H[:-1] 
     77        H *= 2 * np.pi / SElength 
    7478 
    7579        lam = np.asarray(lam, dtype=np.float32) 
Note: See TracChangeset for help on using the changeset viewer.