Comparison between ROI sum and fitted results on isolated peak


In [25]:
%matplotlib notebook
import matplotlib.pyplot as plt
import numpy as np
import h5py
from IPython.display import Image

In [31]:
# Full sepctrum
Image("image_spectrum_48706.png")


Out[31]:

In [32]:
# Zoom in to only Ca peak, isolated peak
Image("Ca_spectrum_48706.png")


Out[32]:

In [11]:
# load fitted data

In [8]:
filen = "output_txt_scan2D_48816/detsum_Ca_K_48816.txt"

In [9]:
ca_fit = np.loadtxt(filen)

In [10]:
fig, ax = plt.subplots()
ax.imshow(ca_fit)


Out[10]:
<matplotlib.image.AxesImage at 0x117b01358>

In [12]:
# load experimental data

In [13]:
with h5py.File("scan2D_48816.h5") as f:
    d = f['xrfmap/detsum/counts'][:]

In [14]:
d.shape


Out[14]:
(110, 110, 4096)

In [16]:
# range for Ca element
low = 350
high = 410

In [17]:
ca_sum = np.sum(d[:,:,low:high], axis=2)

In [18]:
fig, ax = plt.subplots()
ax.imshow(ca_sum)


Out[18]:
<matplotlib.image.AxesImage at 0x117f643c8>

In [22]:
# compare ROI sum and fitted results

In [24]:
fig, ax = plt.subplots()
ax.plot(ca_sum[60, :], label='ROI sum')
ax.plot(ca_fit[60, :], label='fitted')
plt.legend()


Out[24]:
<matplotlib.legend.Legend at 0x117d30160>

In [ ]: