def test_symmetric_log_colorbar_error(self, maps_release_only): map_ = maps_release_only.getMap('emline_gflux', channel='ha_6564') with pytest.raises(AssertionError) as ee: fig, ax = mapplot.plot(dapmap=map_, symmetric=True, log_cb=True) assert ee.value.args[ 0] == 'Colorbar cannot be both symmetric and logarithmic.'
def test_return_cbrange(self, maps_release_only): map_ = maps_release_only.getMap('emline_gflux', channel='ha_6564') cbrange = mapplot.plot(dapmap=map_, return_cbrange=True) assert isinstance(cbrange, list)
def test_plot_matplotlib_style_sheet(self, maps_release_only): map_ = maps_release_only.getMap('emline_gflux', channel='ha_6564') fig, ax = mapplot.plot(dapmap=map_, plt_style='ggplot') assert isinstance(fig, matplotlib.figure.Figure) assert isinstance(ax, matplotlib.axes._axes.Axes)
def test_return_cb(self, maps_release_only): map_ = maps_release_only.getMap('emline_gflux', channel='ha_6564') fig, ax, cb = mapplot.plot(dapmap=map_, return_cb=True) assert isinstance(cb, matplotlib.colorbar.Colorbar)
def test_plot_user_defined_map(self, value, ivar, mask): fig, ax = mapplot.plot(value=value, ivar=ivar, mask=mask) assert isinstance(fig, matplotlib.figure.Figure) assert isinstance(ax, matplotlib.axes._axes.Axes)
def test_plot_matplotlib_rc_restore(self, maps_release_only): rcparams = matplotlib.rc_params() map_ = maps_release_only.getMap('emline_gflux', channel='ha_6564') fig, ax = mapplot.plot(dapmap=map_) assert rcparams == matplotlib.rc_params()
hdu_maps['EMLINE_GVEL_IVAR'].data[emlc['Ha-6564'], :, :], mask=hdu_maps[mask_ext].data[emlc['Ha-6564'], :, :] > 0) mask_ext = hdu_maps['STELLAR_VEL'].header['QUALDATA'] stellar_vfield = np.ma.MaskedArray(hdu_maps['STELLAR_VEL'].data, mask=hdu_maps[mask_ext].data > 0) stellar_vfield_ivar = np.ma.MaskedArray(hdu_maps['STELLAR_VEL_IVAR'].data, mask=hdu_maps[mask_ext].data > 0) #Plot map of binids, emission line velocities, etc fig, axes = pl.subplots(1, 3, figsize=(12, 4)) rand_cmap = mcol.ListedColormap(np.random.rand(400, 3)) mapplot.plot(value=binid, title='Bin ID', cmap=rand_cmap, fig=fig, ax=axes[0], cbrange=[0, 315]) mapplot.plot(value=emission_vfield, title='Emission Line Velocity', cmap=cm.coolwarm, cbrange=[-120, 120], fig=fig, ax=axes[1]) mapplot.plot(value=stellar_vfield, title='Stellar Velocity', cmap=cm.coolwarm, cbrange=[-120, 120], fig=fig,
def test_plot_dapmap(self, maps_release_only, property_name, channel): map_ = maps_release_only.getMap(property_name, channel=channel) fig, ax = mapplot.plot(dapmap=map_) assert isinstance(fig, matplotlib.figure.Figure) assert isinstance(ax, matplotlib.axes._axes.Axes)
maps_file = glob.glob( sas_dir + '/mangawork/manga/spectro/analysis/v2_0_1/SPX-GAU-MILESHC/' + plate + '/*/manga-*MAPS-SPX-GAU*') filename = 'ad_marvin_subplot.pdf' with PdfPages(filename) as pdf: for i in range(0, len(maps_file)): maps = Maps(filename=maps_file[i]) print(maps) fig = plt.figure() ax = fig.add_subplot(2, 2, 1) haf = maps['emline_sflux_ha_6564'] mapplot.plot(dapmap=haf, fig=fig, ax=ax) ax = fig.add_subplot(2, 2, 2) o2f = maps['emline_sflux_oiid_3728'] mapplot.plot(dapmap=o2f, fig=fig, ax=ax) ax = fig.add_subplot(2, 2, 3) o2v = maps['emline_gvel_oiid_3728'] mapplot.plot(dapmap=o2v, fig=fig, ax=ax) ax = fig.add_subplot(2, 2, 4) o2s = maps['emline_gsigma_oiid_3728'] mapplot.plot(dapmap=o2s, fig=fig, ax=ax) plt.suptitle(maps_file[i])
trash={} cb_kws={} junk={} trash['size']=10 trash['label']='[O II]/H-alpha' junk['labelsize']=10 cb_kws['tick_params_kws']=junk cb_kws['label_kws']=trash # page 1 # plots multiple things, which we will plot multiple examples for each in the next pages fig = plt.figure() # h-alpha emission-gas ax = fig.add_subplot(2,2,1) haf = maps['emline_sflux_ha_6564'] mapplot.plot(dapmap=haf, fig=fig, ax=ax, cb_kws=cb_kws, log_cb=1, cbrange=(0.1,100)) #[O II] emission-gas ax = fig.add_subplot(2,2,2) o2f = maps['emline_sflux_oiid_3728'] mapplot.plot(dapmap=o2f, fig=fig, ax=ax, cb_kws=cb_kws, log_cb=1, cbrange=(0.1,100)) # plot of [O II] velocity ax = fig.add_subplot(2,2,3) o2v = maps['emline_gvel_oiid_3728'] mapplot.plot(dapmap=o2v, fig=fig, ax=ax, cb_kws=cb_kws) #log_cb=1, cbrange=(0.1,100)) #log_cb=1 IS NOT WORKING # velocity dispersion [O II] ax = fig.add_subplot(2,2,4) o2s = maps['emline_gsigma_oiid_3728'] mapplot.plot(dapmap=o2s, fig=fig, ax=ax, cb_kws=cb_kws, log_cb=1) #cbrange=(0.1,100)) #the range gives a very weird full yellow plot plt.suptitle(maps_file[i]) # the number corresponds to their wavelength in A* fig.tight_layout()
def test_set_hatch_color(self, maps_release_only): map_ = maps_release_only.getMap('emline_gflux', channel='ha_6564') fig, ax = mapplot.plot(dapmap=map_) assert matplotlib.rcParams['hatch.color'] == 'w'
maps_file = glob.glob( sas_dir + '/mangawork/manga/spectro/analysis/v2_0_1/SPX-GAU-MILESHC/' + plate + '/*/manga-*MAPS-SPX-GAU*') filename = 'ad_marvin_subplot.pdf' with PdfPages(filename) as pdf: for i in range(0, 1): #len(maps_file)): maps = Maps(filename=maps_file[i]) print(maps) fig = plt.figure() ax = fig.add_subplot(2, 2, 1) haf = maps['emline_sflux_ha_6564'] mapplot.plot(dapmap=haf, fig=fig, ax=ax) cb_kws = {} cb_kws['vmin'] = 0.1 cb_kws['vmax'] = 10. cb_kws['ticks'] = [0.3, 1, 3] cb_kws['size'] = 10. ax = fig.add_subplot(2, 2, 2) o2f = maps['emline_sflux_oiid_3728'] mapplot.plot(dapmap=o2f, fig=fig, ax=ax, cb_kws=cb_kws, log_cb=1, cbrange=(0.1, 100))
maps_file = glob.glob( sas_dir + '/mangawork/manga/spectro/analysis/v2_0_1/SPX-GAU-MILESHC/' + plate + '/*/manga-*MAPS-SPX-GAU*') filename = 'jmr_marvin_subplot.pdf' with PdfPages(filename) as pdf: for i in range(0, len(maps_file)): maps = Maps(filename=maps_file[i]) print(maps) # page one plots multiple things, which we will plot multiple examples for each in the next pages fig = plt.figure() # h-alpha emission-gas ax = fig.add_subplot(2, 2, 1) haf = maps['emline_sflux_ha_6564'] mapplot.plot(dapmap=haf, fig=fig, ax=ax) #[O II] emission-gas ax = fig.add_subplot(2, 2, 2) o2f = maps['emline_sflux_oiid_3728'] mapplot.plot(dapmap=o2f, fig=fig, ax=ax) # plot of [O II] velocity ax = fig.add_subplot(2, 2, 3) o2v = maps['emline_gvel_oiid_3728'] mapplot.plot(dapmap=o2v, fig=fig, ax=ax) # velocity dispersion [O II] ax = fig.add_subplot(2, 2, 4) o2s = maps['emline_gsigma_oiid_3728'] mapplot.plot(dapmap=o2s, fig=fig, ax=ax) plt.suptitle(maps_file[i]) # the number corresponds to their wavelength in A*