Changes in / [6e7ff6d:3543141] in sasmodels


Ignore:
Location:
sasmodels/models
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/broad_peak.py

    rec45c4f r65279d8  
    101101    """ 
    102102    return Iq(sqrt(qx ** 2 + qy ** 2), *args) 
    103  
    104103Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values 
    105104 
  • sasmodels/models/poly_gauss_coil.py

    rec45c4f r65279d8  
    5050""" 
    5151 
    52 from numpy import inf, sqrt, exp, power 
     52import numpy as np 
     53from numpy import inf, exp, power, sqrt 
    5354 
    5455name =  "poly_gauss_coil" 
     
    7071    # pylint: disable = missing-docstring 
    7172    u = polydispersity - 1.0 
    72     z = ((q * radius_gyration) * (q * radius_gyration)) / (1.0 + 2.0 * u) 
    73     if (q == 0).any(): 
    74         inten = i_zero 
     73    z = (q*radius_gyration)**2 / (1.0 + 2.0*u) 
     74    # need to trap the case of the polydispersity being 1 (ie, monodispersity!) 
     75    if polydispersity == 1.0: 
     76        inten = i_zero * 2.0 * (exp(-z) + z - 1.0) 
    7577    else: 
    76     # need to trap the case of the polydispersity being 1 (ie, monodispersity!) 
    77         if polydispersity == 1: 
    78             inten = i_zero * 2.0 * (exp(-z) + z - 1.0 ) / (z * z) 
    79         else: 
    80             minusoneonu = -1.0 / u 
    81             inten = i_zero * 2.0 * (power((1.0 + u * z),minusoneonu) + z - 1.0 ) / ((1.0 + u) * (z * z)) 
     78        inten = i_zero * 2.0 * (power(1.0 + u*z, -1.0/u) + z - 1.0) / (1.0 + u) 
     79    index = q != 0. 
     80    inten[~index] = i_zero 
     81    inten[index] /= z[index]**2 
    8282    return inten 
    83 #Iq.vectorized =  True  # Iq accepts an array of q values 
     83Iq.vectorized =  True  # Iq accepts an array of q values 
    8484 
    8585def Iqxy(qx, qy, *args): 
    8686    # pylint: disable = missing-docstring 
    8787    return Iq(sqrt(qx ** 2 + qy ** 2), *args) 
    88 #Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values 
     88Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values 
    8989 
    9090demo =  dict(scale = 1.0, 
Note: See TracChangeset for help on using the changeset viewer.