Y, Bx, By, pivot='middle', headlength=0, headaxislength=0, width=0.001, color=color, transform=ax.get_transform('world'), scale=args.scale) # plotting if front: im_front = ax.imshow(back, **opts) ######## # axis # ######## if args.axis: ax.set_xlabel('$l$') ax.set_ylabel('$b$') ax.set_aspect('equal') else: ax.axis('off') plt.tight_layout() # colorbar if args.colorbar: cax = plotstyle.add_colorbar(fig, ax, size="2%") fig.colorbar(im_back, cax=cax).set_label(label, fontsize=12) if args.title: plt.suptitle(texify(args.title), fontsize=16) ofile = op.join(args.odir, args.oname) print("Writing:", ofile) plt.savefig(ofile, bbox_inches='tight')
'origin': 'lower', 'cmap': args.cmap, # 'extent': box2extent(box)/np.pi*180 } # row 0: f090 plotstyle.setup_axis(axes[0,0], nticks=[10,5], xticks=False, yticks=True) plotstyle.setup_axis(axes[0,1], nticks=[10,5], xticks=False, yticks=False) plot_opts.update({'vmin': args.min_f090, 'vmax': args.max_f090}) imap = load_map(filedb['f090']['coadd'], box, fcode='f090', IAU=args.IAU) qmap = process_map(imap, 'Q') im_f090_q = axes[0,0].imshow(qmap, **plot_opts) umap = process_map(imap, 'U') im_f090_u = axes[0,1].imshow(umap, **plot_opts) # add colorbar if args.sep_colorbar: cb_f090 = plotstyle.add_colorbar(fig, axes[0,1], size="3%") fig.colorbar(im_f090_q, cax=cb_f090, orientation='vertical') cb_f090.yaxis.set_ticks([-0.15,0,0.15]); # row 1: f150 plotstyle.setup_axis(axes[1,0], nticks=[10,5], xticks=False, yticks=True) plotstyle.setup_axis(axes[1,1], nticks=[10,5], xticks=False, yticks=False) plot_opts.update({'vmin': args.min_f150, 'vmax': args.max_f150}) imap = load_map(filedb['f150']['coadd'], box, fcode='f150', IAU=args.IAU) qmap = process_map(imap, 'Q') im_f150_q = axes[1,0].imshow(qmap, **plot_opts) umap = process_map(imap, 'U') im_f150_u = axes[1,1].imshow(umap, **plot_opts) if args.sep_colorbar: cb_f150 = plotstyle.add_colorbar(fig, axes[1,1], size="3%") fig.colorbar(im_f150_q, cax=cb_f150, orientation='vertical').set_label(texify("MJy/sr"), fontsize=14)
xticks, yticks = True, True if j == 0: ax.set_ylabel('$b$') ax.set_xlabel('$l$') plotstyle.setup_axis(ax, fmt="d.d", xticks=xticks, yticks=yticks, nticks=[10, 5]) # load data if j == 0: use = 'act' if j == 1: use = 'coadd' imap = load_map(filedb[freq][use], box, fcode=freq) / 1e9 imap[0, imap[0] < 10**-0.5] = 10**-0.5 im = ax.imshow(imap[0], norm=norm, **plot_opts) cb = plotstyle.add_colorbar(fig, axes[1]) fig.colorbar(im, cax=cb).set_label(texify('Total Intensity [MJy/sr]'), fontsize=14) # setup labels: Planck, ACT+Planck axes[0].text(0.4, 1.05, texify('ACT'), verticalalignment='bottom', horizontalalignment='left', transform=axes[0].transAxes, fontsize=14) axes[1].text(0.35, 1.05, texify('ACT+Planck'), verticalalignment='bottom',
'norm': colors.LogNorm(vmin=1e-5, vmax=1e-2) } else: opts = { 'cmap': 'planck_half', 'vmin': args.min, 'vmax': args.max } # plotstyle.setup_axis(ax, nticks=[10,5], fmt=None) irmap[irmap<0] = 1e-6 im = ax.imshow(irmap, **opts) # add act vectors if args.axis: ax.set_xlabel('$l$') ax.set_ylabel('$b$') ax.set_aspect('equal') else: ax.axis('off') plt.tight_layout() # colorbar if args.colorbar: cax = plotstyle.add_colorbar(fig, ax) fig.colorbar(im, cax=cax).set_label(texify("Total Intensity [MJy/sr]"), fontsize=12) if args.title: plt.suptitle(texify(args.title), fontsize=16) ofile = op.join(args.odir, args.oname) print("Writing:", ofile) plt.savefig(ofile, bbox_inches='tight')
Pa_err= lib.Pangle_error(imap_ds, ivar_ds*s**2, deg=True) mask = Pa_err >= 20 else: print("No mask applied") mask = np.zeros_like(imap_ds) cmap_ = plt.get_cmap('binary') # actual cmap doesn't matter color = cmap_(np.ones_like(X)) color[mask,-1] = 0.3 color[~mask,-1] = args.alpha color=color.reshape(color.shape[0]*color.shape[1],4) ax.quiver(X,Y,Bx,By,pivot='middle', headlength=0, headaxislength=0, color=color, scale=args.scale, transform=ax.get_transform('world')) ax.set_aspect('equal') if args.sep_colorbar: cbar = plotstyle.add_colorbar(fig, ax, size="5%") if i == len(freqs)-1: fig.colorbar(im, cax=cbar).set_label(texify(label), fontsize=14) else: fig.colorbar(im, cax=cbar) if args.show_freq: ax.set_title(freqs[i]) if len(freqs) == 1: axes.set_xlabel('$l$') axes.set_ylabel('$b$') else: if not args.transpose: axes[-1].set_xlabel('l [deg]') axes[-2].set_ylabel('b [deg]') else: axes[0].set_ylabel('b [deg]') axes[0].set_xlabel('l [deg]') axes[-1].set_xticklabels([])