From 2ac8a803052258fa5006c279cd9e4e0cb9e6bab5 Mon Sep 17 00:00:00 2001 From: Athanaseus Javas Ramaila Date: Tue, 20 Oct 2020 01:58:04 +0200 Subject: [PATCH] get aegean to work --- aimfast/aimfast.py | 8 ++++++-- aimfast/auxiliary.py | 7 +++++++ aimfast/source_finder.yml | 4 ++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/aimfast/aimfast.py b/aimfast/aimfast.py index 23ba5b67..51fdd583 100644 --- a/aimfast/aimfast.py +++ b/aimfast/aimfast.py @@ -885,9 +885,14 @@ def tigger_src_wsclean(src, idx): model = Tigger.load(catalog) if ext in ['.tab', '.csv']: data = Table.read(catalog, format='ascii') + if ext == '.tab': + fits_file = catalog.replace('_comp.tab', '.fits') + else: + fits_file = catalog.replace('_comp.csv', '.fits') + fitsinfo = fitsInfo(fits_file) for i, src in enumerate(data): model.sources.append(tigger_src_ascii(src, i)) - centre = fitsInfo['centre'] or _get_phase_centre(model) + centre = fitsinfo['centre'] or _get_phase_centre(model) model.ra0, model.dec0 = map(np.deg2rad, centre) model.save(catalog[:-4]+".lsm.html") if ext in ['.fits']: @@ -1404,7 +1409,6 @@ def _source_flux_plotter(results, all_models, inline=False, units='milli', z = np.array(phase_centre_dist) axis_labels = ['Model 1 log (flux)', 'Model 2 log (flux)'] elif plot_type == 'snr': - print(flux_in_data) x = np.log(np.array(flux_in_data) * FLUX_UNIT_SCALER[units][0]) y = ((np.array(flux_in_data) * FLUX_UNIT_SCALER[units][0])/ (np.array(flux_out_data) * FLUX_UNIT_SCALER[units][0])) diff --git a/aimfast/auxiliary.py b/aimfast/auxiliary.py index 5eb61bb7..af9f606e 100644 --- a/aimfast/auxiliary.py +++ b/aimfast/auxiliary.py @@ -201,6 +201,7 @@ def get_online_catalog(catalog='NVSS', width='1d', thresh=1.0, def aegean(image, kwargs, log): args = ['aegean'] + outfile = '' for name, value in kwargs.items(): if value is None: continue @@ -208,11 +209,17 @@ def aegean(image, kwargs, log): continue if name == 'filename': # positional argument args += ['{0}'.format(value)] + elif name == 'table': + outfile = "{}.tab".format(kwargs['filename'][:-5]) + args += ['{0}{1} {2}'.format('--', name, outfile)] + # Aegean add '_comp' to the file name e.g. im_comp.tab + outfile = "{}_comp.tab".format(kwargs['filename'][:-5]) else: args += ['{0}{1} {2}'.format('--', name, value)] log.info("Running: {}".format(" ".join(args))) run = subprocess.run(" ".join(args), shell=True) log.info("The exit code was: {}".format(run.returncode)) + return outfile def bdsf(image, kwargs, log): diff --git a/aimfast/source_finder.yml b/aimfast/source_finder.yml index 94669677..5f14c067 100644 --- a/aimfast/source_finder.yml +++ b/aimfast/source_finder.yml @@ -41,7 +41,7 @@ pybdsf: psf_snrtop: 0.15 psf_stype_only: true psf_smooth: - psf_high_snr: + psf_high_snr: indir: opdir_overwrite: output_all: @@ -71,7 +71,7 @@ aegean: enable: false filename: # Image to extract radio sources table: ascii # Additional table outputs, format inferred from extension (database: .db, votable: .vot, and ascii: .csv/.tab) - slice: # If the input data is a cube, then this slice will determine the array index of the image which will be processed by aegean + slice: 0 # If the input data is a cube, then this slice will determine the array index of the image which will be processed by aegean psf: # A .fits file that represents the local psf noise: # A .fits file that represents the image noise region: # Use this regions file to restrict source finding in this image. Use MIMAS region (.mim) files