Skip to content

Commit 63f2689

Browse files
authored
Merge pull request #164 from EasyScience/163-resolution-function-to-class
163 resolution function to class
2 parents 257db3e + d06ba7a commit 63f2689

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+812
-162
lines changed

docs/src/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
'sphinx.ext.imgmath',
5353
'sphinx.ext.mathjax',
5454
'sphinx_autodoc_typehints',
55+
'sphinx_copybutton',
5556
'nbsphinx',
5657
'myst_parser'
5758
]

docs/src/tutorials/repeating.ipynb renamed to docs/src/tutorials/fitting/repeating.ipynb

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
"source": [
88
"# A multilayer fitting model\n",
99
"\n",
10-
"One of the main tools in `easyreflectometry` is the [assemblies library](../sample/assemblies_library.rst). \n",
10+
"One of the main tools in `easyreflectometry` is the [assemblies library](../../sample/assemblies_library.rst). \n",
1111
"This allows the user to define their model, using specific parameters for their system of interest (if it is included in the assemblies library). \n",
1212
"These assemblies will impose necessary constraints and computational efficiencies based on the assembly that is used. \n",
1313
"\n",
14-
"In this tutorial, we will look at one of these assemblies, that of a `RepeatingMultilayer` ([documented here](../sample/assemblies_library.rst#repeatingmultilayer)). \n",
14+
"In this tutorial, we will look at one of these assemblies, that of a `RepeatingMultilayer` ([documented here](../../sample/assemblies_library.rst#repeatingmultilayer)). \n",
1515
"This tutorial is based on an example from the [BornAgain](https://www.bornagainproject.org) documentation looking at [specular reflectivity analysis](https://www.bornagainproject.org/m/py/fitting/extended/fit-specular-data/). \n",
1616
"Before performing analysis, we should import the packages that we need."
1717
]
@@ -43,7 +43,7 @@
4343
"from easyreflectometry.sample import Material\n",
4444
"from easyreflectometry.sample import RepeatingMultilayer\n",
4545
"from easyreflectometry.experiment import Model\n",
46-
"from easyreflectometry.experiment import percentage_fhwm_resolution_function\n",
46+
"from easyreflectometry.experiment import PercentageFhwm\n",
4747
"from easyreflectometry.calculators import CalculatorFactory\n",
4848
"from easyreflectometry.fitting import Fitter\n",
4949
"from easyreflectometry.plot import plot"
@@ -77,7 +77,8 @@
7777
"source": [
7878
"## Reading in experimental data\n",
7979
"\n",
80-
"The data that we will investigate in this tutorial was generated with [GenX](https://aglavic.github.io/genx/) and is stored in an `.ort` [format file](https://github.com/reflectivity/file_format/blob/master/specification.md). "
80+
"The data that we will investigate in this tutorial was generated with [GenX](https://aglavic.github.io/genx/) and is stored in an `.ort` [format file](https://github.com/reflectivity/file_format/blob/master/specification.md).\n",
81+
"Use link to [download](repeating_layers.ort) the ort data."
8182
]
8283
},
8384
{
@@ -87,7 +88,7 @@
8788
"metadata": {},
8889
"outputs": [],
8990
"source": [
90-
"data = load('_static/repeating_layers.ort')\n",
91+
"data = load('repeating_layers.ort')\n",
9192
"data"
9293
]
9394
},
@@ -121,7 +122,7 @@
121122
"We show the model that will be used graphically below. \n",
122123
"\n",
123124
"<center>\n",
124-
" <img src='_static/repeating.png' alt='A slab model description of the repeating multilayer system.' width='300px'></img>\n",
125+
" <img src='repeating.png' alt='A slab model description of the repeating multilayer system.' width='300px'></img>\n",
125126
"</center>\n",
126127
"<center>\n",
127128
" A slab model description of the repeating multilayer, showing the four layers of vacuum, titanium, nickel and silicon, with the titanium/nickel layers being repeated 10 times.\n",
@@ -161,7 +162,7 @@
161162
"id": "f63ec440-089f-46cf-8ff5-be5012ad8dc8",
162163
"metadata": {},
163164
"source": [
164-
"Then, to produce the repeating multilayer, we use the `RepeatingMultilayer` [assembly type](../sample/assemblies_library.rst#RepeatingMultilayer). \n",
165+
"Then, to produce the repeating multilayer, we use the `RepeatingMultilayer` [assembly type](../../sample/assemblies_library.rst#RepeatingMultilayer). \n",
165166
"This can be constructed in a range of different ways, however here we pass a list of `Layer` type objects and a number of repetitions. "
166167
]
167168
},
@@ -191,7 +192,7 @@
191192
"metadata": {},
192193
"outputs": [],
193194
"source": [
194-
"resolution_function = percentage_fhwm_resolution_function(0)\n",
195+
"resolution_function = PercentageFhwm(0)\n",
195196
"sample = Sample(superphase, rep_multilayer, subphase, name='Multilayer Structure')\n",
196197
"model = Model(\n",
197198
" sample=sample,\n",

docs/src/tutorials/simple_fitting.ipynb renamed to docs/src/tutorials/fitting/simple_fitting.ipynb

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"from easyreflectometry.sample import Material\n",
3838
"from easyreflectometry.sample import Multilayer\n",
3939
"from easyreflectometry.experiment import Model\n",
40-
"from easyreflectometry.experiment import percentage_fhwm_resolution_function\n",
40+
"from easyreflectometry.experiment import PercentageFhwm\n",
4141
"from easyreflectometry.calculators import CalculatorFactory\n",
4242
"from easyreflectometry.fitting import Fitter\n",
4343
"from easyreflectometry.plot import plot"
@@ -69,8 +69,9 @@
6969
"source": [
7070
"## Reading in experimental data\n",
7171
"\n",
72-
"`easyreflectometry` has support for the `.ort` file format, a [standard file format for reduced reflectivity data developed by the Open Reflectometry Standards Organisation](https://www.reflectometry.org/working_groups/file_formats/). \n",
73-
"To load in a dataset, we use the `load` function. "
72+
"`easyreflectometry` has support for the `.ort` file format, a [standard file format for reduced reflectivity data developed by the Open Reflectometry Standards Organisation](https://www.reflectometry.org/working_groups/file_formats/).\n",
73+
"To load in a dataset, we use the `load` function.\n",
74+
"Use link to [download](example.ort) the ort data."
7475
]
7576
},
7677
{
@@ -80,7 +81,7 @@
8081
"metadata": {},
8182
"outputs": [],
8283
"source": [
83-
"data = load('_static/example.ort')"
84+
"data = load('example.ort')"
8485
]
8586
},
8687
{
@@ -136,7 +137,7 @@
136137
"This is shown pictorially below, as a slab model. \n",
137138
"\n",
138139
"<center>\n",
139-
" <img src='_static/polymer_film.png' alt='A slab model description of the polymer film system.' width='300px'></img>\n",
140+
" <img src='polymer_film.png' alt='A slab model description of the polymer film system.' width='300px'></img>\n",
140141
"</center>\n",
141142
"<center>\n",
142143
" A slab model description of the polymer film system (note that the layers are <b>not</b> to scale), showing the four layers of silicon, silicon dioxide, the polymer film and the heavy water subphase.\n",
@@ -221,7 +222,7 @@
221222
"id": "7247fc52-6874-47eb-a234-c7bb7db229fd",
222223
"metadata": {},
223224
"source": [
224-
"Given that the silicon and silicon dioxide layer both compose the solid subphase, it can be helpful to combine these as a `Multilayer` [assembly type](../sample/assemblies_library.rst#multilayer) in our code. "
225+
"Given that the silicon and silicon dioxide layer both compose the solid subphase, it can be helpful to combine these as a `Multilayer` [assembly type](../../sample/assemblies_library.rst#multilayer) in our code. "
225226
]
226227
},
227228
{
@@ -239,7 +240,7 @@
239240
"id": "a3a2df9b-8ddb-4b3e-a5c3-55b72280b651",
240241
"metadata": {},
241242
"source": [
242-
"These objects are then combined as a `Sample`, where the constructor takes a series of layers (or some more complex `easyreflectometry` [assemblies](../sample/assemblies_library.rst)) and, optionally, some name for the sample."
243+
"These objects are then combined as a `Sample`, where the constructor takes a series of layers (or some more complex `easyreflectometry` [assemblies](../../sample/assemblies_library.rst)) and, optionally, some name for the sample."
243244
]
244245
},
245246
{
@@ -297,7 +298,7 @@
297298
"metadata": {},
298299
"outputs": [],
299300
"source": [
300-
"resolution_function = percentage_fhwm_resolution_function(0.02)\n",
301+
"resolution_function = PercentageFhwm(0.02)\n",
301302
"model = Model(\n",
302303
" sample=sample,\n",
303304
" scale=1,\n",

0 commit comments

Comments
 (0)