\n",
+ " Note
\n",
+ "\n",
+ "Two units must be set on the fit function:\n",
+ "\n",
+ "- `x_unit='1/angstrom'` — because `ParameterAnalysis` always uses Q as its x-axis.\n",
+ "- `y_unit='meV'` — because we are fitting `Gaussian area`, which has unit `meV`.\n",
+ "
\n",
+ " "
]
},
{
@@ -397,7 +409,10 @@
"outputs": [],
"source": [
"fit_func = sm.Polynomial(\n",
- " coefficients=[3.7, -0.5], name='Straight line', display_name='Straight line'\n",
+ " coefficients=[3.7, -0.5],\n",
+ " x_unit='1/angstrom',\n",
+ " y_unit='meV',\n",
+ " name='Straight line',\n",
")\n",
"\n",
"binding = edyn.FitBinding(parameter_name='Gaussian area', model=fit_func)\n",
@@ -450,7 +465,7 @@
"id": "dc33728c",
"metadata": {},
"source": [
- "To see the parameters we can use the `get_all_parameters()` method. We can also see only the parameters that can be fitted:"
+ "To see the parameters we can use the `get_all_parameters()` method. We can also see only the parameters that can be fitted using `get_fittable_parameters`:"
]
},
{
@@ -476,7 +491,7 @@
],
"metadata": {
"kernelspec": {
- "display_name": "Python 3",
+ "display_name": "default",
"language": "python",
"name": "python3"
},
diff --git a/docs/docs/tutorials/tutorial0_more_advanced.ipynb b/docs/docs/tutorials/tutorial0_more_advanced.ipynb
index f203dbdcb..09091358e 100644
--- a/docs/docs/tutorials/tutorial0_more_advanced.ipynb
+++ b/docs/docs/tutorials/tutorial0_more_advanced.ipynb
@@ -300,7 +300,19 @@
"id": "0eadbd91",
"metadata": {},
"source": [
- "With apologies for the lack of creativity, these all appear like straight lines. We can fit them individually or all together using `ParameterAnalysis`"
+ "With apologies for the lack of creativity, these all appear like straight lines. We can fit them individually or all together using `ParameterAnalysis`.\n",
+ "\n",
+ "For each parameter we want to fit, we create a fit function (here a `Polynomial`) and a `FitBinding` connecting the parameter name to the fit function. We then pass all bindings to a single `ParameterAnalysis` object:\n",
+ "\n",
+ "\n",
+ " Note
\n",
+ "\n",
+ "Two units must be set on each fit function:\n",
+ "\n",
+ "- `x_unit='1/angstrom'` — because `ParameterAnalysis` always uses Q as its x-axis.\n",
+ "- `y_unit='meV'` — because all three parameters (`Gaussian area`, `DHO area`, `DHO center`) have unit `meV`.\n",
+ "
\n",
+ " "
]
},
{
@@ -310,10 +322,14 @@
"metadata": {},
"outputs": [],
"source": [
- "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",
+ "gauss_fit_func = sm.Polynomial(\n",
+ " coefficients=[3.7, -0.5], x_unit='1/angstrom', y_unit='meV', name='Gauss area fit'\n",
+ ")\n",
+ "dho_area_fit_func = sm.Polynomial(\n",
+ " coefficients=[2.0, 0.12], x_unit='1/angstrom', y_unit='meV', name='DHO area fit'\n",
+ ")\n",
"dho_center_fit_func = sm.Polynomial(\n",
- " coefficients=[1.1, 0.2], unit='1/angstrom', name='DHO center fit'\n",
+ " coefficients=[1.1, 0.2], x_unit='1/angstrom', y_unit='meV', name='DHO center fit'\n",
")\n",
"\n",
"binding1 = edyn.FitBinding(parameter_name='Gaussian area', model=gauss_fit_func)\n",
@@ -335,7 +351,7 @@
"id": "32bc1efc",
"metadata": {},
"source": [
- "The start guesses look reasonable, so we fit:"
+ "The start guesses look reasonable, so we fit and plot the result:"
]
},
{
@@ -352,7 +368,7 @@
],
"metadata": {
"kernelspec": {
- "display_name": "Python 3",
+ "display_name": "default",
"language": "python",
"name": "python3"
},
diff --git a/docs/docs/tutorials/tutorial1_brownian.ipynb b/docs/docs/tutorials/tutorial1_brownian.ipynb
index 269bb2599..4fba2d61d 100644
--- a/docs/docs/tutorials/tutorial1_brownian.ipynb
+++ b/docs/docs/tutorials/tutorial1_brownian.ipynb
@@ -691,7 +691,7 @@
],
"metadata": {
"kernelspec": {
- "display_name": "Python 3",
+ "display_name": "default",
"language": "python",
"name": "python3"
},
diff --git a/docs/docs/tutorials/tutorial2_nanoparticles.ipynb b/docs/docs/tutorials/tutorial2_nanoparticles.ipynb
index 22de24900..da2188bcf 100644
--- a/docs/docs/tutorials/tutorial2_nanoparticles.ipynb
+++ b/docs/docs/tutorials/tutorial2_nanoparticles.ipynb
@@ -593,7 +593,7 @@
],
"metadata": {
"kernelspec": {
- "display_name": "Python 3",
+ "display_name": "default",
"language": "python",
"name": "python3"
},
diff --git a/src/easydynamics/analysis/analysis.py b/src/easydynamics/analysis/analysis.py
index 7291ea917..ee3d3e66b 100644
--- a/src/easydynamics/analysis/analysis.py
+++ b/src/easydynamics/analysis/analysis.py
@@ -1,6 +1,7 @@
# SPDX-FileCopyrightText: 2026 EasyScience contributors