def s18dStamp(ra, dec, data, name, width=0.5, write=True): #Find tile corresponding to RA, Dec path = '/scratch/r/rbond/jorlo/S18d_202006/filteredMaps/' tileName = tileFinder(ra, dec, data) if tileName == None: return None tile = enmap.read_map(path + tileName + '/Arnaud_M2e14_z0p4#' + tileName + '_filteredMap.fits') stamp = reproject.postage_stamp(tile, ra, dec, width * 60, 0.5) if write: #tempdec, tempra = np.deg2rad([dec, ra]) #tempwid = np.deg2rad(width) #box = [[tempdec-tempwid,tempra-tempwid],[tempdec+tempwid,tempra+tempwid]] #stampgeo = tile.submap(box) box = np.array([[ra - width / 2, dec - width / 2], [ra + width / 2, dec + width / 2]]) * utils.degree shape, wcs = enmap.geometry(pos=box, res=0.5 * utils.arcmin, proj='car') print(shape) #print(stampgeo.wcs) #print(stamp.wcs) stamp.wcs = wcs print(stamp.wcs) print(stamp[0].shape) #plt.imshow(stamp[0]) #plt.show() #Return map plot = enplot.plot(stamp, mask=0) enplot.show(plot) enmap.write_map('./for_tony/{}.fits'.format(name), stamp) return stamp
def hplot(img, savename=None, verbose=True, grid=False, **kwargs): from pixell import enplot plots = enplot.get_plots(img, grid=grid, **kwargs) if savename is None: enplot.show(plots) return enplot.write(savename, plots) if verbose: cprint("Saved plot to " + savename, color="g")
def plot(fname,imap,dg=4,grid=False,**kwargs): from orphics import io img = enplot.plot(enmap.downgrade(imap,dg),grid=grid,**kwargs) if fname is None: enplot.show(img) else: enplot.write(fname,img) print(io.bcolors.OKGREEN+"Saved high-res plot to", fname+io.bcolors.ENDC)
def eshow(x, **kwargs): enplot.show(enplot.plot(x, downgrade=4, **kwargs))