from herschel.pacs.spg.phot import PhotHelper """ Obtain the wcs """ obsids = [1342212284, 1342212285, 1342199776, 1342199777, 1342201124, 1342201125, 1342212357, 1342212358, 1342212433, 1342212434, 1342224141, 1342224032] fitsFile = dataDir + str(obsids[0]) + "-" + str(obsids[1]) + "-red-aligned.fits" mergedFrames = FitsArchive().load(fitsFile) for i in range(len(obsids)/2 - 1): fitsFile = dataDir + str(obsids[2*(i+1)]) + "-" + str(obsids[2*(i+1) + 1]) + "-red-aligned.fits" mergedFrames.join(FitsArchive().load(fitsFile)) pixfrac = 0.1 outputPixelSize= 3.2 crota = 0 calTree = getCalTree(obs=getObservation(obsids[0], useHsa=True, instrument="PACS")) wcs = wcs4map(mergedFrames, outputPixelsize=outputPixelSize, crota=crota, calTree=calTree) fitsFile = dataDir + str(obsids[0]) + "-" + str(obsids[1]) + "-red-aligned.fits" mergedFrames = FitsArchive().load(fitsFile) map, mi = photProject(mergedFrames, outputPixelsize=outputPixelSize, pixfrac=pixfrac, calTree=calTree, wcs=wcs) wcs = map.getWcs() """ Define the tiles information """ tiles = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] tileStartCol = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] tileStartRow = [ 0, 9, 19, 29, 39, 49, 59, 69, 79, 64] tileColSize = [20, 20, 20, 20, 20, 20, 20, 20, 20, 20] tileRowSize = [11, 12, 12, 12, 12, 12, 7, 12, 11, 7] nCols = 20 nRows = 90 """ Create the tile maps """ for tile in tiles: print "tile: " + str(tile) maskedMap = PhotHelper.createTileMask(map, tileStartCol[tile], tileStartRow[tile], tileColSize[tile], tileRowSize[tile], nCols, nRows) execfile(scriptsDir + "createTileMaps.py") """ Combine the tiles """ tiles = [ 0, 1, 2, 3, 4, 5, 6, 9, 7, 8] tileStartCol = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] tileStartRow = [ 0, 10, 20, 30, 40, 50, 60, 70, 80, 65] tileColSize = [20, 20, 20, 20, 20, 20, 20, 20, 20, 20] tileRowSize = [10, 10, 10, 10, 10, 10, 5, 10, 10, 5] nCols = 20 nRows = 90 cameraName = "red" execfile(scriptsDir + "combineTiles.py") cameraName = "green" execfile(scriptsDir + "combineTiles.py") """ Remove the maps offset """ redMap = FitsArchive().load(dataDir + "virgo-red.fits") greenMap = FitsArchive().load(dataDir + "virgo-green.fits") redOffset = 0.00230166489367 greenOffset = 0.0254207761668 PhotHelper.removeOffset(redMap, redOffset) PhotHelper.removeOffset(greenMap, greenOffset) FitsArchive().save(dataDir + "virgo-red-corr.fits", redMap) FitsArchive().save(dataDir + "virgo-green-corr.fits", greenMap) """ Create the RGB maps. The png images will be saved in dataDir """ maxSignal = 0.7 exponent = 1.0 multiplicativeFactor = 17 rgbMap = PhotHelper.createRgbMap(redMap, greenMap, maxSignal, exponent, multiplicativeFactor) d = Display(rgbMap) d.saveAsJPG(dataDir + "virgo.jpg") d.saveAsPNG(dataDir + "virgo.png")