lat0, lon0 = opts.lat0, opts.lon0 hpx_beam, hpx_counts, hpx_rms = make_beam(lats, lons, alts, spec_raw, lat0=lat0, lon0=lon0, nsides=opts.nsides) # Cuts and beam plot initializations gsr = gridspec.GridSpec(2, 1, height_ratios=[1, 1]) plot_lim = [-40, 5] # Beam plot initialization beam_plot = fig.add_subplot(gsr[0], aspect='equal') coll = make_polycoll(hpx_beam, nsides=opts.nsides) #,plot_lim=[-90,-50]) beam_plot.add_collection(coll) beam_plot.autoscale_view() # Position colorbar next to plot with same height as plot divider = make_axes_locatable(beam_plot) cax = divider.append_axes("right", size="5%", pad=0.05) cbar = fig.colorbar(coll, cax=cax, use_gridspec=True, label='dB') #cbar.set_clim([-90,-50]) for radius_deg in [20, 40, 60, 80]: r = np.sin(radius_deg * np.pi / 180.) x = np.linspace(-r, r, 100) beam_plot.plot(x, np.sqrt(r**2 - x**2), 'w-', linewidth=3) beam_plot.plot(x, -np.sqrt(r**2 - x**2), 'w-', linewidth=3)
# Make beam, counts, and rms from gridded data # grid_data(...) called in make_beam(...) if opts.lat0 and opts.lon0: lat0,lon0 = opts.lat0,opts.lon0 hpx_beam,hpx_counts,hpx_rms = make_beam(lats,lons,alts,spec_raw, lat0=lat0, lon0=lon0, nsides=opts.nsides) # Cuts and beam plot initializations gsr = gridspec.GridSpec(2, 1,height_ratios=[1,1]) plot_lim = [-40,5] # Beam plot initialization beam_plot = fig.add_subplot(gsr[0],aspect='equal') coll = make_polycoll(hpx_beam,nsides=opts.nsides)#,plot_lim=[-90,-50]) beam_plot.add_collection(coll) beam_plot.autoscale_view() # Position colorbar next to plot with same height as plot divider = make_axes_locatable(beam_plot) cax = divider.append_axes("right", size="5%", pad=0.05) cbar = fig.colorbar(coll, cax=cax, use_gridspec=True, label='dB') #cbar.set_clim([-90,-50]) for radius_deg in [20,40,60,80]: r = np.sin(radius_deg*np.pi/180.) x = np.linspace(-r,r,100) beam_plot.plot(x,np.sqrt(r**2-x**2),'w-',linewidth=3) beam_plot.plot(x,-np.sqrt(r**2-x**2),'w-',linewidth=3)
# Setup figure fig = figure(figsize=(18,10)) gs = gridspec.GridSpec(2,4) # Setup base_beam(rms) base_beam = hp.read_map(opts.base_beam) base_beam = hp.ma(base_beam,badval=badval) base_rms = hp.read_map(opts.base_beam.replace('beam','rms')) base_rms = hp.ma(base_rms,badval=badval) base_slice_H = get_interp_val(base_beam,ell,az) base_slice_H_err = get_interp_val(base_rms,ell,az) base_slice_E = get_interp_val(base_beam,ell,az+np.pi/2) base_slice_E_err = get_interp_val(base_rms,ell,az+np.pi/2) base_coll = make_polycoll(base_beam,nsides=opts.nsides) # Setup adj_beam(rms) adj_beam = hp.read_map(opts.adjusted_beam) adj_beam = hp.ma(adj_beam,badval=badval) adj_rms = hp.read_map(opts.adjusted_beam.replace('beam','rms')) adj_rms = hp.ma(adj_rms,badval=badval) adj_slice_H = get_interp_val(adj_beam,ell,az) adj_slice_H_err = get_interp_val(adj_rms,ell,az) adj_slice_E = get_interp_val(adj_beam,ell,az+np.pi/2) adj_slice_E_err = get_interp_val(adj_rms,ell,az+np.pi/2) adj_coll = make_polycoll(adj_beam,nsides=opts.nsides) # Adjust adj_beam