Changeset 251b40b in sasmodels


Ignore:
Timestamp:
Mar 18, 2016 5:30:51 AM (8 years ago)
Author:
krzywon
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
76d78c2
Parents:
5bb9c79
Message:

Fixed sesans.py to at least build for now. It is still a WIP

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/sesans.py

    r02e70ff r251b40b  
    6363                   
    6464def Cosine2D(data, q_calc, Iq_calc, qx, qy, Iq_mono): 
    65     return hankel(data.x, data.y data.lam * 1e-9, 
     65    return hankel(data.x, data.y, data.lam * 1e-9, 
    6666                  data.sample.thickness / 10, 
    6767                  q_calc, Iq_calc) 
     
    7070#    Calls a model with existing model parameters already in place, then integrate the product of q and I(q) from 0 to (4*pi/lambda) 
    7171    allq = np.linspace(0,4*pi/wavelength,1000) 
    72     allIq =  
     72    allIq = 1 
    7373    integral = allq*allIq 
    7474     
     
    8686    Gprime = np.zeros_like(wavelength, 'd') 
    8787    f = np.zeros_like(wavelength, 'd') 
    88        for i, wavelength_i in enumerate(wavelength): 
    89             z = magfield*wavelength_i 
    90             allq=np.linspace() #for calculating the Q-range of the  scattering power integral 
    91             allIq=np.linspace()  # This is the model applied to the allq q-space. Needs to refference the model somehow 
    92             alldq = (allq[1]-allq[0])*1e10 
    93             sigma[i]=wavelength[i]^2*thickness/2/pi*np.sum(allIq*allq*alldq) 
    94             s[i]=1-exp(-sigma) 
    95             for j, Iqy_j, qy_j in enumerate(qy): 
    96                 for k, Iqz_k, qz_k in enumerate(qz): 
    97                     Iq = np.sqrt(Iqy_j^2+Iqz_k^2) 
    98                     q = np.sqrt(qy_j^2 + qz_k^2) 
    99                     Gintegral = Iq*cos(z*Qz_k) 
    100                     Gprime[i] += Gintegral 
    101     #                sigma = wavelength^2*thickness/2/pi* allq[i]*allIq[i] 
    102     #                s[i] += 1-exp(Totalscatter(modelname)*thickness) 
    103     #                For now, work with standard 2-phase scatter 
    104                     
    105                      
    106                     sd[i] += Iq 
    107             f[i] = 1-s[i]+sd[i] 
    108             P[i] = (1-sd[i]/f[i])+1/f[i]*Gprime[i]         
     88    for i, wavelength_i in enumerate(wavelength): 
     89        z = magfield*wavelength_i 
     90        allq=np.linspace() #for calculating the Q-range of the  scattering power integral 
     91        allIq=np.linspace()  # This is the model applied to the allq q-space. Needs to refference the model somehow 
     92        alldq = (allq[1]-allq[0])*1e10 
     93        sigma[i]=wavelength[i]^2*thickness/2/pi*np.sum(allIq*allq*alldq) 
     94        s[i]=1-exp(-sigma) 
     95        for j, Iqy_j, qy_j in enumerate(qy): 
     96            for k, Iqz_k, qz_k in enumerate(qz): 
     97                Iq = np.sqrt(Iqy_j^2+Iqz_k^2) 
     98                q = np.sqrt(qy_j^2 + qz_k^2) 
     99                Gintegral = Iq*cos(z*Qz_k) 
     100                Gprime[i] += Gintegral 
     101#                sigma = wavelength^2*thickness/2/pi* allq[i]*allIq[i] 
     102#                s[i] += 1-exp(Totalscatter(modelname)*thickness) 
     103#                For now, work with standard 2-phase scatter 
     104 
     105 
     106                sd[i] += Iq 
     107        f[i] = 1-s[i]+sd[i] 
     108        P[i] = (1-sd[i]/f[i])+1/f[i]*Gprime[i] 
    109109 
    110110 
     
    119119    G = np.zeros_like(SElength, 'd') 
    120120    threshold=2*pi*theta/wavelength 
    121         for i, SElength_i in enumerate(SElength): 
    122             allq=np.linspace() #for calculating the Q-range of the  scattering power integral 
    123             allIq=np.linspace()  # This is the model applied to the allq q-space. Needs to refference the model somehow 
    124             alldq = (allq[1]-allq[0])*1e10 
    125             sigma[i]=wavelength[i]^2*thickness/2/pi*np.sum(allIq*allq*alldq) 
    126             s[i]=1-exp(-sigma) 
    127              
    128             dq = (q[1]-q[0])*1e10 
    129             a = (x<threshold) 
    130             acceptq = a*q 
    131             acceptIq = a*Iq 
    132         
    133             G[i] = np.sum(besselj(0, acceptq*SElength_i)*acceptIq*acceptq*dq) 
    134                  
    135     #        G[i]=np.sum(integral) 
    136          
    137         G *= dq*1e10*2*pi 
    138      
    139         P = exp(thickness*wavelength**2/(4*pi**2)*(G-G[0])) 
     121    for i, SElength_i in enumerate(SElength): 
     122        allq=np.linspace() #for calculating the Q-range of the  scattering power integral 
     123        allIq=np.linspace()  # This is the model applied to the allq q-space. Needs to refference the model somehow 
     124        alldq = (allq[1]-allq[0])*1e10 
     125        sigma[i]=wavelength[i]^2*thickness/2/pi*np.sum(allIq*allq*alldq) 
     126        s[i]=1-exp(-sigma) 
     127 
     128        dq = (q[1]-q[0])*1e10 
     129        a = (x<threshold) 
     130        acceptq = a*q 
     131        acceptIq = a*Iq 
     132 
     133        G[i] = np.sum(besselj(0, acceptq*SElength_i)*acceptIq*acceptq*dq) 
     134 
     135#        G[i]=np.sum(integral) 
     136 
     137    G *= dq*1e10*2*pi 
     138 
     139    P = exp(thickness*wavelength**2/(4*pi**2)*(G-G[0])) 
    140140     
    141141def hankel(SElength, wavelength, thickness, q, Iq): 
Note: See TracChangeset for help on using the changeset viewer.