Changeset 2ccb775 in sasmodels for sasmodels/sesans.py


Ignore:
Timestamp:
Nov 9, 2016 3:50:01 PM (7 years ago)
Author:
jhbakker
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
46d9f48
Parents:
1a6cd57
Message:

Experimenting with Hankel transform optimizations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/sesans.py

    r3023268 r2ccb775  
    5454        # data.has_z_acceptance 
    5555        return [q] 
     56 
     57def hankeltrafo(H0, H, Iq_calc): 
     58    G0 = np.dot(H0, Iq_calc) 
     59    G=[] 
     60    for i in range(len(H[0, :])): 
     61        Gtmp = np.dot(H[:, i], Iq_calc) 
     62        G.append(Gtmp) 
     63    P = G - G0 
     64    return P  # This is the logarithmic P, not the linear one as found in Andersson2008 
     65 
     66""" 
     67class HankelTransform(object): 
     68    def __init__(self,q_calc, SElength): 
     69        dq = q_calc[1]-q_calc[0] 
     70        self.H0 = dq / (2 * pi) * q_calc 
     71        self.H = dq / (2 * pi) * besselj(0, np.outer(q_calc, SElength)) 
     72 
     73    def apply(self, Iq_calc): 
     74        G0 = np.dot(self.H0, Iq_calc) 
     75        G = np.dot(self.H, Iq_calc) 
     76        return G - G0 #This is the logarithmic G, not the linear one as found in Andersson2008 
     77""" 
    5678 
    5779def transform(data, q_calc, Iq_calc, qmono, Iq_mono): 
     
    208230        integral = besselj(0, q*SElength_i)*Iq*q 
    209231        G[i] = np.sum(integral) 
    210     G0 = np.sum(Iq*q) #relation to ksi? For generalization to all models 
     232    #G0 = np.sum(Iq*q) #relation to ksi? For generalization to all models 
    211233 
    212234    # [m^-1] step size in q, needed for integration 
Note: See TracChangeset for help on using the changeset viewer.