In [24]:
%matplotlib notebook
import numpy as np
import matplotlib.pyplot as plt
import os
from pyxrf.api import stitch_fitted_results
In [6]:
wd = '/Users/Li/Downloads/xrf_data/Feng_Mar2016/'
This working direction should contain multiple folders saving fitted results from different runs. This is the standard output form pyxrf when you select output to txt or tiff.
In [11]:
ls /Users/Li/Downloads/xrf_data/Feng_Mar2016/
In [17]:
datalist1 = np.arange(6780, 6786)
datalist2 = np.arange(6790, 6796)
datalist = np.concatenate((datalist1, datalist2))
folderlist = ['output_txt_scan2D_'+str(v) for v in datalist]
print(folderlist)
Combine fitted results together from selected folders, and output as a dictionary. We can also use keyword "output", so the stitched result will be saved to the output folder. Please note that every file in the output folder contains 1D array.
In [18]:
out = stitch_fitted_results(wd, folderlist, output='stitched_test')
In [20]:
out.keys()
Out[20]:
x, y positions need to be defined. Use scatter plot from matplotlib
In [21]:
xpos = out['x_pos']
ypos = out['y_pos']
ic = out['sclr1_ch4']
intensity = out['detsum_Cl_K']
intensity /= ic
In [26]:
fig, ax = plt.subplots()
ax.scatter(xpos, ypos, c=intensity,
marker='s', s=10, alpha=0.8, linewidths=1, linewidth=0)
ax.set_xlabel('x [um]')
ax.set_ylabel('y [um]')
ax.set_title('Cl')
Out[26]:
In [ ]: