from __future__ import print_function
import sys
import matplotlib.pyplot as plt
import fabio
import pyFAI

def main(file_list):
    ai = pyFAI.AzimuthalIntegrator()
    ai.load('calibration/Al2O3_detx_minus75/Al2O3_cumu_0000.poni')
    ai.maskfile = 'calibration/total_mask.edf'
    
    for f in file_list:
        data = fabio.open(f).data
        q, I = ai.integrate1d(data, 2000, unit='q_nm^-1')
        plt.plot(q, I)
        
    plt.show()
  
if __name__ == '__main__':
    if len(sys.argv) < 2:
        print('usage: python integrate.py <your_files.py>')
        sys.exit(0)
    else:
        main(sys.argv[1:])
    
    
