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 | }}} |
44 | 48 | - 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. |
45 | 49 | - 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). |
46 | 50 | - For certain models, namely core shell type models, the VR attribute returns the volume ratio for the core-shell. |
47 | 51 | - 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. |
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 | }}} |