Skip to content

Commit

Permalink
minor edits
Browse files Browse the repository at this point in the history
  • Loading branch information
fligt committed Jun 14, 2024
1 parent a023e10 commit 50bdbd6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
4 changes: 2 additions & 2 deletions maxrf4u/warp.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# %% auto 0
__all__ = ['ImageRegistrationHelper', 'warp', 'xy_to_latlon', 'latlon_to_xy']

# %% ../notebooks/30_spatial-verus-spectral.ipynb 36
# %% ../notebooks/30_spatial-verus-spectral.ipynb 35
from ipywidgets import Layout, HBox, VBox
#import ipywidgets

Expand All @@ -26,7 +26,7 @@
import numpy as np
import cv2

# %% ../notebooks/30_spatial-verus-spectral.ipynb 37
# %% ../notebooks/30_spatial-verus-spectral.ipynb 36
class ImageRegistrationHelper(object):
'''Create interactive image registration. '''

Expand Down
18 changes: 3 additions & 15 deletions notebooks/30_spatial-verus-spectral.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,6 @@
"> Lasagna versus spaghetti "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#|hide \n",
"%load_ext autoreload\n",
"%autoreload 2 \n",
"%matplotlib notebook"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -75,9 +63,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"In the previous sections we have converted and calibrated the original `.raw` spectral image data file into an analysis ready `.datastack` file. We will now gently start to learn how this three dimensional data cube is structured. Basically there are two ways to look at this data. One perspective is to think of the data cube as a stack of gray scale images. Every image has a different energy associated with it. If you remember from the previous section, these energies are the X-ray photon energies, expressed in kilo electron Volts (keV). Each image in the stack contains a distribution of intensities (photon counts). This is the lasagna view. \n",
"In the previous sections we have converted and calibrated the original `.raw` spectral image data file into an analysis ready `.datastack` file. We will now gently start to learn how this three dimensional data cube is structured. Basically there are two ways to look at this data. One perspective is to think of the data cube as a stack of gray scale images. Every image has a different energy associated with it. If you remember from the previous section, these energies are the X-ray photon energies, expressed in kilo electron Volts (keV). Each image in the stack contains a distribution of intensities (photon counts). This is the *lasagna view*. \n",
"\n",
"Another way to think of the same data cube is to describe it as a rectangular bundle of spectra. At each spatial *(x,y)* location the data cube contains a spectrum with varying intensity along the third dimension *(z)* of the cube. This is the spaghetti view. We will come back to this in the next section.\n",
"Another way to think of the same data cube is to describe it as a rectangular bundle of spectra. At each spatial *(x,y)* location the data cube contains a spectrum with varying intensity along the third dimension *(z)* of the cube. This is the *spaghetti view*. We will come back to this in the next section.\n",
"\n",
"Very roughly speaking, the spatial intensity distribution within a slice located at a specific peak energy band represents the spatial distribution of a certain chemical element. For a start we can take a look at the largest peak in the max spectrum. This peak in the energy range of 6.1-6.7 keV is caused by the presence of the chemical element iron in the drawing. Because it is the largest peak, is is called the Fe_Ka (alpha) peak. Without prior knowledge of XRF physics (we will get to this topic later on) we can compute peak slice map for this energy band. \n",
"\n",
Expand Down Expand Up @@ -185,7 +173,7 @@
"metadata": {},
"outputs": [],
"source": [
"FeKa_slice = cube[:,:,is_iron_Ka_band].compute() # load only this slice into memory \n",
"FeKa_slice = cube[:,:,is_iron_Ka_band].compute() # load only this slice into memory (take 20 seconds)\n",
"FeKa_map = FeKa_slice.sum(axis=2) / 60 # average over number of channels in the Fe_Ka band "
]
},
Expand Down

0 comments on commit 50bdbd6

Please sign in to comment.