Changeset 2556095 in sasmodels


Ignore:
Timestamp:
Feb 18, 2016 4:54:20 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:
e66075f
Parents:
4a82d4d
Message:

Final touches for line model

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/line.py

    r2fb1d88 r2556095  
    11r""" 
    22This model calculates intensity using simple linear function 
     3 
    34Definition 
    45---------- 
     
    2425""" 
    2526from numpy import inf 
    26 from numpy import cos 
    27 from numpy import sin 
    2827 
    2928name = "line" 
     
    4039# pylint: disable=bad-whitespace, line-too-long 
    4140#             ["name", "units", default, [lower, upper], "type", "description"], 
    42 parameters = [["intercept",     "1/cm",        1.0, [-inf, inf], "", "intercept in linear model"], 
    43               ["slope",     "Ang/cm",    1.0, [-inf, inf], "", "slope in linear model"], 
    44               ] 
     41parameters = [["intercept", "1/cm",   1.0, [-inf, inf], "", "intercept in linear model"], 
     42              ["slope",     "Ang/cm", 1.0, [-inf, inf], "", "slope in linear model"], 
     43             ] 
    4544# pylint: enable=bad-whitespace, line-too-long 
    4645 
     
    5352    """ 
    5453    inten = intercept + slope*q 
     54    # TODO: In SasView code additional formula for list has been specifded. 
     55    # if inten(x) = intercept + slope*x: 
     56    # then if q is a list, Iq=inten(x[0]*math.cos(x[1]))*inten(x[0]*math.sin(x[1])) 
    5557    return inten 
    5658 
     
    6466    :return:     2D-Intensity 
    6567    """ 
    66     #TODO: Instrcution tels 2D has different deffinition than oher models 
    67     #return  Iq(qy,*args)*Iq(qy,*args) 
    68     return  Iq(qx, *args)*Iq(qy, *args) 
     68    # TODO: SasView documention lists 2D intensity as Iq(qx)*Iq(qy) but in code is: 
     69    # return self._line(x[1]) 
     70    return Iq(qx, *args)*Iq(qy, *args) 
    6971 
    70 Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values 
     72Iqxy.vectorized = True  # Iqxy accepts an array of qx, qy values 
    7173 
    7274demo = dict(scale=1.0, background=0, intercept=1.0, slope=1.0) 
     
    7678 
    7779tests = [ 
     80 
     81    [{'intercept':   1.0, 
     82      'slope': 1.0, 
     83     }, 1.0, 2.0], 
     84 
     85    [{'intercept':   1.0, 
     86      'slope': 1.0, 
     87     }, 0.0, 1.0], 
    7888 
    7989    [{'intercept':   1.0, 
     
    95105    [{'intercept':   1.0, 
    96106      'slope': 1.0, 
    97      }, (1.3, 1.57), 2.30238060425], 
     107     }, (1.3, 1.57), 5.911], 
    98108] 
Note: See TracChangeset for help on using the changeset viewer.