1- Purpose
2- ----------
1+ ## Purpose
32
43These example scripts are intended to help a developer get acquainted with the
54SrFit programming interface. Although one can write scripts like these to drive
65optimization, these scripts do not represent the SrFit user interface. That
76interface will be made available in a future release.
87
9- A secondary purpose of these tutorials is to generate interest in SrFit. By
8+ A secondary purpose of these tutorials is to generate interest in SrFit. By
109reading through the examples we hope that you are inspired to think of exciting
1110new ways to get the most out of your scientific data. If you think SrFit can
1211help you with that, please feel free to contact us through the DiffPy website.
1312
1413http://www.diffpy.org
1514
16-
17- Overview
18- ----------
15+ ## Overview
1916
2017Three things are required for optimization: a function that generates a
2118quantity to be minimized, variables that can be used to manipulate that
2219function and an algorithm that can drive the function output to a smaller value
23- by steering the variables. For scientific purposes, the quantity to be
20+ by steering the variables. For scientific purposes, the quantity to be
2421minimized is the disagreement between a measured profile and a theoretical
2522profile. The scientific understanding of the system under consideration partly
2623determines the suitability of the theoretical profile generator and the
@@ -30,38 +27,36 @@ The purpose of SrFit is to give users the means to combine known information
3027about a system of interest in order to extract scientifically relevant
3128quantities, and thus understanding from it. Various experimental procedures and
3229theoretical calculations may be needed to gain the desired understanding of the
33- system. SrFit helps users combine these views of the system in a coherent and
30+ system. SrFit helps users combine these views of the system in a coherent and
3431consistent manner.
3532
3633To achieve this purpose, SrFit provides:
3734
38- 1) a function to be optimized (the residual) given one or more measured
35+ 1. a function to be optimized (the residual) given one or more measured
3936 profiles, one or more profile generators and variables to be steered by an
4037 optimizer.
41- 2) constraints and restraints that encapsulate known information about the
38+ 2. constraints and restraints that encapsulate known information about the
4239 system.
43- 3) a clearly defined programming interface that developers can use to add their
40+ 3. a clearly defined programming interface that developers can use to add their
4441 own profile generators, thereby enabling the combination of more views of a
4542 system.
46- 4) an equation building interface that allows users to tweak profile generators
43+ 4. an equation building interface that allows users to tweak profile generators
4744 when scientific understanding of a system is more advanced than the existing
4845 software.
4946
5047The examples described below will go into detail about each of these points.
5148
49+ ## Examples
5250
53- Examples
54- ----------
55-
56- The following examples are contained in the *doc/examples/* directory of the
57- SrFit source distribution. They can be downloaded from
51+ The following examples are contained in the _doc/examples/_ directory of the
52+ SrFit source distribution. They can be downloaded from
5853http://dev.danse.us/packages/srfit_examples-alpha9.zip
5954
6055For each example, start by running the example by typing in the command line ::
6156
6257 python example.py
6358
64- where *example.py* represents the example file. The output will show on screen
59+ where _example.py_ represents the example file. The output will show on screen
6560and a plot window will display. Once you've studied the output and plot, close
6661the plot window and open the example file. In the file there will be a
6762description of what the script is doing and the purpose of the example. By
@@ -73,97 +68,94 @@ them in the order listed below.
7368
7469Basic:
7570
76- * gaussianrecipe.py_
77- Introductory recipe building and configuration. This introduces the
78- fundamental classes in SrFit.
71+ - gaussianrecipe.py\_
72+ Introductory recipe building and configuration. This introduces the
73+ fundamental classes in SrFit.
7974
80- * debyemodel.py_
81- Introductory recipe building and configuration. This shows how to use a
82- function created by someone else in a refinement. This example also
83- introduces restraints.
75+ - debyemodel.py\_
76+ Introductory recipe building and configuration. This shows how to use a
77+ function created by someone else in a refinement. This example also
78+ introduces restraints.
8479
85- * debyemodelII.py_
86- Refine two different values of a variable from two different regions of a
87- profile. This example introduces constraints and working with multiple
88- contributions to a fit.
80+ - debyemodelII.py\_
81+ Refine two different values of a variable from two different regions of a
82+ profile. This example introduces constraints and working with multiple
83+ contributions to a fit.
8984
9085Advanced:
9186
92- * gaussiangenerator.py_
93- Create a custom ProfileGenerator and use it in a refinement. This is an
94- instructive extension to gaussianrecipe.py_.
95-
96- * npintensity.py_
97- Use diffpy.structure to build a nanoparticle intensity generator, and use
98- it to refine a structure to simulated data.
87+ - gaussiangenerator.py*
88+ Create a custom ProfileGenerator and use it in a refinement. This is an
89+ instructive extension to gaussianrecipe.py*.
9990
100- * npintensityII.py_
101- Use the calculator built in npintensity.py to simultaneously refine a
102- structure to two data sets .
91+ - npintensity.py\_
92+ Use diffpy.structure to build a nanoparticle intensity generator, and use
93+ it to refine a structure to simulated data.
10394
95+ - npintensityII.py\_
96+ Use the calculator built in npintensity.py to simultaneously refine a
97+ structure to two data sets.
10498
105- Use Cases
106- -----------
99+ ## Use Cases
107100
108101There are several examples that demonstrate various SrFit use cases. These do
109102not adopt the tutorial format of the previous examples. Regardless, developers
110103should read through these use cases to gain an understanding of PDF and SAS
111104refinement with SrFit.
112105
113- * crystalpdf.py_
114- Refine a diffpy.structure crystal to PDF data using automatic explicit
115- space group constraints.
106+ - crystalpdf.py\_
107+ Refine a diffpy.structure crystal to PDF data using automatic explicit
108+ space group constraints.
116109
117- * simplepdf.py_
118- As crystalpdf.py_ , but with a simplified interface.
110+ - simplepdf.py*
111+ As crystalpdf.py* , but with a simplified interface.
119112
120- * crystalpdfobjcryst.py_
121- Refine a pyobjcryst crystal to PDF data using automatic implicit space
122- group constraints.
113+ - crystalpdfobjcryst.py\_
114+ Refine a pyobjcryst crystal to PDF data using automatic implicit space
115+ group constraints.
123116
124- * crystalpdftwophase.py_
125- Refine a two-phase structure to PDF data using two profile generators.
117+ - crystalpdftwophase.py\_
118+ Refine a two-phase structure to PDF data using two profile generators.
126119
127- * simplepdftwophase.py_
128- crystalpdftwophase.py_ using the simplified PDFContribution interface.
120+ - simplepdftwophase.py*
121+ crystalpdftwophase.py* using the simplified PDFContribution interface.
129122
130- * crystalpdftwodata.py_
131- Refine a single structure to x-ray and neutron data simultaneously.
123+ - crystalpdftwodata.py\_
124+ Refine a single structure to x-ray and neutron data simultaneously.
132125
133- * crystalpdfall.py_
134- Refine a two-phase structure using four data sets.
126+ - crystalpdfall.py\_
127+ Refine a two-phase structure using four data sets.
135128
136- * nppdfobjcryst.py_
137- Refine the C60 structure to real data.
129+ - nppdfobjcryst.py\_
130+ Refine the C60 structure to real data.
138131
139- * nppdfcrystal.py_
140- Fit a nanoparticle PDF as a crystal PDF attenuated by a nanoparticle form
141- factor.
132+ - nppdfcrystal.py\_
133+ Fit a nanoparticle PDF as a crystal PDF attenuated by a nanoparticle form
134+ factor.
142135
143- * coreshellnp.py_
144- As above, but fit the PDF from core-shell nanoparticles.
136+ - coreshellnp.py\_
137+ As above, but fit the PDF from core-shell nanoparticles.
145138
146- * ellipsoidsas.py_
147- Refine an ellipsoid SAS model to ideal data.
139+ - ellipsoidsas.py\_
140+ Refine an ellipsoid SAS model to ideal data.
148141
149- * nppdfsas.py_
150- Refine PDF from nanoparticle of assumed shape using a crystal model and SAS
151- data from the same system.
142+ - nppdfsas.py\_
143+ Refine PDF from nanoparticle of assumed shape using a crystal model and SAS
144+ data from the same system.
152145
153- Miscellaneous
154- --------------
146+ ## Miscellaneous
155147
156148These demonstrate other SrFit features. These are in flux and may not be in
157149future versions.
158150
159- * simplerecipe.py_
160- This introduces the SimpleRecipe class that is a FitRecipe with an embedded
161- Profile and FitContribution. SimpleRecipe exposes methods from the Profile
162- and FitContribution, and adds other methods so it is easy to set up a
163- simple fit.
164-
165- * interface.py_
166- This example introduces some interface enhancements that allow the SrFit
167- recipes to be written with less code. This is not the same as a
168- full-featured scripting interface, but rather somewhere in between a
169- scripting interface and the API.
151+ - simplerecipe.py\_
152+ This introduces the SimpleRecipe class that is a FitRecipe with an embedded
153+ Profile and FitContribution. SimpleRecipe exposes methods from the Profile
154+ and FitContribution, and adds other methods so it is easy to set up a
155+ simple fit.
156+
157+ - interface.py\_
158+ This example introduces some interface enhancements that allow the SrFit
159+ recipes to be written with less code. This is not the same as a
160+ full-featured scripting interface, but rather somewhere in between a
161+ scripting interface and the API.
0 commit comments