e2mslab = e2slab-e2med

    e2sioblue = e2mslab.spectral_slab(-32*u.km/u.s, 55*u.km/u.s).moment0()
    e2sioblue.write('/Users/adam/work/w51/alma/FITS/longbaseline/{line}_m32to55kms_e2.fits'.format(line=line), overwrite=True)

    e2siored = e2mslab.spectral_slab(74*u.km/u.s, 118*u.km/u.s).moment0()
    e2siored.write('/Users/adam/work/w51/alma/FITS/longbaseline/{line}_74to118kms_e2.fits'.format(line=line), overwrite=True)



    import pvextractor
    from pvextractor.pvregions import paths_from_regions
    import pyregion
    import paths
    reg = pyregion.open(paths.rpath('../regions/e2eoutflow_reference_vector.reg'))
    outflowcoords = paths_from_regions(reg)
    outflowpath = outflowcoords[0]
    outflowpath.width = 0.15*u.arcsec

    extracted = pvextractor.extract_pv_slice(e2slab, outflowpath)

    import aplpy
    FF = aplpy.FITSFigure(extracted)
    FF.show_grayscale(aspect='auto')
    FF.save(paths.fpath('outflows/{line}_PV_e2e.png'.format(line=line)))



    e8cube = SpectralCube.read('/Volumes/passport/alma/w51/longbaseline/W51e8cax.SPW0_ALL_medsub_cutout.fits')
    e8vcube = e8cube.with_spectral_unit(u.km/u.s, rest_value=freq,
                                        velocity_convention='radio')
Exemplo n.º 2
0
if pf[0].data.ndim != mywcs.wcs.naxis:
    naxes = ['NAXIS%i' % ii for ii in range(1,mywcs.wcs.naxis+1)]
    # WCS is 1-indexed
    axes_to_keep = [ii+1
                    for ii,nax in enumerate(naxes)
                    if header[nax] > 1]
    mywcs = mywcs.sub(axes_to_keep)
    pf[0].header = mywcs.to_header()


rstringlist = dd.get('regions -system wcs').split("\n")
regions = load_regions_stringlist(rstringlist)
if len(regions) == 0:
    sys.exit("No regions found")

paths = paths_from_regions(regions, wcs=mywcs)

hdu = pvextractor.extract_pv_slice_hdu(pf[0], paths[regionid], order=0)

with tempfile.NamedTemporaryFile(suffix='fits', delete=False) as tf:
    hdu.writeto(tf)

# it may be possible to do this by
# ds9_pvextract.py $xpa_method | $image
# or any of the commented methods below...
dd.set('frame new')
#print tf.name
dd.set('fits '+tf.name)
#dd.set_pyfits(fits.HDUList(hdu))
#dd.set_np2arr(slc)
Exemplo n.º 3
0
if pf[0].data.ndim != mywcs.wcs.naxis:
    naxes = ['NAXIS%i' % ii for ii in range(1,mywcs.wcs.naxis+1)]
    # WCS is 1-indexed
    axes_to_keep = [ii+1
                    for ii,nax in enumerate(naxes)
                    if header[nax] > 1]
    mywcs = mywcs.sub(axes_to_keep)
    pf[0].header = mywcs.to_header()


rstringlist = dd.get('regions -system wcs').split("\n")
regions = load_regions_stringlist(rstringlist)
if len(regions) == 0:
    sys.exit("No regions found")

paths = paths_from_regions(regions)

hdu = pvextractor.extract_pv_slice(pf[0], paths[regionid], order=0)

with tempfile.NamedTemporaryFile(suffix='fits', delete=False) as tf:
    hdu.writeto(tf.name)

# it may be possible to do this by
# ds9_pvextract.py $xpa_method | $image
# or any of the commented methods below...
dd.set('frame new')
#print tf.name
dd.set('fits '+tf.name)
#dd.set_pyfits(fits.HDUList(hdu))
#dd.set_np2arr(slc)
Exemplo n.º 4
0
#rp = pyregion.RegionParser()

# have to check for ds9 dropping degenerate axes
if pf[0].data.ndim != mywcs.wcs.naxis:
    naxes = ['NAXIS%i' % ii for ii in range(1, mywcs.wcs.naxis + 1)]
    # WCS is 1-indexed
    axes_to_keep = [ii + 1 for ii, nax in enumerate(naxes) if header[nax] > 1]
    mywcs = mywcs.sub(axes_to_keep)
    pf[0].header = mywcs.to_header()

rstringlist = dd.get('regions -system wcs').split("\n")
regions = load_regions_stringlist(rstringlist)
if len(regions) == 0:
    sys.exit("No regions found")

paths = paths_from_regions(regions)

hdu = pvextractor.extract_pv_slice(pf[0], paths[regionid], order=0)

with tempfile.NamedTemporaryFile(suffix='fits', delete=False) as tf:
    hdu.writeto(tf)

# it may be possible to do this by
# ds9_pvextract.py $xpa_method | $image
# or any of the commented methods below...
dd.set('frame new')
#print tf.name
dd.set('fits ' + tf.name)
#dd.set_pyfits(fits.HDUList(hdu))
#dd.set_np2arr(slc)