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 save_maps(hmap, root_name, telescope): for res in resolutions[telescope]: shape, wcs = get_geometry(res, bounds_deg=bounds[telescope]) imap = ivar_hp_to_cyl(hmap, shape, wcs) if comm.rank == 0: oname = cr_remote_data.get_local_output( f"{root_name}_CAR_{res:.2f}_arcmin.fits") enmap.write_map(oname, imap) os.system(f"gzip -f {oname}") plots = enplot.get_plots(enmap.downgrade(imap, 8)) savename = cr_remote_data.get_local_output( f"rmap_{root_name}_{res:.2f}") enplot.write(savename, plots) print(f"Plot saved to {savename}")
def test_enplot(self): print("Testing enplot...") shape, wcs = enmap.geometry(pos=(0, 0), shape=(3, 100, 100), res=0.01) a = enmap.ones(shape, wcs) p = enplot.get_plots(a)
def eshow(x, fname): ''' Define a function to help us plot the maps neatly ''' plots = enplot.get_plots(x, downgrade=1) enplot.write(f"/scratch/r/rbond/jiaqu/plots/{fname}.png", plots)