Skip to content

Commit

Permalink
get aegean to work
Browse files Browse the repository at this point in the history
  • Loading branch information
Athanaseus committed Oct 19, 2020
1 parent 781d9e1 commit 2ac8a80
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
8 changes: 6 additions & 2 deletions aimfast/aimfast.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']:
Expand Down Expand Up @@ -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]))
Expand Down
7 changes: 7 additions & 0 deletions aimfast/auxiliary.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,18 +201,25 @@ 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
elif value is False:
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):
Expand Down
4 changes: 2 additions & 2 deletions aimfast/source_finder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2ac8a80

Please sign in to comment.