Skip to content

Commit

Permalink
Merge pull request #178 from EasyScience/develop
Browse files Browse the repository at this point in the history
Version 1.10.0
  • Loading branch information
andped10 authored Sep 10, 2024
2 parents 2ae5fdc + 2d02276 commit 81542a7
Show file tree
Hide file tree
Showing 63 changed files with 1,951 additions and 1,231 deletions.
20 changes: 20 additions & 0 deletions docs/src/dictionay.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Dictionary
==========
The following serves to clarify what we mean by the terms we use in this project.

Sample
------
A sample is an ideal representation of a the full physical setup.
This includes the layer(s) under investigation, the surrounding superphase, and the subphase.

Calculator
----------
A calculator is the physics engine which calculates the reflectivity curve from our inputted sample parameters.
We rely on third party software to provide the necessary calculators.
Different calculators might have different capabilities and limitations.

Model
-----
A model combines a sample and calculator.
The model is also responsible for including instrumental effects such as background, scale, and resolution.

1 change: 1 addition & 0 deletions docs/src/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
calculators
experiment/experiment
tutorials/tutorials
dictionary
contributing
authors
api/api
Expand Down
4 changes: 2 additions & 2 deletions docs/src/sample/material_library.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The construction of a :py:class:`Material` is achieved as shown below.
name='Boron'
)
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.
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.
As is shown in the `tutorials`_, a material can be used to construct a :py:class:`Layer` from which `slab models`_ are created.

:py:class:`MaterialDensity`
Expand Down Expand Up @@ -78,7 +78,7 @@ So to produce a :py:class:`MaterialSolvated` that is 20 % D2O in a polymer, the
name='Solvated Polymer'
)
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).
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).
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.

.. _`assemblies`: ./assemblies_library.html
Expand Down
39 changes: 31 additions & 8 deletions docs/src/tutorials/fitting/repeating.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@
"\n",
"import numpy as np\n",
"import scipp as sc\n",
"import easyreflectometry\n",
"import pooch\n",
"import refl1d\n",
"\n",
"import easyreflectometry\n",
"\n",
"from easyreflectometry.data import load\n",
"from easyreflectometry.sample import Layer\n",
"from easyreflectometry.sample import Sample\n",
Expand All @@ -46,7 +49,8 @@
"from easyreflectometry.experiment import PercentageFhwm\n",
"from easyreflectometry.calculators import CalculatorFactory\n",
"from easyreflectometry.fitting import Fitter\n",
"from easyreflectometry.plot import plot"
"from easyreflectometry.plot import plot\n",
"from easyscience.fitting import AvailableMinimizers"
]
},
{
Expand Down Expand Up @@ -78,18 +82,22 @@
"## Reading in experimental data\n",
"\n",
"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",
"Use link to [download](repeating_layers.ort) the ort data."
"We use `pooch` to fetch the file from the repository."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "609174e5-1371-412d-a29f-cb05bfe36df0",
"id": "7121c7e9",
"metadata": {},
"outputs": [],
"source": [
"data = load('repeating_layers.ort')\n",
"data"
"file_path = pooch.retrieve(\n",
" # URL to one of Pooch's test files\n",
" url=\"https://raw.githubusercontent.com/EasyScience/EasyReflectometryLib/master/docs/src/tutorials/fitting/repeating_layers.ort\",\n",
" known_hash=\"a5ffca9fd24f1d362266251723aec7ce9f34f123e39a38dfc4d829c758e6bf90\",\n",
")\n",
"data = load(file_path)"
]
},
{
Expand Down Expand Up @@ -265,7 +273,8 @@
"outputs": [],
"source": [
"fitter = Fitter(model)\n",
"analysed = fitter.fit(data, method='differential_evolution')\n",
"fitter.switch_minimizer(AvailableMinimizers.LMFit_differential_evolution)\n",
"analysed = fitter.fit(data)\n",
"analysed"
]
},
Expand Down Expand Up @@ -316,8 +325,22 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "erl_1_311",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python"
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down
30 changes: 26 additions & 4 deletions docs/src/tutorials/fitting/simple_fitting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@
"source": [
"%matplotlib inline\n",
"\n",
"import easyreflectometry\n",
"import pooch\n",
"import refnx\n",
"\n",
"import easyreflectometry\n",
"\n",
"from easyreflectometry.data import load\n",
"from easyreflectometry.sample import Layer\n",
"from easyreflectometry.sample import Sample\n",
Expand Down Expand Up @@ -71,7 +74,7 @@
"\n",
"`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",
"To load in a dataset, we use the `load` function.\n",
"Use link to [download](example.ort) the ort data."
"We use `pooch` to fetch the file from the repository."
]
},
{
Expand All @@ -81,7 +84,12 @@
"metadata": {},
"outputs": [],
"source": [
"data = load('example.ort')"
"file_path = pooch.retrieve(\n",
" # URL to one of Pooch's test files\n",
" url=\"https://raw.githubusercontent.com/EasyScience/EasyReflectometryLib/master/docs/src/tutorials/fitting/example.ort\",\n",
" known_hash=\"82d0c95c069092279a799a8131ad3710335f601d9f1080754b387f42e407dfab\",\n",
")\n",
"data = load(file_path)"
]
},
{
Expand Down Expand Up @@ -514,8 +522,22 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "erl_1_311",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python"
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 81542a7

Please sign in to comment.