def testLoadBeammap(): ''' Test if a remapped beammap is actually remapped ''' #open an obs file from PAL2012,the sky file for hr9087 #we'll use the embedded beammap file, which has some misplaced pixels run = 'PAL2012' date = '20121210' obsTimestamp = '20121211-051650' obsFN = FileName(run=run,date=date,tstamp=obsTimestamp) obsFileName = obsFN.obs() obs = ObsFile(obsFileName) beammapFileName = obsFN.beammap() #load the PixelMap for PAL2012 to know which pixels should be remapped pixMap = remapPixels.PixelMap(obsFN.pixRemap()) pixMapSourceList,pixMapDestList = pixMap.getRemappedPix() #load the corrected beammap into the obs obs.loadBeammapFile(beammapFileName) #check that each pixel that should be moved is moved #by comparing the embedded beammap and the loaded corrected one for source,dest in zip(pixMapSourceList,pixMapDestList): assert obs.beamImage[dest] == obs.file.root.beammap.beamimage[source] obs.file.close()
from util.ObsFile import ObsFile from util.FileName import FileName run = "PAL2014" date = "20141022" timeStamp = '20141023-033821' fn = FileName(run,date,timeStamp) of = ObsFile(fn.obs()) of.loadBeammapFile(fn.beammap()) of.loadBestWvlCalFile() print "wvlCalFileName=",of.wvlCalFileName fn2 = FileName(run,date,"") of.loadFlatCalFile(fn2.flatSoln()) row = 4 col = 4 firstSec = 72 integrationTime = 1 spec = of.getPixelSpectrum(row,col,firstSec,integrationTime) print "spec=",spec del of