Changes between Version 6 and Version 7 of ModelConvInst


Ignore:
Timestamp:
Nov 3, 2015 8:16:07 PM (9 years ago)
Author:
pkienzle
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • ModelConvInst

    v6 v7  
    3434 - exp = exponent (example: porod_exp) 
    3535 - peak_pos = q_peak or q0 etc 
    36  - lower and upper limits can be any number or -inf or inf 
     36 - lower and upper limits can be any number or -inf or inf (the limits will show up as the default limits for the fit, making it easy for example to force the radius to always be greater than zero) 
    3737 - type can take 3 values at this time: “”, “volume”, or “orientation” 
    3838- COMPUTATION 
     
    4141  - def Iqxy.  If this model does not have an oriented form just set it equal to the square root of the sum of Iq(x) squared and Iq(y) squared. 
    4242 - Python + C 
    43   - in place of the above methods point to the C source files needed.  There should be 3: two libraries and the model.c where model is the same name as given to the python model.py it should read source = ["lib/J1.c", "lib/gauss76.c", "my_model.c"] 
     43  - common functions should be moved into their own file, such as lib/J1.c for the bessel function J1. 
     44  - in place of the above methods point to the C source files needed. This will be a list of any lib files needed, followed by the model.c file, where model is the same name as given to the python model.py.  For example: 
     45  {{{#!python 
     46      source = ["lib/J1.c", "lib/gauss76.c", "my_model.c"] 
     47  }}} 
    4448  - the c file must contain the Iq and Iqxy methods.  These and any other functions defined (e.g. form_volume, radius, etc) must be defined as doubles in the first lines of the file. 
    4549- For certain models, such as those that can be multiplied by a structure factor, the ER attribute should be set to the Equivalent Radius (of a sphere). 
    4650- For certain models, namely core shell type models, the VR attribute returns the volume ratio for the core-shell. 
    4751- demo is a dictionary containing the value of each parameter as given in the rst documentation.  Make sure to enter the appropriate values from that documentation.  This will then be used to generate the example curve in said documentation. 
    48 - oldname is the name for this model used in !SasView.  Make sure to put the correct original name.  This is required for the transition to allow compatibility. 
     52- oldname is the name for this model used in !SasView.  Make sure to put the correct original name.  This is required for the transition to allow compatibility and to test that the models are equivalent. 
    4953- oldpars is the name of the parameters as used in !SasView.  For each parameter give the name of the parameter as used in the original !SasView code version of this model.  Again this is required for the transition. 
    5054- tests section (for unit test purposes) VERY IMPORTANT.  Syntax: test is a list of lists. each list is one test and contains, in order,  
    5155 - a dictionary of parameter values. This can be {} using the default parameters, or filled with some parameters that will be different from the default ({‘radius’:10.0, ‘sld’:4}) unlisted parameters will be given the default values. 
    52  - the q value or a tuple of qx, qy values 
    53  - the Iq or Iqxy expected of the model for the parameters and q value given.  There should be at least one test in the list.  Please make sure that the answer value is correct (i.e. not a random number please)  
     56 - the input q value or tuple of qx, qy values  
     57 - the output Iq or Iqxy expected of the model for the parameters and q value given 
     58 - inputs and outputs can also be lists if you have several values to test for the same model parameters 
     59 - for ER and VR, give the inputs as 'ER' and 'VR' respectively 
     60 - include at least one test for each model.  Please make sure that the answer value is correct (i.e. not a random number please) 
     61 - to summarize: 
     62{{{#!python 
     63    tests = [ 
     64        [ {parameters}, q, I(q)], 
     65        [ {parameters}, [q], [I(q)] ], 
     66        [ {parameters}, [q1, q2, ...], [I(q1), I(q2), ...]], 
     67        [ {parameters}, (qx, qy), I(qx, Iqy)], 
     68        [ {parameters}, [(qx1, qy1), (qx2, qy2), ...], 
     69                        [I(qx1,qy1), I(qx2,qy2), ...]], 
     70        [ {parameters}, 'ER', ER(pars) ], 
     71        [ {parameters}, 'VR', VR(pars) ], 
     72    ] 
     73}}}  
     74    where  
     75{{{#!python 
     76    parameters = {'k1': v1, 'k2': v2, ...} 
     77}}} 
    5478 
    5579'''TEST YOUR NEWLY CONVERTED MODEL'''