import paths import pyregion import aplpy import numpy as np import pylab as pl regions = pyregion.open(paths.rpath('bubble_edges.reg')) fig1 = pl.figure(1) fig1.clf() F = aplpy.FITSFigure(paths.tmpath('max/SgrB2_b3_12M.HC3N.image.pbcor.contsub_max.fits'), figure=fig1) F.show_grayscale() cm = pl.cm.rainbow norm = pl.Normalize(vmin=18, vmax=56) for reg in regions: seg = np.array(zip(reg.coord_list[::2], reg.coord_list[1::2])).T vel = float(reg.attr[1]['text']) color = cm(norm(vel)) F.show_lines([seg], color=color) F.recenter(266.83188, -28.391511, radius=0.0585) pl.draw() pl.show()
'sum': cutout.sum(), 'bgrms': bgcutout.std(), 'bgmad': mad_std(bgcutout), 'npix': mask.data.sum(), 'beam_area': beam.sr, 'RA': reg.center.ra[0], 'Dec': reg.center.dec[0], } return results if __name__ == "__main__": regs = regions.read_ds9(paths.rpath('sgrb2_cores_TE.reg')) contfnpath = paths.tmpath('te/SgrB2_selfcal_full_TE_selfcal4_ampphase.image.pbcor.fits') contfile = fits.open(contfnpath) data = contfile[0].data beam = radio_beam.Beam.from_fits_header(contfnpath) mywcs = wcs.WCS(contfile[0].header) units = {'peak':u.Jy/u.beam, 'sum':u.Jy/u.beam, 'npix':u.dimensionless_unscaled, 'beam_area':u.sr, 'peak_mass_20K':u.M_sun, 'peak_col_20K':u.cm**-2, 'RA': u.deg, 'Dec': u.deg, }
import paths import pyregion import aplpy import numpy as np import pylab as pl regions = pyregion.open(paths.rpath('bubble_edges.reg')) fig1 = pl.figure(1) fig1.clf() F = aplpy.FITSFigure(paths.tmpath('max/SgrB2_b3_12M.HC3N.image.pbcor.contsub_max.fits'), figure=fig1) F.show_grayscale() cm = pl.cm.rainbow norm = pl.Normalize(vmin=18, vmax=56) for reg in regions: seg = np.array(list(zip(reg.coord_list[::2], reg.coord_list[1::2]))).T vel = float(reg.attr[1]['text']) color = cm(norm(vel)) F.show_lines([seg], color=color) F.recenter(266.83188, -28.391511, radius=0.0585) pl.draw() pl.show()