Skip to content

Commit

Permalink
docs: amor example
Browse files Browse the repository at this point in the history
  • Loading branch information
jokasimr committed Oct 19, 2023
1 parent dfac0bc commit b3426ad
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions docs/examples/amor.ipynb
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit b3426ad

Please sign in to comment.