#bias correction
	data_corr[key+'_reflectance'] = IR_analysis.bias_correct(data[key+'_reflectance'], data_bias[key+'_reflectance'])
	print 'finished reading file: ', key

print 'plotting...'


#########################################################
#plot IR spectra

#Four Windows comparison
#example of a single spectrum plot
#(wavelength, reflectance, xrange, title, save file, smoothing integer)
###########################################################
#replace "data_corr" with "data" if not use bias correction
IR_plot.plot_IR_spectrum(np.array(data['FW203_orange_01_wavelength']), np.array(data_corr['FW203_orange_01_reflectance']), [1.6,3.6], 'FW203: cashbox (no smoothing)', 'output/FW203_cashbox.png', 1)

#with smoothing
IR_plot.plot_IR_spectrum(np.array(data['FW203_orange_01_wavelength']), np.array(data_corr['FW203_orange_01_reflectance']), [1.6,3.6], 'FW203: cashbox (boxcar smooth size: 10)', 'output/FW203_cashbox_smooth.png', 10)


#example of multiple spectra (2) plot
#([wavelength1, wavelength2, ...], [reflectance1, reflectance2, ...], xrange, title, save file, legend, smoothing integer)
IR_plot.plot_IR_spectra([np.array(data['FW205_dark_01_wavelength']), np.array(data['FW205_white_01_wavelength'])], [np.array(data_corr['FW205_dark_01_reflectance']), np.array(data_corr['FW205_white_01_reflectance'])], [1.6,3.6], 'FW205 Comparison IR spectrum: cashbox (no smoothing)', 'output/FW205_cashbox.png', ['dark', 'white'], 1)

#example of multiple spectra (2) plot
IR_plot.plot_IR_spectra([np.array(data['PL_FW205_dark_01_wavelength']), np.array(data['PL_FW205_white_01_wavelength'])], [np.array(data_corr['PL_FW205_dark_01_reflectance']), np.array(data_corr['PL_FW205_white_01_reflectance'])], [1.6,3.6], 'FW205 Comparison IR spectrum: PASA-Lite (no smoothing)', 'output/FW205_PL.png', ['dark', 'white'], 1)


#example of multiple spectra (4) plot
#compare FW205 cashbox, PASA-lite
	key=file.split('samples/',1)[-1]
	key=key.rstrip('.asc')
	#store wavelength and reflectance data in key
	data[key+'_wavelength']=[]
	data[key+'_reflectance']=[]
	#obtain Infragold calibrated data
	data[key+'_wavelength'], data[key+'_reflectance'] = IR_analysis.calibrate_data_USGS(file)
	print 'finished reading file: ', key
	IR_analysis.write_file(key, data[key+'_wavelength'], data[key+'_reflectance'])

print 'plotting...'

#example of a single spectrum plot
#(wavelength, reflectance, xrange, title, save file, smoothing integer)
#Goethite
IR_plot.plot_IR_spectrum(np.array(data['Geothite_avg_Corrected_Results_wavelength']), np.array(data['Geothite_avg_Corrected_Results_reflectance']), [1.6,3.6], '', 'output/Goethite.png', 2)

#example of multiple spectra (2) plot
#([wavelength1, wavelength2, ...], [reflectance1, reflectance2, ...], xrange, title, save file, legend, smoothing integer)
IR_plot.plot_IR_spectra([np.array(data['gypsum_vacuum_1_day_wavelength']), np.array(data['gypsum_vacuum_5days_wavelength'])], [np.array(data['gypsum_vacuum_1_day_reflectance']), np.array(data['gypsum_vacuum_5days_reflectance'])], [1.6,3.6], ' ', 'output/gypsum_vacuum_comparison.png', ['1 day in vacuum', '5 days in vacuum'], 2)

#epsomite
IR_plot.plot_IR_spectrum(np.array(data['epsomite_powder_wavelength']), np.array(data['epsomite_powder_reflectance']), [1.6,3.6], '', 'output/epsomite_powder.png', 2)

#jarosite
IR_plot.plot_IR_spectrum(np.array(data['Jarosite_avg_wavelength']), np.array(data['Jarosite_avg_reflectance']), [1.6,3.6], '', 'output/jarosite.png', 2)

#FSC gypsum
IR_plot.plot_IR_spectrum(np.array(data['FS050_jagged_no_board_2_avereaged_wavelength']), np.array(data['FS050_jagged_no_board_2_avereaged_reflectance']), [1.6,3.6], '', 'output/FSC_gypsum.png', 2)

#Montmorillonite