Changeset 2ccb775 in sasmodels


Ignore:
Timestamp:
Nov 9, 2016 3:50:01 PM (8 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

Location:
sasmodels
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/resolution.py

    reb8a82e r2ccb775  
    5959 
    6060class SESANS1D(Resolution): 
    61  
     61    def __init__(self, data, H0, H, q_calc): 
     62        self.q = data.x 
     63        self.H0 = H0 
     64        self.H = H 
     65        self.data=data 
     66        self.q_calc = q_calc 
     67    def apply(self, theory): 
     68        return sesans.hankeltrafo(self.H0, self.H, theory) 
     69 
     70""" 
    6271    def __init__(self, data, q_calc): 
    6372        self.q = data.x 
     
    6776    def apply(self, theory): 
    6877        return sesans.transform(self.data, self.q_calc, theory, None, None) 
    69  
     78""" 
    7079class Pinhole1D(Resolution): 
    7180    r""" 
  • 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.