diff --git a/docs/examples/amor.ipynb b/docs/examples/amor.ipynb new file mode 100644 index 0000000..1df5392 --- /dev/null +++ b/docs/examples/amor.ipynb @@ -0,0 +1,80 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "\n", + "import scipp as sc\n", + "import sciline\n", + "from essreflectometry.amor.load import load\n", + "from essreflectometry.amor.beamline import make_beamline\n", + "from essreflectometry.amor.conversions import specular_reflection\n", + "from essreflectometry.reflectometry.conversions import providers\n", + "from essreflectometry.reflectometry.types import (\n", + " ThetaBins, WavelengthBins, Sample, SampleRotation, Filename,\n", + " ThetaData, WavelengthData,\n", + ")\n", + "\n", + "\n", + "\n", + "\n", + "pipeline = sciline.Pipeline(\n", + " [load, make_beamline, specular_reflection] + providers,\n", + " params={\n", + " ThetaBins: sc.linspace(dim='theta', start=0, stop=np.pi/2, num=200, unit='rad'),\n", + " WavelengthBins: sc.array(dims=['wavelength'], values=[2.4, 16.0], unit='angstrom'),\n", + " SampleRotation[Sample]: sc.scalar(0.7989, unit='deg'),\n", + " Filename[Sample]: \"sample.nxs\",\n", + " }\n", + ")\n", + "\n", + "pipeline.visualize(ThetaData[Sample])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "pipeline.compute(WavelengthData[Sample])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "(pipeline.compute(WavelengthData[Sample])\n", + " .bins.concat('detector_number').hist(wavelength=200)\n", + " .plot())" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "essreflectometry", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.12" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}