Changeset fcd5e83 in sasmodels


Ignore:
Timestamp:
Feb 8, 2016 9:49:08 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:
43cb3b8
Parents:
a9d4d1f
Message:

Added unit tests to line model

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/line.py

    r0cb1c7a rfcd5e83  
    2020 
    2121""" 
    22  
    23 from numpy import vectorize 
    2422from numpy import inf 
    2523 
     
    4038              ["slope",     "Ang*cm^-1",    1.0, [-inf, inf], "", "slope in linear model"], 
    4139              ] 
     40# pylint: enable=bad-whitespace, line-too-long 
    4241 
    4342def Iq(q, intercept, slope): 
     
    4847    :return:            Calculated Intensity 
    4948    """ 
    50  
    5149    inten = intercept + slope*q 
    5250    return inten 
     
    6361    #TODO: Instrcution tels 2D has different deffinition than oher models 
    6462    #return Iq(sqrt(qx ** 2 + qy ** 2), *args) 
    65     return  Iq(qx,*args)*Iq(qy,*args) 
     63    return  Iq(qx, *args)*Iq(qy, *args) 
    6664 
    6765Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values 
    6866 
    69 demo = dict(scale=1, background=0.1, 
    70             intercept=1.0, slope=1.0) 
     67demo = dict(intercept=1.0, slope=1.0) 
    7168 
    7269oldname = "LineModel" 
    73 oldpars = dict(intercept='A', slope='B', scale=None) 
     70oldpars = dict(intercept='A', slope='B', scale=None, background=None) 
     71 
     72tests = [ 
     73    # Accuracy tests based on content in test/utest_other_models.py 
     74    [{'intercept':   1.0, 
     75      'slope': 1.0, 
     76     }, 0.4, 0.4], 
     77 
     78    [{'intercept':   1.0, 
     79      'slope': 1.0, 
     80     }, 1.3, 1.3], 
     81 
     82    [{'intercept':   1.0, 
     83      'slope': 1.0, 
     84     },0.5, 0.5], 
     85 
     86    [{'intercept':   1.0, 
     87      'slope': 1.0, 
     88     }, 1.57, 1.57], 
     89] 
Note: See TracChangeset for help on using the changeset viewer.