import numpy as np import paths from astropy.io import fits import pylab as pl from astropy import wcs import astropy.visualization from astropy.nddata import Cutout2D from astropy import coordinates from astropy import units as u import regions noise_regions = regions.read_ds9(paths.rpath('noise_regions.reg')) sc5tt = fits.open( paths.mergepath( 'continuum/SgrB2_selfcal_full_TCTE7m_selfcal5_ampphase_taylorterms_multiscale_deeper_mask2.5mJy.image.tt0.pbcor.fits' )) mywcs = wcs.WCS(sc5tt[0].header) data = sc5tt[0].data peak = np.nanmax(data) print("Peak flux: {0} Jy".format(peak)) for reg in noise_regions: pixreg = reg.to_pixel(mywcs) mask = pixreg.to_mask() cutout = mask.cutout(data) * mask.data name = reg.meta['text'].strip("{}")
from astropy.io import fits from astropy.table import Table,Column import paths from core_photometry import photometry lines = ["CFp", "CH3OH7m26-716", "H15NC", "H2CO615-616", "H2CS303-202", "H2CS313-212", "H2CS322-221", "H41a", "HC3N", "HCN", "HNC",] if __name__ == "__main__": regs = regions.read_ds9(paths.rpath('sgrb2_cores_TE.reg')) all_results = {} for line in lines: fn = paths.mergepath("max/SgrB2_b3_7M_12M.{0}.image.pbcor_max_medsub.fits".format(line)) ffile = fits.open(fn) data = ffile[0].data header = ffile[0].header beam = radio_beam.Beam.from_fits_header(header) mywcs = wcs.WCS(header) units = {'peak':u.Jy/u.beam, 'sum':u.Jy/u.beam, 'npix':u.dimensionless_unscaled, 'beam_area':u.sr, 'peak_brightness': u.K, 'freq': u.GHz, 'RA': u.deg, 'Dec': u.deg, }
from visualization import make_scalebar, hide_labels from astropy.nddata import Cutout2D from astropy import coordinates from astropy import units as u import warnings warnings.filterwarnings('ignore', category=wcs.FITSFixedWarning, append=True) ra1m, dec1m = (266.84197, -28.391225) ra2m, dec2m = (266.82652, -28.378154) ra1s, dec1s = (266.83741, -28.398368) ra2s, dec2s = (266.83265, -28.393495) init = fits.open( paths.mergepath( 'continuum/SgrB2_selfcal_full_TCTE7m_init.image.pbcor.fits')) sc1 = fits.open( paths.mergepath( 'continuum/SgrB2_selfcal_full_TCTE7m_selfcal1.image.pbcor.fits')) sc2 = fits.open( paths.mergepath( 'continuum/SgrB2_selfcal_full_TCTE7m_selfcal2.image.pbcor.fits')) sc3 = fits.open( paths.mergepath( 'continuum/SgrB2_selfcal_full_TCTE7m_selfcal3.image.pbcor.fits')) sc4 = fits.open( paths.mergepath( 'continuum/SgrB2_selfcal_full_TCTE7m_selfcal4_ampphase.image.pbcor.fits' )) sc5 = fits.open( paths.mergepath(
'peak_mass_40K': u.M_sun, 'peak_col_40K': u.cm**-2, 'RA': u.deg, 'Dec': u.deg, } results = photometry(data, mywcs, regs, beam, alphamap=alphamap, alphaerrmap=alphaerrmap) #fn_90GHz = paths.tmpath('SgrB2_nocal_TE_continuum_90GHz.image.pbcor.fits') fn_90GHz = paths.mergepath( 'continuum/SgrB2_selfcal_full_TETC7m_selfcal5_ampphase_continuum_90GHz.image.pbcor.fits' ) results_90GHz = photometry( fits.getdata(fn_90GHz), wcs.WCS(fits.getheader(fn_90GHz)), regs, radio_beam.Beam.from_fits_header(fits.getheader(fn_90GHz))) #fn_100GHz = paths.tmpath('SgrB2_nocal_TE_continuum_100GHz.image.pbcor.fits') fn_100GHz = paths.mergepath( 'continuum/SgrB2_selfcal_full_TETC7m_selfcal5_ampphase_continuum_100GHz.image.pbcor.fits' ) results_100GHz = photometry( fits.getdata(fn_100GHz), wcs.WCS(fits.getheader(fn_100GHz)), regs, radio_beam.Beam.from_fits_header(fits.getheader(fn_100GHz))) for name in results: results[name]['peak_col_20K'] = masscalc.col_conversion_factor( results[name]['peak'] * u.Jy, beam.sr)
import astropy.visualization from visualization import make_scalebar, hide_labels from astropy.nddata import Cutout2D from astropy import coordinates from astropy import units as u import warnings warnings.filterwarnings('ignore', category=wcs.FITSFixedWarning, append=True) ra1m,dec1m = (266.84197, -28.391225) ra2m,dec2m = (266.82652, -28.378154) ra1s,dec1s = (266.83741, -28.398368) ra2s,dec2s = (266.83265, -28.393495) init = fits.open(paths.mergepath('continuum/SgrB2_selfcal_full_TCTE7m_try2_init.image.tt0.pbcor.fits')) sc1 = fits.open(paths.mergepath('continuum/SgrB2_selfcal_full_TCTE7m_try2_selfcal1.image.tt0.pbcor.fits')) sc2 = fits.open(paths.mergepath('continuum/SgrB2_selfcal_full_TCTE7m_try2_selfcal2.image.tt0.pbcor.fits')) sc3 = fits.open(paths.mergepath('continuum/SgrB2_selfcal_full_TCTE7m_try2_selfcal3.image.tt0.pbcor.fits')) sc4 = fits.open(paths.mergepath('continuum/SgrB2_selfcal_full_TCTE7m_try2_selfcal4_ampphase.image.tt0.pbcor.fits')) sc5 = fits.open(paths.mergepath('continuum/SgrB2_selfcal_full_TCTE7m_try2_selfcal5_ampphase.image.tt0.pbcor.fits')) sc5tt = fits.open(paths.mergepath('continuum/SgrB2_selfcal_full_TCTE7m_try2_selfcal5_ampphase_deeper_mask2.5mJy.image.tt0.pbcor.fits')) sc6tt = fits.open(paths.mergepath('continuum/SgrB2_selfcal_full_TCTE7m_try2_selfcal6_ampphase_deeper_mask1.5mJy.image.tt0.pbcor.fits')) rinit = fits.open(paths.mergepath('continuum/SgrB2_selfcal_full_TCTE7m_try2_init.residual.tt0.fits')) rsc1 = fits.open(paths.mergepath('continuum/SgrB2_selfcal_full_TCTE7m_try2_selfcal1.residual.tt0.fits')) rsc2 = fits.open(paths.mergepath('continuum/SgrB2_selfcal_full_TCTE7m_try2_selfcal2.residual.tt0.fits')) rsc3 = fits.open(paths.mergepath('continuum/SgrB2_selfcal_full_TCTE7m_try2_selfcal3.residual.tt0.fits')) rsc4 = fits.open(paths.mergepath('continuum/SgrB2_selfcal_full_TCTE7m_try2_selfcal4_ampphase.residual.tt0.fits')) rsc5 = fits.open(paths.mergepath('continuum/SgrB2_selfcal_full_TCTE7m_try2_selfcal5_ampphase.residual.tt0.fits')) rsc5tt = fits.open(paths.mergepath('continuum/SgrB2_selfcal_full_TCTE7m_try2_selfcal5_ampphase_deeper_mask2.5mJy.residual.tt0.fits'))