ob.loadFlatCalFile(flatCalFilenames[0])
ob.loadFluxCalFile(fluxCalFileNames[0])

#load/generate hot pixel mask file
HotPixFile = getTimeMaskFileName(obsFn)
if not os.path.exists(HotPixFile):
    hp.findHotPixels(obsFn,HotPixFile)
    print "Flux file pixel mask saved to %s"%(HotPixFile)
ob.loadHotPixCalFile(HotPixFile)
print "Hot pixel mask loaded %s"%(HotPixFile)

frame = ob.getPixelCountImage(firstSec=0,integrationTime=300,weighted=True)
#hotPixMask = hotPixels.checkInterval(image=frame, firstSec=0, intTime=300, weighted=True, display=False)['mask']

#summed_array,bin_edges=ob.getApertureSpectrum(pixelCol=14,pixelRow=8,radius=7)
ob.plotApertureSpectrum(pixelCol=14,pixelRow=8,radius=7,weighted = True,fluxWeighted=True,lowCut=3000,highCut=9000)


'''
h = 6.626068*10**-34
c = 299792458.0
k = 1.3806503*10**-23
T = 10000.0

numerator = 6*10**-29
denominator= (bin_edges*10**-10)**5*(np.exp(((h*c)/(bin_edges*k*T*10**-10))) - 1)
bbcurve = numerator/denominator
#print bbcurve


fig = plt.figure()