##PURPOSE:
## To plot the value of volcano pixels with the regular pixels
##
##

from Volcano_Extract_Database import *
execfile('/afs/slac/u/ki/lances/python/python_HxRG/HxRG_Setup.py')

PlotDir = '/nfs/slac/g/ki/ki03/lances/H1RG-022/Plots/Volcanos/'

#I FILTER
VPixIDs, VXPixs, VYPixs, VTypes, VFRs, VSlopes, VVSUBs, VFilters = \
  Volcano_Extract_Database(QueryStr="FILTER = 'I' and VSUB !=-1 and TYPE=0")
GPixIDs, GXPixs, GYPixs, GTypes, GFRs, GSlopes, GVSUBs, GFilters = \
  Volcano_Extract_Database(QueryStr="FILTER = 'I' and VSUB !=-1 and TYPE=1")

mplot.figure(0)
mplot.clf()
mplot.plot(VVSUBs, VSlopes, 'ro', label='Volcano Pixels (Hot)')
mplot.plot(GVSUBs, GSlopes, 'bo', label='Good Pixels')
mplot.xlabel('VSUB (V)')
mplot.ylabel('Slope (ADU/s)')
mplot.title('I Filter')
mplot.legend(loc=2, numpoints=1)
mplot.savefig(PlotDir+'IFilterVolcanos_H1RG-022.png')
mplot.savefig(PlotDir+'IFilterVolcanos_H1RG-022.eps')

#Y FILTER
VPixIDs, VXPixs, VYPixs, VTypes, VFRs, VSlopes, VVSUBs, VFilters = \
  Volcano_Extract_Database(QueryStr="FILTER = 'Y' and VSUB !=-1 and TYPE=0")
GPixIDs, GXPixs, GYPixs, GTypes, GFRs, GSlopes, GVSUBs, GFilters = \
  Volcano_Extract_Database(QueryStr="FILTER = 'Y' and VSUB !=-1 and TYPE=1")

mplot.figure(1)
mplot.clf()
mplot.plot(VVSUBs, VFRs, 'ro')
mplot.plot(GVSUBs, GFRs, 'bo')
mplot.xlabel('VSUB')
mplot.ylabel('Slope')
mplot.title('Y Filter')

#Y FILTER 
VPixIDs, VXPixs, VYPixs, VTypes, VFRs, VSlopes, VVSUBs, VFilters = \
  Volcano_Extract_Database(QueryStr="FILTER = 'G' and VSUB !=-1 and TYPE=0")
GPixIDs, GXPixs, GYPixs, GTypes, GFRs, GSlopes, GVSUBs, GFilters = \
  Volcano_Extract_Database(QueryStr="FILTER = 'G' and VSUB !=-1 and TYPE=1")
 
mplot.figure(2)
mplot.clf() 
mplot.plot(VVSUBs, VFRs, 'ro')
mplot.plot(GVSUBs, GFRs, 'bo')
mplot.xlabel('VSUB')
mplot.ylabel('Slope')
mplot.title('G Filter')



