Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/docs/api-reference/base_classes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: easydynamics.base_classes
9 changes: 6 additions & 3 deletions docs/docs/api-reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ icon: material/code-braces-box
This section contains the reference detailing the functions and modules
available in EasyDynamics.

- [analysis](analysis.md) - Analysing experimental data by fitting a
sample model to experimental data, optionally convoluted with a
resolution model and adding a background.
- [base_classes](base_classes.md) - EasyDynamics base classes
- [convolution](convolution.md) – Handles convolution of the sample
model with the instrument resolution.
- [experiment](experiment.md) - Load, manage and visualize experimental
data.
- [sample_model](sample_model.md) – All modelling in EasyDynamics: The
scattering from the sample, including individual model components and
diffusion models, background, resolution and instrument.
- [analysis](analysis.md) - Analysing experimental data by fitting a
sample model to experimental data, optionally convoluted with a
resolution model and adding a background.
- [settings](settings.md) - Settings for numerical convolution and
detailed balance correction
- [utils](utils.md) – Miscellaneous utility functions for EasyDynamics.
1 change: 1 addition & 0 deletions docs/docs/api-reference/settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: easydynamics.settings
12 changes: 8 additions & 4 deletions docs/docs/tutorials/component_collection.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,22 @@
"y = component_collection.evaluate(x)\n",
"plt.plot(x, y, label='Component collection')\n",
"\n",
"for component in component_collection.components:\n",
"for component in component_collection:\n",
" y = component.evaluate(x)\n",
" plt.plot(x, y, label=component.display_name)\n",
"\n",
"plt.legend()\n",
"plt.show()"
"plt.show()\n",
"\n",
"# Accessing components by name\n",
"gaussian_component = component_collection['Gaussian']\n",
"print(gaussian_component)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "easydynamics_newbase",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -81,7 +85,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.12"
"version": "3.14.4"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/tutorials/components.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "1",
"id": "df408006",
"metadata": {},
"outputs": [],
"source": [
Expand Down
10 changes: 5 additions & 5 deletions docs/docs/tutorials/data/create_fake_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"for i in range(Q.size):\n",
" components = model.get_component_collection(i)\n",
" offset = 0.0\n",
" components.components[0].area = 3.79 - 0.2 * Q[i].value\n",
" components[0].area = 3.79 - 0.2 * Q[i].value\n",
"\n",
"energy = sc.linspace(start=-3.0, stop=3.0, num=756, unit='meV', dim='energy')\n",
"\n",
Expand Down Expand Up @@ -86,14 +86,14 @@
"energy = sc.linspace(start=-3.0, stop=3.0, num=756, unit='meV', dim='energy')\n",
"intensity_values = np.zeros((Q.size, energy.size))\n",
"rng = np.random.default_rng()\n",
"noise = rng.normal(loc=0.0, scale=0.35, size=intensity_dataarray.shape)\n",
"noise = rng.normal(loc=0.0, scale=0.35, size=intensity_values.shape)\n",
"\n",
"for i in range(Q.size):\n",
" components = model.get_component_collection(i)\n",
" offset = sc.scalar(value=rng.uniform(0.05, 0.15), unit='meV')\n",
" components.components[0].area = 3.79 - 0.2 * Q[i].value\n",
" components.components[2].center = 1.4 + Q[i].value / 10.0\n",
" components.components[2].area = 2.45 + Q[i].value / 10.0\n",
" components[0].area = 3.79 - 0.2 * Q[i].value\n",
" components[2].center = 1.4 + Q[i].value / 10.0\n",
" components[2].area = 2.45 + Q[i].value / 10.0\n",
"\n",
" intensity_values[i, :] = components.evaluate(x=energy.values - offset.value)\n",
"\n",
Expand Down
22 changes: 11 additions & 11 deletions docs/docs/tutorials/tutorial0_basics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
"\n",
"import easydynamics as edyn\n",
"import easydynamics.sample_model as sm\n",
"from easydynamics.analysis import Analysis\n",
"from easydynamics.analysis import ParameterAnalysis\n",
"from easydynamics.analysis.parameter_analysis import FitBinding\n",
"\n",
"# Make the plots interactive\n",
"%matplotlib widget"
Expand Down Expand Up @@ -125,7 +122,7 @@
" </div>\n",
"</details>\n",
"\n",
"In this data we see a single Gaussian shaped peak and a background that seems to be zero on average. We now want to fit this data, e.g. to determine how the Gaussian changes with $Q$. We define a `Gaussian` like this:"
"In this data we see a single Gaussian shaped peak and a background that seems to be zero on average. We now want to fit this data, e.g. to determine how the Gaussian changes with $Q$. We define a `Gaussian` like this. The `name` will soon be used for indexing, while the `display_name` is what is displayed in figures. By defalut, `display_name` is the same as `name`."
]
},
{
Expand All @@ -135,7 +132,7 @@
"metadata": {},
"outputs": [],
"source": [
"gaussian = sm.Gaussian(display_name='Gaussian', area=1, width=0.05)"
"gaussian = sm.Gaussian(name='Gaussian', area=1, width=0.05)"
]
},
{
Expand Down Expand Up @@ -201,7 +198,7 @@
"metadata": {},
"outputs": [],
"source": [
"analysis = Analysis(\n",
"analysis = edyn.Analysis(\n",
" experiment=experiment,\n",
" sample_model=model,\n",
")"
Expand Down Expand Up @@ -382,7 +379,8 @@
"outputs": [],
"source": [
"energy = sc.linspace('energy', -3.5, 3.5, num=1001, unit='meV')\n",
"data_and_model = analysis.data_and_model_to_datagroup(energy=energy)"
"data_and_model = analysis.data_and_model_to_datagroup(energy=energy)\n",
"print(data_and_model)"
]
},
{
Expand All @@ -400,11 +398,13 @@
"metadata": {},
"outputs": [],
"source": [
"fit_func = sm.Polynomial(coefficients=[3.7, -0.5], display_name='Straight line')\n",
"fit_func = sm.Polynomial(\n",
" coefficients=[3.7, -0.5], name='Straight line', display_name='Straight line'\n",
")\n",
"\n",
"binding = FitBinding(parameter_name='Gaussian area', model=fit_func)\n",
"binding = edyn.FitBinding(parameter_name='Gaussian area', model=fit_func)\n",
"\n",
"parameter_analysis = ParameterAnalysis(\n",
"parameter_analysis = edyn.ParameterAnalysis(\n",
" parameters=analysis,\n",
" bindings=[binding],\n",
")"
Expand Down Expand Up @@ -468,7 +468,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "in16b",
"language": "python",
"name": "python3"
},
Expand Down
18 changes: 7 additions & 11 deletions docs/docs/tutorials/tutorial0_more_advanced.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@
"metadata": {},
"outputs": [],
"source": [
"gaussian = sm.Gaussian(display_name='Gaussian', area=3, width=0.05)\n",
"lorentzian = sm.Lorentzian(display_name='Lorentzian', area=2, width=0.3)\n",
"dho = sm.DampedHarmonicOscillator(display_name='DHO', area=1.5, width=0.2, center=1.5)\n",
"gaussian = sm.Gaussian(name='Gaussian', area=3, width=0.05)\n",
"lorentzian = sm.Lorentzian(name='Lorentzian', area=2, width=0.3)\n",
"dho = sm.DampedHarmonicOscillator(name='DHO', area=1.5, width=0.2, center=1.5)\n",
"\n",
"collection = sm.ComponentCollection()\n",
"collection.append_component(gaussian)\n",
Expand Down Expand Up @@ -245,7 +245,7 @@
"id": "af4103fb",
"metadata": {},
"source": [
"The fit looks very good. We can again get a list of the parameters for this fit by accesing the corresponding `Analysis1d` object. Note ethat the Gaussian and Lorentzian centers are both zero, but that the `energy_offset` is non-zero."
"The fit looks very good. We can again get a list of the parameters for this fit by accesing the corresponding `Analysis1d` object. Note that the Gaussian and Lorentzian centers are both zero, but that the `energy_offset` is non-zero."
]
},
{
Expand Down Expand Up @@ -310,14 +310,10 @@
"metadata": {},
"outputs": [],
"source": [
"gauss_fit_func = sm.Polynomial(\n",
" coefficients=[3.7, -0.5], unit='1/angstrom', display_name='Gauss area fit'\n",
")\n",
"dho_area_fit_func = sm.Polynomial(\n",
" coefficients=[2.0, 0.12], unit='1/angstrom', display_name='DHO area fit'\n",
")\n",
"gauss_fit_func = sm.Polynomial(coefficients=[3.7, -0.5], unit='1/angstrom', name='Gauss area fit')\n",
"dho_area_fit_func = sm.Polynomial(coefficients=[2.0, 0.12], unit='1/angstrom', name='DHO area fit')\n",
"dho_center_fit_func = sm.Polynomial(\n",
" coefficients=[1.1, 0.2], unit='1/angstrom', display_name='DHO center fit'\n",
" coefficients=[1.1, 0.2], unit='1/angstrom', name='DHO center fit'\n",
")\n",
"\n",
"binding1 = edyn.FitBinding(parameter_name='Gaussian area', model=gauss_fit_func)\n",
Expand Down
Loading
Loading