# Define working directory and json file
working_dir = '/data/users/2016Q3/Gill_2016Q3/' 

# Define a list of h5 files which should stay in the working directory.
datalist = np.arange(16715, 16808)
filelist = ['scan2D_'+str(n)+'.h5' for n in datalist]  

# Parameter file to fit all the data.
param_file = 'parameter_data.json'       

# Pixel fitting for all the files. If ic_name is given, 
# data will be also normalized based on ion chamber value. 
for fname in filelist:
    fit_pixel_data_and_save(working_dir, fname, 
                            param_file_name=param_file, 
                            save_txt=True, ic_name='sclr1_ch4')

"""
Explanation: Batch mode to fit data from multiple runs
Users need to have .json file ready in order to do batch mode fitting.
End of explanation
"""


element_list = ['Cu_K','Fe_K']
d3 = combine_data_to_recon(element_list, datalist, working_dir)

d3.keys()

# create movie for Fe
create_movie(d3['Fe_K'], 'data3d_Fe.mp4')

# create movie for Cu
create_movie(d3['Cu_K'], 'data3d_Cu.mp4')

"""
Explanation: Combine data into 3D array for reconstruction
End of explanation
"""


