aimfast modules

amifast.aimfast module

aimfast.aimfast.compare_models(models, tolerance=0.2, plot=True, all_sources=False, closest_only=False, prefix=None, flux_plot='log')[source]

Plot model1 source properties against that of model2

models : dict
Tigger formatted model files e.g {model1: model2}.
tolerance : float
Tolerace in detecting source from model 2 (in arcsec).
plot : bool
Output html plot from which a png can be obtained.
all_source: bool
Compare all sources in the catalog (else only point-like source)
closest_only: bool
Returns the closest source only as the matching source
flux_plot: str
The type of output flux comparison plot (options:log,snr,inout)
prefix : str
Prefix for output htmls
results : dict
Dictionary of source properties from each model.
aimfast.aimfast.compare_residuals(residuals, skymodel=None, points=None, inline=False, area_factor=None, prefix=None, fov_factor=None)[source]
aimfast.aimfast.create_logger()[source]

Create a console logger

aimfast.aimfast.fitsInfo(fitsname=None)[source]

Get fits header info.

fitsname : fits file
Restored image (cube)
fitsinfo : dict
Dictionary of fits information e.g. {‘wcs’: wcs, ‘ra’: ra, ‘dec’: dec, ‘dra’: dra, ‘ddec’: ddec, ‘raPix’: raPix, ‘decPix’: decPix, ‘b_size’: beam_size, ‘numPix’: numPix, ‘centre’: centre, ‘skyArea’: skyArea}
aimfast.aimfast.generate_default_config(configfile)[source]

Generate default config file for running source finders

aimfast.aimfast.get_aimfast_data(filename='fidelity_results.json', dir='.')[source]

Extracts data from the json data file

aimfast.aimfast.get_argparser()[source]

Get argument parser.

aimfast.aimfast.get_box(wcs, radec, w)[source]

Get box of width w around source coordinates radec.

radec : tuple
RA and DEC in degrees.
w : int
Width of box.
wcs : astLib.astWCS.WCS instance
World Coordinate System.
box : tuple
A box centred at radec.
aimfast.aimfast.get_detected_sources_properties(model_1, model_2, area_factor, all_sources=False, closest_only=False)[source]

Extracts the output simulation sources properties.

models_1 : file
Tigger formatted or txt model 1 file.
models_2 : file
Tigger formatted or txt model 2 file.
area_factor : float
Area factor to multiply the psf size around source.
all_source: bool
Compare all sources in the catalog (else only point-like source)
closest_only: bool
Returns the closest source only as the matching source
(targets_flux, targets_scale, targets_position) : tuple
Tuple of target flux, morphology and astrometry information
aimfast.aimfast.get_model(catalog)[source]

Get model model object from file catalog

aimfast.aimfast.get_sf_params(configfile)[source]
aimfast.aimfast.get_source_overlay(sources1, sources2)[source]

Get source from models compare for overlay

aimfast.aimfast.get_src_scale(source_shape)[source]

Get scale measure of the source in arcsec.

source_shape : lsm object
Source shape object from model
(scale_out_arc_sec, scale_out_err_arc_sec) : tuple
Output source scale with error value
aimfast.aimfast.image_dynamic_range(fitsname, residual, area_factor=6)[source]

Gets the dynamic range in a restored image.

fitsname : fits file
Restored image (cube).
residual : fits file
Residual image (cube).
area_factor: int
Factor to multiply the beam area.
DR : dict
DRs - dynamic range values.
aimfast.aimfast.json_dump(data_dict, filename='fidelity_results.json')[source]

Dumps the computed dictionary results into a json file.

data_dict : dict
Dictionary with output results to save.
filename : str
Name of file json file where fidelity results will be dumped. Default is ‘fidelity_results.json’ in the current directory.

If the fidelity_results.json file exists, it will be append, and only repeated image assessments will be replaced.

aimfast.aimfast.main()[source]

Main function.

aimfast.aimfast.measure_psf(psffile, arcsec_size=20)[source]

Measure point spread function after deconvolution.

psfile : fits file
Point spread function file.
arcsec_size : float
Cross section size
r0 : float
Average psf size.
aimfast.aimfast.model_dynamic_range(lsmname, fitsname, beam_size=5, area_factor=2)[source]

Gets the dynamic range using model lsm and residual fits.

fitsname : fits file
Residual image (cube).
lsmname : lsm.html or .txt file
Model .lsm.html from pybdsm (or .txt converted tigger file).
beam_size : float
Average beam size in arcsec.
area_factor : float
Factor to multiply the beam area.
DR : dict
DRs - dynamic range values.
aimfast.aimfast.noise_sigma(noise_image)[source]

Determines the noise sigma level in a dirty image with no source

noise_image : file
Noise image (cube).
noise_std : float
Noise image standard deviation
aimfast.aimfast.normality_testing(data, test_normality='normaltest', data_range=None)[source]

Performs a normality test on the image data.

data : numpy.array
Residual residual array. i.e. fitsio.open(fitsname)[0].data
test_normality : str
Perform normality testing using either shapiro or normaltest.
data_range : int
Range of data to perform normality testing.
normality : dict
dictionary of stats props. e.g. {‘NORM’: (123.3, 0.012)} whereby the first element is the statistics (or average if data_range specified) of the datasets and second element is the p-value.
aimfast.aimfast.plot_aimfast_stats(fidelity_results_file, units='micro', prefix='')[source]

Plot stats results if more that one residual images where assessed

aimfast.aimfast.plot_astrometry(models, label=None, tolerance=0.2, phase_centre=None, all_sources=False)[source]

Plot model-model positions from lsm.html/txt models

models : dict
Tigger/text formatted model files e.g {model1: model2}.
label : str
Use this label instead of the FITS image path when saving data.
tolerance: float
Radius around the source to be cross matched.
phase_centre : str
Phase centre of catalog (if not already embeded)
all_source: bool
Compare all sources in the catalog (else only point-like source)
aimfast.aimfast.plot_photometry(models, label=None, tolerance=0.2, phase_centre=None, all_sources=False, flux_plot='log')[source]

Plot model-model fluxes from lsm.html/txt models

models : dict
Tigger/text formatted model files e.g {model1: model2}.
label : str
Use this label instead of the FITS image path when saving data.
tolerance: float
Radius around the source to be cross matched (in arcsec).
phase_centre : str
Phase centre of catalog (if not already embeded)
all_source: bool
Compare all sources in the catalog (else only point-like source)
aimfast.aimfast.plot_residuals_noise(res_noise_images, skymodel=None, label=None, area_factor=2.0, points=100)[source]

Plot residual-residual or noise data

res_noise_images: dict
Dictionary of residual images to plot {res1.fits: res2.fits}.
skymodel: file
Skymodel file to locate on source residuals (lsm.html/txt)
label : str
Use this label instead of the FITS image path when saving data.
area_factor : float
Factor to multiply the beam area.
points: int
Number of data point to generate in case of random residuals.
aimfast.aimfast.residual_image_stats(fitsname, test_normality=None, data_range=None, threshold=None, chans=None, mask=None)[source]

Gets statistcal properties of a residual image.

fitsname : file
Residual image (cube).
test_normality : str
Perform normality testing using either shapiro or normaltest.
data_range : int, optional
Range of data to perform normality testing.
threshold : float, optional
Cut-off threshold to select channels in a cube
chans : str, optional
Channels to compute stats (e.g. 1;0~50;100~200)
mask : file
Fits mask to get stats in image
props : dict

Dictionary of stats properties. e.g. {‘MEAN’: 0.0, ‘STDDev’: 0.1, ‘RMS’: 0.1,

‘SKEW’: 0.2, ‘KURT’: 0.3, ‘MAD’: 0.4, ‘MAX’: 0.7}

If normality_test=True, dictionary of stats props becomes e.g. {‘MEAN’: 0.0, ‘STDDev’: 0.1, ‘SKEW’: 0.2, ‘KURT’: 0.3, ‘MAD’: 0.4, ‘RMS’: 0.5, ‘SLIDING_STDDev’: 0.6, ‘MAX’: 0.7, ‘NORM’: (123.3,0.012)} whereby the first element is the statistics (or average if data_range specified) of the datasets and second element is the p-value.

aimfast.aimfast.source_finding(sf_params, sf=None)[source]
aimfast.aimfast.targets_not_matching(sources1, sources2, matched_names, flux_units='milli')[source]

Plot model-model fluxes from lsm.html/txt models

sources1: list
List of sources from model 1
sources2: list
List of sources Sources from model 2
matched_names: dict
Dict of names from model 2 that matched that of model 1
flux_units: str
Units of flux density for tabulated values
target_no_match1: dict
Sources from model 1 that have no match in model 2
target_no_match2: dict
Sources from model 2 that have no match in model 1

amifast.tests.test_aimfast module