# Changeset 31fc4ad in sasmodels

Ignore:
Timestamp:
Oct 22, 2018 10:54:14 AM (3 weeks ago)
Branches:
beta_approx, py3, ticket-1015-gpu-mem-error, ticket-1157, ticket-608-user-defined-weights, ticket_1156
Children:
07646b6
Parents:
be43e39
Message:

and notes about shell_volume and Fq to the user guide

File:
1 edited

Unmodified
Added
Removed
• ## doc/guide/plugin.rst

 r2015f02 **Note: The order of the parameters in the definition will be the order of the parameters in the user interface and the order of the parameters in Iq(), Iqac(), Iqabc() and form_volume(). And** *scale* **and** *background* **parameters are implicit to all models, so they do not need to be included in the parameter table.** parameters in the user interface and the order of the parameters in Fq(), Iq(), Iqac(), Iqabc(), form_volume() and shell_volume(). And** *scale* **and** *background* **parameters are implicit to all models, so they do not need to be included in the parameter table.** - **"name"** is the name of the parameter shown on the FitPage. scattered intensity. - "volume" parameters are passed to Iq(), Iqac(), Iqabc() and form_volume(), and have polydispersity loops generated automatically. - "volume" parameters are passed to Fq(), Iq(), Iqac(), Iqabc(), form_volume() and shell_volume(), and have polydispersity loops generated automatically. - "orientation" parameters are not passed, but instead are combined with def random(): ... This function provides a model-specific random parameter set which shows model features in the USANS to SANS range.  For example, core-shell sphere sets the outer radius of the sphere logarithmically in [20, 20,000], which sets the Q value for the transition from flat to falling.  It then uses a beta distribution to set the percentage of the shape which is shell, giving a preference for very thin or very thick shells (but never 0% or 100%).  Using -sets=10 in sascomp should show a reasonable variety of curves over the default sascomp q range. The parameter set is returned as a dictionary of {parameter: value, ...}. Any model parameters not included in the dictionary will default according to This function provides a model-specific random parameter set which shows model features in the USANS to SANS range.  For example, core-shell sphere sets the outer radius of the sphere logarithmically in [20, 20,000], which sets the Q value for the transition from flat to falling.  It then uses a beta distribution to set the percentage of the shape which is shell, giving a preference for very thin or very thick shells (but never 0% or 100%).  Using -sets=10 in sascomp should show a reasonable variety of curves over the default sascomp q range. The parameter set is returned as a dictionary of {parameter: value, ...}. Any model parameters not included in the dictionary will default according to the code in the _randomize_one() function from sasmodels/compare.py. used. Hollow shapes, where the volume fraction of particle corresponds to the material in the shell rather than the volume enclosed by the shape, must also define a *shell_volume(par1, par2, ...)* function.  The parameters are the same as for *form_volume*.  The *I(q)* calculation should use *shell_volume* squared as its scale factor for the volume normalization. The structure factor calculation needs *form_volume* in order to properly scale the volume fraction parameter, so both functions are required for hollow shapes. Note: Pure python models do not yet support direct computation of the average of $F(q)$ and $F^2(q)$. Embedded C Models ................. This expands into the equivalent C code:: #include double Iq(double q, double par1, double par2, ...); double Iq(double q, double par1, double par2, ...) *form_volume* defines the volume of the shape. As in python models, it includes only the volume parameters. *form_volume* defines the volume of the shell for hollow shapes. As in python models, it includes only the volume parameters. **source=['fn.c', ...]** includes the listed C source files in the The INVALID define can go into *Iq*, or *c_code*, or an external C file listed in *source*. Structure Factors ................. Structure factor calculations may need the underlying $$and$$ rather than $I(q)$.  This is used to compute $\beta = ^2/$ in the decoupling approximation to the structure factor. Instead of defining the *Iq* function, models can define *Fq* as something like:: double Fq(double q, double *F1, double *F2, double par1, double par2, ...); double Fq(double q, double *F1, double *F2, double par1, double par2, ...) { // Polar integration loop over all orientations. ... *F1 = 1e-2 * total_F1 * contrast * volume; *F2 = 1e-4 * total_F2 * square(contrast * volume); return I(q, par1, par2, ...); } If the volume fraction scale factor is built into the model (as occurs for the vesicle model, for example), then scale *F1* by $\surd V_f$ so that $\beta$ is computed correctly. Structure factor calculations are not yet supported for oriented shapes. Note: only available as a separate C file listed in *source*, or within a *c_code* block within the python model definition file. Oriented Shapes
Note: See TracChangeset for help on using the changeset viewer.