Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add illustration of inhomogeneity from absorption #113

Merged
merged 16 commits into from
Feb 19, 2025
Merged
Changes from 1 commit
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
59 changes: 59 additions & 0 deletions docs/user-guide/dream/dream-instrument-view.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,65 @@
"source": [
"dream.instrument_view(dg[\"endcap_backward\"][\"module\", 0].hist(tof=1))"
]
},
{
"cell_type": "markdown",
"id": "15",
"metadata": {},
"source": [
"## Display inhomogeneity from absorption\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice way of visualizing, but I am not sure this is the right notebook to put it in?
It feels sort of unrelated to the rest?

Would it be better as part of something like a gallery notebook (even though we don't have a gallery yet?).
Or even keep a list of 'recipes' in e.g. our github discussions (and refer to them in the docs)?
This visualization sounds like it is something that the instrument scientist would find useful just for themselves, but isn't a necessary part of a reduction workflow?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, we can put it in a separate notebook.

It's mainly useful for IS to estimate what kind of impact absorption has in some experiment setup.
Celine mentioned that this would be good step towards having an automatic absorption correction.
Making absorption correction part of the workflow is started in #104

"\n",
"If the sample absorbs or scatters a large fraction of the incoming neutrons the intensity in the detector will vary even if the scattering is inhomogeneous.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "16",
"metadata": {},
"outputs": [],
"source": [
"import scipp as sc\n",
"\n",
"from scippneutron.absorption import compute_transmission_map\n",
"from scippneutron.absorption.cylinder import Cylinder\n",
"from scippneutron.absorption.material import Material\n",
"from scippneutron.atoms import ScatteringParams\n",
"\n",
"\n",
"material = Material(\n",
" scattering_params=ScatteringParams.for_isotope('V'),\n",
" effective_sample_number_density=sc.scalar(0.07192, unit='1/angstrom**3')\n",
")\n",
"sample_shape = Cylinder(\n",
" symmetry_line=sc.vector([0, 1, 0]),\n",
" center_of_base=sc.vector([0, -.5, 0], unit='cm'),\n",
" radius=sc.scalar(1, unit='cm'),\n",
" height=sc.scalar(5., unit='cm')\n",
")\n",
"\n",
"transmission_fraction = compute_transmission_map(\n",
" sample_shape,\n",
" material,\n",
" beam_direction=sc.vector([0, 0, 1]),\n",
" wavelength=sc.linspace('wavelength', 4, 8, 20, unit='angstrom'),\n",
" detector_position=dg['mantle'].coords['position']['strip', ::4]['wire', ::2].copy(),\n",
" quadrature_kind='cheap',\n",
")\n",
"\n",
"transmission_fraction.coords['position'] = transmission_fraction.coords.pop('detector_position')\n",
"dream.instrument_view(transmission_fraction.transpose((*set(transmission_fraction.dims) - {'wavelength'}, 'wavelength')), dim='wavelength')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "17",
"metadata": {},
"outputs": [],
"source": [
"transmission_fraction"
]
}
],
"metadata": {
Expand Down