cb.ax.yaxis.set_label_position('right')

        ax.set_xlabel("Galactic Longitude")
        ax.set_ylabel("Galactic Latitude")

        tr = ax.get_transform(dustcolwcs)
        con = ax.contour(dustcoldata, levels=[5], colors=[(0,0,0,0.5)],
                         zorder=15, alpha=0.5, linewidths=[0.5], transform=tr)
        ax.axis(limits)

        pl.savefig(fpath('integrated/{0}'.format(outname.replace(".fits",".pdf"))),
                   bbox_inches='tight')
        for c in con.collections: c.set_visible(False)
        
        labels = pyregion.open(rpath('ridge_names.reg'))
        PC, TC = ds9(labels, im.header, text_offset=0)
        #PC.add_to_axes(ax)
        TC = aplpyregions.ArtistCollection([x for x in TC.artistlist if isinstance(x, matplotlib.text.Annotation)])
        TC.add_to_axes(ax)

        pl.savefig(fpath('integrated/{0}'.format(outname.replace(".fits","_labeled.pdf"))),
                   bbox_inches='tight')


        for c in con.collections: c.set_visible(True)
        ax.axis(limits)
        pl.savefig(fpath('integrated/{0}'.format(outname.replace(".fits",
                                                                 "_labeled_dustcontours.pdf"))),
                   bbox_inches='tight')

                         levels=[5],
                         colors=[(0, 0, 0, 0.5)],
                         zorder=15,
                         alpha=0.5,
                         linewidths=[0.5],
                         transform=tr)
        ax.axis(limits)

        pl.savefig(fpath('integrated/{0}'.format(
            outname.replace(".fits", ".pdf"))),
                   bbox_inches='tight')
        for c in con.collections:
            c.set_visible(False)

        labels = pyregion.open(rpath('ridge_names.reg'))
        PC, TC = ds9(labels, im.header, text_offset=0)
        #PC.add_to_axes(ax)
        TC = aplpyregions.ArtistCollection([
            x for x in TC.artistlist
            if isinstance(x, matplotlib.text.Annotation)
        ])
        TC.add_to_axes(ax)

        pl.savefig(fpath('integrated/{0}'.format(
            outname.replace(".fits", "_labeled.pdf"))),
                   bbox_inches='tight')

        for c in con.collections:
            c.set_visible(True)
        ax.axis(limits)
        pl.savefig(fpath('integrated/{0}'.format(
Ejemplo n.º 3
0
im.data -= np.nanmin(im.data) - 0.00001
vmin = np.percentile(im.data[np.isfinite(im.data)], 00.05)
vmax = np.percentile(im.data[np.isfinite(im.data)], 99.95)
ax.imshow(im.data, cmap=cm, vmin=vmin, vmax=vmax,
          norm=matplotlib.colors.LogNorm())

region_file = rpath('spectral_apertures.reg')
regions = pyregion.open(region_file)

for sh in regions:
    sh.attr[1]['color'] = 'darkgreen'

boxes = pyregion.ShapeList([sh for sh in regions if sh.name == 'box'])
circles = pyregion.ShapeList([sh for sh in regions if sh.name == 'circle'])

PC, TC = ds9(boxes, im.header)
PC.add_to_axes(ax)
#TC.add_to_axes(ax)
pl.savefig(fpath("regions/boxes_on_h2co.pdf"), bbox_inches='tight')

PC.set_visible(False)
TC.set_visible(False)
PC, TC = ds9(circles, im.header)
PC.add_to_axes(ax)
#TC.add_to_axes(ax)
pl.savefig(fpath("regions/circles_on_h2co.pdf"), bbox_inches='tight')

regions = pyregion.open(rpath('target_fields_8x8_gal.reg'))
for sh in regions:
    sh.attr[1]['color'] = 'darkgreen'
PC.set_visible(False)
Ejemplo n.º 4
0
ax.imshow(im.data,
          cmap=cm,
          vmin=vmin,
          vmax=vmax,
          norm=matplotlib.colors.LogNorm())

region_file = rpath('spectral_apertures.reg')
regions = pyregion.open(region_file)

for sh in regions:
    sh.attr[1]['color'] = 'darkgreen'

boxes = pyregion.ShapeList([sh for sh in regions if sh.name == 'box'])
circles = pyregion.ShapeList([sh for sh in regions if sh.name == 'circle'])

PC, TC = ds9(boxes, im.header)
PC.add_to_axes(ax)
#TC.add_to_axes(ax)
pl.savefig(fpath("regions/boxes_on_h2co.pdf"), bbox_inches='tight')

PC.set_visible(False)
TC.set_visible(False)
PC, TC = ds9(circles, im.header)
PC.add_to_axes(ax)
#TC.add_to_axes(ax)
pl.savefig(fpath("regions/circles_on_h2co.pdf"), bbox_inches='tight')

regions = pyregion.open(rpath('target_fields_8x8_gal.reg'))
for sh in regions:
    sh.attr[1]['color'] = 'darkgreen'
PC.set_visible(False)