Skip to content
Open
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
19 changes: 4 additions & 15 deletions docs/docs/tutorials/analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"
},
Expand All @@ -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
}
}
6 changes: 3 additions & 3 deletions docs/docs/tutorials/analysis1d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "default",
"language": "python",
"name": "python3"
},
Expand All @@ -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
}
}
6 changes: 3 additions & 3 deletions docs/docs/tutorials/component_collection.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "default",
"language": "python",
"name": "python3"
},
Expand All @@ -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
}
}
34 changes: 29 additions & 5 deletions docs/docs/tutorials/components.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -142,7 +164,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)')"
]
},
{
Expand Down Expand Up @@ -172,7 +196,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "default",
"language": "python",
"name": "python3"
},
Expand All @@ -186,9 +210,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.14.5"
"version": "3.14.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
}
10 changes: 5 additions & 5 deletions docs/docs/tutorials/convolution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -210,7 +210,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "default",
"language": "python",
"name": "python3"
},
Expand All @@ -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
}
}
8 changes: 4 additions & 4 deletions docs/docs/tutorials/data/create_fake_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
]
},
Expand Down Expand Up @@ -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"
},
Expand All @@ -126,7 +126,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.14.4"
"version": "3.14.6"
}
},
"nbformat": 4,
Expand Down
Binary file modified docs/docs/tutorials/data/fake_advanced_data.hdf5
Binary file not shown.
Binary file modified docs/docs/tutorials/data/fake_simple_data.hdf5
Binary file not shown.
27 changes: 23 additions & 4 deletions docs/docs/tutorials/delta_lorentz.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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,
Expand Down Expand Up @@ -96,7 +115,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "default",
"language": "python",
"name": "python3"
},
Expand All @@ -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
}
}
4 changes: 2 additions & 2 deletions docs/docs/tutorials/detailed_balance.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "easydynamics_newbase",
"display_name": "default",
"language": "python",
"name": "python3"
},
Expand All @@ -100,7 +100,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.12"
"version": "3.14.6"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/tutorials/diffusion_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "default",
"language": "python",
"name": "python3"
},
Expand All @@ -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
}
}
8 changes: 4 additions & 4 deletions docs/docs/tutorials/experiment.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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
}
}
6 changes: 3 additions & 3 deletions docs/docs/tutorials/instrument_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "easydynamics_newbase",
"display_name": "default",
"language": "python",
"name": "python3"
},
Expand All @@ -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
}
}
Loading