Changeset 3eb3312 in sasmodels


Ignore:
Timestamp:
Feb 15, 2016 7:49:22 AM (9 years ago)
Author:
wojciech
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:
bdb3313
Parents:
34d6cab
Message:

Vectorized version of two power law model

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extra/pylint.rc

    ra36c6d3 r3eb3312  
    2121# List of plugins (as comma separated values of python modules names) to load, 
    2222# usually to register additional checkers. 
    23 #load-plugins=pylint_numpy,pylint_pyopencl 
     23load-plugins=pylint_numpy,pylint_pyopencl 
    2424 
    2525# Use multiple processes to speed up Pylint. 
  • sasmodels/models/line.py

    r34d6cab r3eb3312  
    6565    """ 
    6666    #TODO: Instrcution tels 2D has different deffinition than oher models 
    67     #Iq(qx*cos(qy), *args)*Iq(qy, *args 
     67    #return  Iq(qy,*args)*Iq(qy,*args) 
    6868    return  Iq(qx*cos(qy), *args)*Iq(qx*sin(qy), *args) 
    6969 
     
    9595    [{'intercept':   1.0, 
    9696      'slope': 1.0, 
    97      }, [1.3, 1.57], [2.3, 2.57]], 
     97     }, (1.3, 1.57),2.30238060425], 
    9898] 
  • sasmodels/models/two_power_law.py

    r34d6cab r3eb3312  
    5151from numpy import sqrt 
    5252from numpy import inf 
     53from numpy import concatenate 
    5354 
    5455name = "two_power_law" 
     
    9394# pylint: disable=bad-whitespace 
    9495 
    95     if q<=crossover: 
    96         intensity = coefficent_1*power(q,-1.0*power_1) 
    97     else: 
    98         coefficent_2 = coefficent_1*power(crossover,-1.0*power_1)/power(crossover,-1.0*power_2) 
    99         intensity = coefficent_2*power(q,-1.0*power_2) 
     96    #Two sub vectors are created to treat crossover values 
     97    q_lower = q[q<=crossover] 
     98    q_upper = q[q>crossover] 
     99    coefficent_2 = coefficent_1*power(crossover,-1.0*power_1)/power(crossover,-1.0*power_2) 
     100    intensity_lower = coefficent_1*power(q_lower,-1.0*power_1) 
     101    intensity_upper = coefficent_2*power(q_upper,-1.0*power_2) 
     102    intensity = concatenate( ( intensity_lower,intensity_upper ), axis=0) 
    100103 
    101104    return intensity 
    102105 
    103 Iq.vectorized = False  # Iq accepts an array of q values 
     106Iq.vectorized = True  # Iq accepts an array of q values 
    104107 
    105108def Iqxy(qx, qy, *args): 
     
    113116    return Iq(sqrt(qx**2 + qy**2), *args) 
    114117 
    115 Iqxy.vectorized = False  # Iqxy accepts an array of qx, qy values 
     118Iqxy.vectorized = True  # Iqxy doesn't accept an array of qx, qy values 
    116119 
    117120demo = dict(scale=1, background=0.1, 
     
    151154      'background': 0.0, 
    152155    }, 0.442528, 0.00166884], 
     156 
     157    [{'coeffcent_1':    1.0, 
     158      'crossover':  0.04, 
     159      'power_1':    1.0, 
     160      'power_2':    4.0, 
     161      'background': 0.0, 
     162    }, (0.442528, 0.00166884), 0.00166884], 
     163 
    153164] 
  • setup.py

    r040575f r3eb3312  
    1111    version = "1.0.0a", 
    1212    description = "sasmodels package", 
    13     long_description=open('README.rst').read(), 
     13    long_description=open('README.md').read(), 
    1414    author = "SasView Collaboration", 
    1515    author_email = "management@sasview.org", 
Note: See TracChangeset for help on using the changeset viewer.