Skip to content

Commit 81542a7

Browse files
authored
Merge pull request #178 from EasyScience/develop
Version 1.10.0
2 parents 2ae5fdc + 2d02276 commit 81542a7

Some content is hidden

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

63 files changed

+1951
-1231
lines changed

docs/src/dictionay.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Dictionary
2+
==========
3+
The following serves to clarify what we mean by the terms we use in this project.
4+
5+
Sample
6+
------
7+
A sample is an ideal representation of a the full physical setup.
8+
This includes the layer(s) under investigation, the surrounding superphase, and the subphase.
9+
10+
Calculator
11+
----------
12+
A calculator is the physics engine which calculates the reflectivity curve from our inputted sample parameters.
13+
We rely on third party software to provide the necessary calculators.
14+
Different calculators might have different capabilities and limitations.
15+
16+
Model
17+
-----
18+
A model combines a sample and calculator.
19+
The model is also responsible for including instrumental effects such as background, scale, and resolution.
20+

docs/src/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
calculators
1212
experiment/experiment
1313
tutorials/tutorials
14+
dictionary
1415
contributing
1516
authors
1617
api/api

docs/src/sample/material_library.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The construction of a :py:class:`Material` is achieved as shown below.
2222
name='Boron'
2323
)
2424
25-
The above object will have the properties of :py:attr:`sld` and :py:attr:`isld`, which will have values of :code:`6.908 1 / angstrom ** 2` and :code:`-0.278 1 / angstrom ** 2` respectively.
25+
The above object will have the properties of :py:attr:`sld` and :py:attr:`isld`, which will have values of :code:`6.908 1/angstrom^2` and :code:`-0.278 1/angstrom^2` respectively.
2626
As is shown in the `tutorials`_, a material can be used to construct a :py:class:`Layer` from which `slab models`_ are created.
2727

2828
:py:class:`MaterialDensity`
@@ -78,7 +78,7 @@ So to produce a :py:class:`MaterialSolvated` that is 20 % D2O in a polymer, the
7878
name='Solvated Polymer'
7979
)
8080
81-
For the :py:attr:`solvated_polymer` object, the :py:attr:`sld` will be :code:`2.872 1 / angstrom ** 2` (the weighted average of the two scattering length densities).
81+
For the :py:attr:`solvated_polymer` object, the :py:attr:`sld` will be :code:`2.872 1/angstrom^2` (the weighted average of the two scattering length densities).
8282
The :py:class:`MaterialSolvated` includes a constraint such that if the value of either constituent scattering length densities (both real and imaginary components) or the fraction changes, then the resulting material :py:attr:`sld` and :py:attr:`isld` will change appropriately.
8383

8484
.. _`assemblies`: ./assemblies_library.html

docs/src/tutorials/fitting/repeating.ipynb

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@
3535
"\n",
3636
"import numpy as np\n",
3737
"import scipp as sc\n",
38-
"import easyreflectometry\n",
38+
"import pooch\n",
3939
"import refl1d\n",
40+
"\n",
41+
"import easyreflectometry\n",
42+
"\n",
4043
"from easyreflectometry.data import load\n",
4144
"from easyreflectometry.sample import Layer\n",
4245
"from easyreflectometry.sample import Sample\n",
@@ -46,7 +49,8 @@
4649
"from easyreflectometry.experiment import PercentageFhwm\n",
4750
"from easyreflectometry.calculators import CalculatorFactory\n",
4851
"from easyreflectometry.fitting import Fitter\n",
49-
"from easyreflectometry.plot import plot"
52+
"from easyreflectometry.plot import plot\n",
53+
"from easyscience.fitting import AvailableMinimizers"
5054
]
5155
},
5256
{
@@ -78,18 +82,22 @@
7882
"## Reading in experimental data\n",
7983
"\n",
8084
"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."
85+
"We use `pooch` to fetch the file from the repository."
8286
]
8387
},
8488
{
8589
"cell_type": "code",
8690
"execution_count": null,
87-
"id": "609174e5-1371-412d-a29f-cb05bfe36df0",
91+
"id": "7121c7e9",
8892
"metadata": {},
8993
"outputs": [],
9094
"source": [
91-
"data = load('repeating_layers.ort')\n",
92-
"data"
95+
"file_path = pooch.retrieve(\n",
96+
" # URL to one of Pooch's test files\n",
97+
" url=\"https://raw.githubusercontent.com/EasyScience/EasyReflectometryLib/master/docs/src/tutorials/fitting/repeating_layers.ort\",\n",
98+
" known_hash=\"a5ffca9fd24f1d362266251723aec7ce9f34f123e39a38dfc4d829c758e6bf90\",\n",
99+
")\n",
100+
"data = load(file_path)"
93101
]
94102
},
95103
{
@@ -265,7 +273,8 @@
265273
"outputs": [],
266274
"source": [
267275
"fitter = Fitter(model)\n",
268-
"analysed = fitter.fit(data, method='differential_evolution')\n",
276+
"fitter.switch_minimizer(AvailableMinimizers.LMFit_differential_evolution)\n",
277+
"analysed = fitter.fit(data)\n",
269278
"analysed"
270279
]
271280
},
@@ -316,8 +325,22 @@
316325
}
317326
],
318327
"metadata": {
328+
"kernelspec": {
329+
"display_name": "erl_1_311",
330+
"language": "python",
331+
"name": "python3"
332+
},
319333
"language_info": {
320-
"name": "python"
334+
"codemirror_mode": {
335+
"name": "ipython",
336+
"version": 3
337+
},
338+
"file_extension": ".py",
339+
"mimetype": "text/x-python",
340+
"name": "python",
341+
"nbconvert_exporter": "python",
342+
"pygments_lexer": "ipython3",
343+
"version": "3.11.9"
321344
}
322345
},
323346
"nbformat": 4,

docs/src/tutorials/fitting/simple_fitting.ipynb

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@
2929
"source": [
3030
"%matplotlib inline\n",
3131
"\n",
32-
"import easyreflectometry\n",
32+
"import pooch\n",
3333
"import refnx\n",
34+
"\n",
35+
"import easyreflectometry\n",
36+
"\n",
3437
"from easyreflectometry.data import load\n",
3538
"from easyreflectometry.sample import Layer\n",
3639
"from easyreflectometry.sample import Sample\n",
@@ -71,7 +74,7 @@
7174
"\n",
7275
"`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",
7376
"To load in a dataset, we use the `load` function.\n",
74-
"Use link to [download](example.ort) the ort data."
77+
"We use `pooch` to fetch the file from the repository."
7578
]
7679
},
7780
{
@@ -81,7 +84,12 @@
8184
"metadata": {},
8285
"outputs": [],
8386
"source": [
84-
"data = load('example.ort')"
87+
"file_path = pooch.retrieve(\n",
88+
" # URL to one of Pooch's test files\n",
89+
" url=\"https://raw.githubusercontent.com/EasyScience/EasyReflectometryLib/master/docs/src/tutorials/fitting/example.ort\",\n",
90+
" known_hash=\"82d0c95c069092279a799a8131ad3710335f601d9f1080754b387f42e407dfab\",\n",
91+
")\n",
92+
"data = load(file_path)"
8593
]
8694
},
8795
{
@@ -514,8 +522,22 @@
514522
}
515523
],
516524
"metadata": {
525+
"kernelspec": {
526+
"display_name": "erl_1_311",
527+
"language": "python",
528+
"name": "python3"
529+
},
517530
"language_info": {
518-
"name": "python"
531+
"codemirror_mode": {
532+
"name": "ipython",
533+
"version": 3
534+
},
535+
"file_extension": ".py",
536+
"mimetype": "text/x-python",
537+
"name": "python",
538+
"nbconvert_exporter": "python",
539+
"pygments_lexer": "ipython3",
540+
"version": "3.11.9"
519541
}
520542
},
521543
"nbformat": 4,

0 commit comments

Comments
 (0)