from astropy import table from astropy.table import Table,Column import latex_info from latex_info import latexdict, exp_to_tex, format_float import radio_beam from astropy.io import fits from astropy import wcs from photom_files import files # add images that merge subbands files["5.5 GHz Epoch 3"] = paths.dpath("W51C_ACarray_continuum_4096_both_uniform_contsplit.clean.image.fits") files["13.4 GHz Epoch 2"] = paths.dpath('W51Ku_BDarray_continuum_2048_both_uniform.hires.clean.image.fits') beams = {name: radio_beam.Beam.from_fits_header(fits.getheader(fn)) for name,fn in files.items()} dates = {name: fits.getheader(fn)['DATE-OBS'] for name,fn in files.items()} noisereg = pyregion.open(paths.rpath("noise_estimate_region.reg")) noise_est = {} peak = {} # noise estimate for ep in files: im = fits.open(files[ep]) header = im[0].header w = wcs.WCS(header).sub([wcs.WCSSUB_CELESTIAL]) mask = noisereg.get_mask(header=w.to_header(), shape=im[0].data.squeeze().shape) noise_est[ep] = im[0].data.squeeze()[mask].std() * 1000
if not 'fluxes' in locals() or not isinstance(fluxes,dict): fluxes = {} peaks = {} valleys = {} cutouts = {} error = {} mpfits = {} gpars = {} gparerrs = {} gfits = {} obsdate = {} beams = {} frequencies = {} reg_centers = {} for freq,fn in files.items(): if freq not in fluxes: fluxes[freq] = {} peaks[freq] = {} valleys[freq] = {} cutouts[freq] = {} mpfits[freq] = {} gpars[freq] = {} gparerrs[freq] = {} gfits[freq] = {} reg_centers[freq] = {} data = fits.getdata(fn).squeeze() header = flatten_header(fits.getheader(fn)) wcs = astropy.wcs.WCS(header).sub([astropy.wcs.WCSSUB_CELESTIAL]) beam = radio_beam.Beam.from_fits_header(header)