diff --git a/docs/docs/tutorials/analysis.ipynb b/docs/docs/tutorials/analysis.ipynb
index 41e6c7ed1..7ba7858b5 100644
--- a/docs/docs/tutorials/analysis.ipynb
+++ b/docs/docs/tutorials/analysis.ipynb
@@ -255,17 +255,6 @@
"diffusion_analysis.plot_parameters(names=['Lorentzian width', 'Lorentzian area'])"
]
},
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "eb226c8f",
- "metadata": {},
- "outputs": [],
- "source": [
- "# It will be possible to fit this to a DiffusionModel, but that will\n",
- "# come later."
- ]
- },
{
"cell_type": "code",
"execution_count": null,
@@ -332,13 +321,13 @@
"outputs": [],
"source": [
"# Let us look at the fitted diffusion coefficient\n",
- "diffusion_model.get_all_parameters()"
+ "diffusion_model.get_fittable_parameters()"
]
}
],
"metadata": {
"kernelspec": {
- "display_name": "Python 3",
+ "display_name": "default",
"language": "python",
"name": "python3"
},
@@ -352,9 +341,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.14.4"
+ "version": "3.14.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
-}
\ No newline at end of file
+}
diff --git a/docs/docs/tutorials/analysis1d.ipynb b/docs/docs/tutorials/analysis1d.ipynb
index 784f2be50..5ee06676d 100644
--- a/docs/docs/tutorials/analysis1d.ipynb
+++ b/docs/docs/tutorials/analysis1d.ipynb
@@ -81,7 +81,7 @@
],
"metadata": {
"kernelspec": {
- "display_name": "Python 3",
+ "display_name": "default",
"language": "python",
"name": "python3"
},
@@ -95,9 +95,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.14.5"
+ "version": "3.14.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
-}
\ No newline at end of file
+}
diff --git a/docs/docs/tutorials/component_collection.ipynb b/docs/docs/tutorials/component_collection.ipynb
index 54f763871..656fcf59f 100644
--- a/docs/docs/tutorials/component_collection.ipynb
+++ b/docs/docs/tutorials/component_collection.ipynb
@@ -67,7 +67,7 @@
],
"metadata": {
"kernelspec": {
- "display_name": "Python 3",
+ "display_name": "default",
"language": "python",
"name": "python3"
},
@@ -81,9 +81,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.14.4"
+ "version": "3.14.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
-}
\ No newline at end of file
+}
diff --git a/docs/docs/tutorials/components.ipynb b/docs/docs/tutorials/components.ipynb
index 70070f1e0..eafa88973 100644
--- a/docs/docs/tutorials/components.ipynb
+++ b/docs/docs/tutorials/components.ipynb
@@ -39,7 +39,9 @@
"gaussian = sm.Gaussian(display_name='Gaussian', width=0.5, area=1)\n",
"dho = sm.DampedHarmonicOscillator(display_name='DHO', center=1.0, width=0.3, area=2.0)\n",
"lorentzian = sm.Lorentzian(display_name='Lorentzian', center=-1.0, width=0.2, area=1.0)\n",
- "polynomial = sm.Polynomial(display_name='Polynomial', coefficients=[0.1, 0, 0.5]) # y=0.1+0.5*x^2\n",
+ "polynomial = sm.Polynomial(\n",
+ " display_name='Polynomial', coefficients=[-0.2, 0, 0.5]\n",
+ ") # y=-0.2+0.5*x^2\n",
"exponential = sm.Exponential(display_name='Exponential', amplitude=1.0, rate=-0.5)\n",
"\n",
"x = np.linspace(-2, 2, 100)\n",
@@ -59,6 +61,18 @@
"plt.show()"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "6db00a3e",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Suppress the warning from the Polynomial:\n",
+ "polynomial.suppress_warnings = True\n",
+ "y = polynomial.evaluate(x)"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -119,6 +133,14 @@
"plt.show()"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "11884136",
+ "metadata": {},
+ "source": [
+ "The `ExpressionComponent` can create almost any function you would like. Units are supported and must be given for each parameter either at construction as below, or afterwards as properties. The individual parameters can be accessed by their name in the usual way. You must use `x` fore the x-axis. It will warn if the units are not consistent."
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -129,6 +151,15 @@
"expr = sm.ExpressionComponent(\n",
" 'A * exp(-(x - x0)**2 / (2*sigma**2)) +B*sin(2*pi*x/period)',\n",
" parameters={'A': 10, 'x0': 0, 'sigma': 1},\n",
+ " parameter_units={\n",
+ " 'A': 'dimensionless',\n",
+ " 'x0': 'meV',\n",
+ " 'sigma': 'meV',\n",
+ " 'B': 'dimensionless',\n",
+ " 'period': 'meV',\n",
+ " },\n",
+ " x_unit='meV',\n",
+ " y_unit='dimensionless',\n",
")\n",
"\n",
"expr.A = 5\n",
@@ -142,7 +173,9 @@
"plt.figure()\n",
"plt.plot(x, y, label='Expression Component')\n",
"plt.legend()\n",
- "plt.show()"
+ "plt.show()\n",
+ "plt.xlabel('Energy (meV)')\n",
+ "plt.ylabel('Intensity (arb. units)')"
]
},
{
@@ -172,7 +205,7 @@
],
"metadata": {
"kernelspec": {
- "display_name": "Python 3",
+ "display_name": "default",
"language": "python",
"name": "python3"
},
@@ -186,9 +219,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.14.5"
+ "version": "3.14.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
-}
\ No newline at end of file
+}
diff --git a/docs/docs/tutorials/convolution.ipynb b/docs/docs/tutorials/convolution.ipynb
index d37c38c14..2e9625559 100644
--- a/docs/docs/tutorials/convolution.ipynb
+++ b/docs/docs/tutorials/convolution.ipynb
@@ -51,8 +51,8 @@
"sample_components.append_component(delta)\n",
"\n",
"resolution_components = sm.ComponentCollection()\n",
- "resolution_gaussian = sm.Gaussian(display_name='Resolution Gaussian', width=0.015, area=0.8)\n",
- "resolution_lorentzian = sm.Lorentzian(display_name='Resolution Lorentzian', width=0.025, area=0.2)\n",
+ "resolution_gaussian = sm.Gaussian(display_name='Resolution Gaussian', width=0.05, area=0.8)\n",
+ "resolution_lorentzian = sm.Lorentzian(display_name='Resolution Lorentzian', width=0.05, area=0.2)\n",
"resolution_components.append_component(resolution_gaussian)\n",
"resolution_components.append_component(resolution_lorentzian)\n",
"\n",
@@ -210,7 +210,7 @@
],
"metadata": {
"kernelspec": {
- "display_name": "Python 3",
+ "display_name": "default",
"language": "python",
"name": "python3"
},
@@ -224,9 +224,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.14.4"
+ "version": "3.14.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
-}
\ No newline at end of file
+}
diff --git a/docs/docs/tutorials/data/create_fake_data.ipynb b/docs/docs/tutorials/data/create_fake_data.ipynb
index e4ed0ee8c..55ac3822c 100644
--- a/docs/docs/tutorials/data/create_fake_data.ipynb
+++ b/docs/docs/tutorials/data/create_fake_data.ipynb
@@ -59,7 +59,7 @@
"intensity_dataarray.values += noise\n",
"intensity_dataarray.variances = noise**2\n",
"\n",
- "sc.io.save_hdf5(intensity_dataarray, 'fake_simple_data.hdf5')\n",
+ "# sc.io.save_hdf5(intensity_dataarray, 'fake_simple_data.hdf5')\n",
"pp.slicer(intensity_dataarray)"
]
},
@@ -105,14 +105,14 @@
"intensity_dataarray.values += noise\n",
"intensity_dataarray.variances = noise**2\n",
"\n",
- "sc.io.save_hdf5(intensity_dataarray, 'fake_advanced_data.hdf5')\n",
+ "# sc.io.save_hdf5(intensity_dataarray, 'fake_advanced_data.hdf5')\n",
"pp.slicer(intensity_dataarray)"
]
}
],
"metadata": {
"kernelspec": {
- "display_name": "Python 3",
+ "display_name": "default",
"language": "python",
"name": "python3"
},
@@ -126,7 +126,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.14.4"
+ "version": "3.14.6"
}
},
"nbformat": 4,
diff --git a/docs/docs/tutorials/data/fake_advanced_data.hdf5 b/docs/docs/tutorials/data/fake_advanced_data.hdf5
index d83903fb0..2a21cb285 100644
Binary files a/docs/docs/tutorials/data/fake_advanced_data.hdf5 and b/docs/docs/tutorials/data/fake_advanced_data.hdf5 differ
diff --git a/docs/docs/tutorials/data/fake_simple_data.hdf5 b/docs/docs/tutorials/data/fake_simple_data.hdf5
index 14afb8306..bef9761a8 100644
Binary files a/docs/docs/tutorials/data/fake_simple_data.hdf5 and b/docs/docs/tutorials/data/fake_simple_data.hdf5 differ
diff --git a/docs/docs/tutorials/delta_lorentz.ipynb b/docs/docs/tutorials/delta_lorentz.ipynb
index 351358124..c1046f984 100644
--- a/docs/docs/tutorials/delta_lorentz.ipynb
+++ b/docs/docs/tutorials/delta_lorentz.ipynb
@@ -45,7 +45,7 @@
"energy = np.linspace(-2, 2, 501)\n",
"scale = 1.0\n",
"mean_u_squared = 0.5\n",
- "A_0 = 0.2\n",
+ "A_0 = 0.01\n",
"lorentzian_width = 0.2\n",
"\n",
"diffusion_model = sm.DeltaLorentz(\n",
@@ -60,6 +60,25 @@
")"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "0aee03b1",
+ "metadata": {},
+ "source": [
+ "Both `A_0` and `lorentzian_width` are here allowed to vary with Q. We here change a few of them just to show how this impacts the model. The `# noqa` comment is because we are accessing private members of the model (ones beginning with `_`), which is generally discouraged. Because of these changes, in the figure below, the delta function at Q=1.25 Å^-1 is much larger than the other ones, and the Lorentzian at Q=1.75 Å^-1 is much narrower and taller than the other ones."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "2b9d4113",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "diffusion_model._A_0_list[3].value = 0.02 # noqa\n",
+ "diffusion_model._lorentzian_width_list[5].value = 0.1 # noqa"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -96,7 +115,7 @@
],
"metadata": {
"kernelspec": {
- "display_name": "Python 3",
+ "display_name": "default",
"language": "python",
"name": "python3"
},
@@ -110,9 +129,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.14.4"
+ "version": "3.14.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
-}
\ No newline at end of file
+}
diff --git a/docs/docs/tutorials/detailed_balance.ipynb b/docs/docs/tutorials/detailed_balance.ipynb
index 12d926a6d..bd6fccce3 100644
--- a/docs/docs/tutorials/detailed_balance.ipynb
+++ b/docs/docs/tutorials/detailed_balance.ipynb
@@ -86,7 +86,7 @@
],
"metadata": {
"kernelspec": {
- "display_name": "easydynamics_newbase",
+ "display_name": "default",
"language": "python",
"name": "python3"
},
@@ -100,7 +100,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.12.12"
+ "version": "3.14.6"
}
},
"nbformat": 4,
diff --git a/docs/docs/tutorials/diffusion_model.ipynb b/docs/docs/tutorials/diffusion_model.ipynb
index ddf9e9a0e..ffc26cc09 100644
--- a/docs/docs/tutorials/diffusion_model.ipynb
+++ b/docs/docs/tutorials/diffusion_model.ipynb
@@ -85,7 +85,7 @@
],
"metadata": {
"kernelspec": {
- "display_name": "Python 3",
+ "display_name": "default",
"language": "python",
"name": "python3"
},
@@ -99,9 +99,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.14.4"
+ "version": "3.14.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
-}
\ No newline at end of file
+}
diff --git a/docs/docs/tutorials/experiment.ipynb b/docs/docs/tutorials/experiment.ipynb
index 0e6b7c5b4..8e265aff8 100644
--- a/docs/docs/tutorials/experiment.ipynb
+++ b/docs/docs/tutorials/experiment.ipynb
@@ -70,9 +70,9 @@
],
"metadata": {
"kernelspec": {
- "display_name": "Python (Pixi)",
+ "display_name": "default",
"language": "python",
- "name": "pixi-kernel-python3"
+ "name": "python3"
},
"language_info": {
"codemirror_mode": {
@@ -84,9 +84,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.12.12"
+ "version": "3.14.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
-}
\ No newline at end of file
+}
diff --git a/docs/docs/tutorials/instrument_model.ipynb b/docs/docs/tutorials/instrument_model.ipynb
index 27ccbb93a..99e05545a 100644
--- a/docs/docs/tutorials/instrument_model.ipynb
+++ b/docs/docs/tutorials/instrument_model.ipynb
@@ -75,7 +75,7 @@
],
"metadata": {
"kernelspec": {
- "display_name": "easydynamics_newbase",
+ "display_name": "default",
"language": "python",
"name": "python3"
},
@@ -89,9 +89,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.12.12"
+ "version": "3.14.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
-}
\ No newline at end of file
+}
diff --git a/docs/docs/tutorials/sample_model.ipynb b/docs/docs/tutorials/sample_model.ipynb
index fa34e8da1..0edad8e3e 100644
--- a/docs/docs/tutorials/sample_model.ipynb
+++ b/docs/docs/tutorials/sample_model.ipynb
@@ -61,7 +61,7 @@
" diffusion_models=diffusion_model,\n",
" components=component_collection,\n",
" Q=Q,\n",
- " unit='meV',\n",
+ " x_unit='meV',\n",
" display_name='MySampleModel',\n",
" temperature=10,\n",
")\n",
@@ -127,7 +127,7 @@
],
"metadata": {
"kernelspec": {
- "display_name": "Python 3",
+ "display_name": "default",
"language": "python",
"name": "python3"
},
@@ -141,9 +141,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.14.5"
+ "version": "3.14.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
-}
\ No newline at end of file
+}
diff --git a/docs/docs/tutorials/tutorial0_basics.ipynb b/docs/docs/tutorials/tutorial0_basics.ipynb
index 548c6c714..7efb5705f 100644
--- a/docs/docs/tutorials/tutorial0_basics.ipynb
+++ b/docs/docs/tutorials/tutorial0_basics.ipynb
@@ -366,7 +366,8 @@
"id": "d6e8ece6",
"metadata": {},
"source": [
- "If you wish to customise the plot beyond what is immediately possible with EasyDynamics, you can get the data and model as a scipp datagroup. You may evaluate the model at different energies than the data like this."
+ "If you wish to customise the plot beyond what is immediately possible with EasyDynamics, you can get the data and model as a scipp D\n",
+ "atagroup. You may evaluate the model at different energies than the data like this."
]
},
{
@@ -386,7 +387,19 @@
"id": "842c1f01",
"metadata": {},
"source": [
- "The final step in this tutorial is to fit the are of the `Gaussian` to a straight line. For this, we use the `ParameterAnalysis` class. We create a `Polynomial` with two coefficients for the fit function. We create a `FitBinding`, telling the class we want to fit the parameter named `Gaussian area` with the fit function that we define."
+ "The final step in this tutorial is to fit the area of the `Gaussian` as a function of Q using a straight line. For this, we use the `ParameterAnalysis` class.\n",
+ "\n",
+ "We create a `Polynomial` with two coefficients as the fit function. We then create a `FitBinding` to connect the parameter named `Gaussian area` to the fit function, and pass both to a `ParameterAnalysis` object:\n",
+ "\n",
+ "Note
\n",
+ "