In [ ]:
%matplotlib notebook
import numpy as np
import matplotlib.pyplot as plt
import os
from pyxrf.model.command_tools import fit_pixel_data_and_save

In [2]:
wd = '/Users/Li/Research/Experiment/twin_boundary_stitch'   # contains all the h5 file and parameter .json file

In [3]:
num = np.arange(2468, 2471)
filelist = [str(n)+'.h5' for n in num]     # define all the h5 files

Batch mode to fit spectrum from detector sum

if the detector is well aligned, you can fit the summed spectrum from each detector


In [4]:
param_file = '2468_fitting.json'       # parameter file to fit all the data

In [ ]:
for fname in filelist:
    fit_pixel_data_and_save(wd, fname, param_file_name=param_file)

Batch mode to fit spectrum from individual detector


In [ ]:
param_file = '2468_fitting.json'             # parameter file to fit data from detector summed
param_file1 = '2468_fitting_det1.json'       # parameter file to fit data from detector 1
param_file2 = '2468_fitting_det2.json'       # parameter file to fit data from detector 2
param_file3 = '2468_fitting_det2.json'       # parameter file to fit data from detector 3
paramlist = [param_file1, param_file2, param_file3]

You can also turn on paramter save_txt, save_tiff(default as true), so pyxrf will output txt and tiff files.


In [ ]:
for fname in filelist:
    fit_pixel_data_and_save(wd, fname, param_file_name=param_file, fit_channel_each=True, param_channel_list=paramlist,
                            save_txt=True, save_tiff=True)

Batch mode to fit spectrum with given incident energy


In [2]:
param_file = '2468_fitting.json'       # parameter file to fit the data
fname = 'scan_2468.h5'
energy = 10                            # incident energy at KeV

In [ ]:
fit_pixel_data_and_save(wd, fname, param_file_name=param_file, incident_energy=energy)