- Timestamp:
- Oct 22, 2018 10:54:14 AM (6 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 07646b6
- Parents:
- be43e39
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/guide/plugin.rst
r2015f02 r31fc4ad 291 291 292 292 **Note: The order of the parameters in the definition will be the order of the 293 parameters in the user interface and the order of the parameters in Iq(),294 Iqac(), Iqabc() and form_volume(). And** *scale* **and** *background*295 **parameters are implicit to all models, so they do not need to be included 296 in the parameter table.**293 parameters in the user interface and the order of the parameters in Fq(), Iq(), 294 Iqac(), Iqabc(), form_volume() and shell_volume(). 295 And** *scale* **and** *background* **parameters are implicit to all models, 296 so they do not need to be included in the parameter table.** 297 297 298 298 - **"name"** is the name of the parameter shown on the FitPage. … … 363 363 scattered intensity. 364 364 365 - "volume" parameters are passed to Iq(), Iqac(), Iqabc() and form_volume(),366 and have polydispersity loops generated automatically.365 - "volume" parameters are passed to Fq(), Iq(), Iqac(), Iqabc(), form_volume() 366 and shell_volume(), and have polydispersity loops generated automatically. 367 367 368 368 - "orientation" parameters are not passed, but instead are combined with … … 428 428 def random(): 429 429 ... 430 431 This function provides a model-specific random parameter set which shows model 432 features in the USANS to SANS range. For example, core-shell sphere sets the 433 outer radius of the sphere logarithmically in `[20, 20,000]`, which sets the Q 434 value for the transition from flat to falling. It then uses a beta distribution 435 to set the percentage of the shape which is shell, giving a preference for very 436 thin or very thick shells (but never 0% or 100%). Using `-sets=10` in sascomp 437 should show a reasonable variety of curves over the default sascomp q range. 438 The parameter set is returned as a dictionary of `{parameter: value, ...}`. 439 Any model parameters not included in the dictionary will default according to 430 431 This function provides a model-specific random parameter set which shows model 432 features in the USANS to SANS range. For example, core-shell sphere sets the 433 outer radius of the sphere logarithmically in `[20, 20,000]`, which sets the Q 434 value for the transition from flat to falling. It then uses a beta distribution 435 to set the percentage of the shape which is shell, giving a preference for very 436 thin or very thick shells (but never 0% or 100%). Using `-sets=10` in sascomp 437 should show a reasonable variety of curves over the default sascomp q range. 438 The parameter set is returned as a dictionary of `{parameter: value, ...}`. 439 Any model parameters not included in the dictionary will default according to 440 440 the code in the `_randomize_one()` function from sasmodels/compare.py. 441 441 … … 492 492 used. 493 493 494 Hollow shapes, where the volume fraction of particle corresponds to the 495 material in the shell rather than the volume enclosed by the shape, must 496 also define a *shell_volume(par1, par2, ...)* function. The parameters 497 are the same as for *form_volume*. The *I(q)* calculation should use 498 *shell_volume* squared as its scale factor for the volume normalization. 499 The structure factor calculation needs *form_volume* in order to properly 500 scale the volume fraction parameter, so both functions are required for 501 hollow shapes. 502 503 Note: Pure python models do not yet support direct computation of the 504 average of $F(q)$ and $F^2(q)$. 505 494 506 Embedded C Models 495 507 ................. … … 503 515 This expands into the equivalent C code:: 504 516 505 #include <math.h>506 517 double Iq(double q, double par1, double par2, ...); 507 518 double Iq(double q, double par1, double par2, ...) … … 512 523 *form_volume* defines the volume of the shape. As in python models, it 513 524 includes only the volume parameters. 525 526 *form_volume* defines the volume of the shell for hollow shapes. As in 527 python models, it includes only the volume parameters. 514 528 515 529 **source=['fn.c', ...]** includes the listed C source files in the … … 548 562 The INVALID define can go into *Iq*, or *c_code*, or an external C file 549 563 listed in *source*. 564 565 Structure Factors 566 ................. 567 568 Structure factor calculations may need the underlying $<F(q)>$ and $<F^2(q)>$ 569 rather than $I(q)$. This is used to compute $\beta = <F(q)>^2/<F^2(q)>$ in 570 the decoupling approximation to the structure factor. 571 572 Instead of defining the *Iq* function, models can define *Fq* as 573 something like:: 574 575 double Fq(double q, double *F1, double *F2, double par1, double par2, ...); 576 double Fq(double q, double *F1, double *F2, double par1, double par2, ...) 577 { 578 // Polar integration loop over all orientations. 579 ... 580 *F1 = 1e-2 * total_F1 * contrast * volume; 581 *F2 = 1e-4 * total_F2 * square(contrast * volume); 582 return I(q, par1, par2, ...); 583 } 584 585 If the volume fraction scale factor is built into the model (as occurs for 586 the vesicle model, for example), then scale *F1* by $\surd V_f$ so that 587 $\beta$ is computed correctly. 588 589 Structure factor calculations are not yet supported for oriented shapes. 590 591 Note: only available as a separate C file listed in *source*, or within 592 a *c_code* block within the python model definition file. 550 593 551 594 Oriented Shapes
Note: See TracChangeset
for help on using the changeset viewer.