aimfast modules#
amifast.aimfast module#
- aimfast.aimfast.compare_models(models, tolerance=0.2, plot=True, all_sources=False, shape_limit=6.0, off_axis=None, closest_only=False, prefix=None, flux_plot='log', fxlabels=None, fylabels=None, ftitles=None, svg=False, title_size='16pt', x_label_size='12pt', y_label_size='12pt', legend_size='10pt', xmajor_size='8pt', ymajor_size='8pt', bar_size='12pt', bar_major_size='8pt')[source]#
Plot model1 source properties against that of model2
- modelsdict
Tigger formatted model files e.g {model1: model2}.
- tolerancefloat
Tolerace in detecting source from model 2 (in arcsec).
- plotbool
Output html plot from which a png can be obtained.
- all_source: bool
Compare all sources in the catalog (else only point-like source)
- shape_limit: float
Cross match only sources with maj-axis less than this value
- 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)
- prefixstr
Prefix for output htmls
- fxlabelsstr[]
X-axis labels for the flux comparison plots
- fylabelsstr[]
Y-axis labels for the flux comparison plots
- fylabelsstr[]
Title labels for the flux comparison plots
- resultsdict
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, units='micro', title_size='14pt', xmajor_size='6pt', ymajor_size='6pt', legend_size='10pt', x_label_size='12pt', y_label_size='12pt')[source]#
- aimfast.aimfast.fitsInfo(fitsname=None)[source]#
Get fits header info.
- fitsnamefits file
Restored image (cube)
- fitsinfodict
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_box(wcs, radec, w)[source]#
Get box of width w around source coordinates radec.
- radectuple
RA and DEC in degrees.
- wint
Width of box.
- wcsatropy.wcs instance
World Coordinate System.
- boxtuple
A box centred at radec.
- aimfast.aimfast.get_detected_sources_properties(model_1, model_2, tolerance, shape_limit=6.0, all_sources=False, closest_only=False, off_axis=None)[source]#
Extracts the output simulation sources properties.
- models_1file
Tigger formatted or txt model 1 file
- models_2file
Compare all sources in the catalog (else only sources with maj<shape_limit)
- tolerancefloat
Tolerace to cross-match sources
- shape_limit: float
Cross match only sources with maj-axis less than this value
- closest_only: bool
Returns the closest source only as the matching source
- off_axis: float
Cross-match only sources within this distance from the centre
- (targets_flux, targets_scale, targets_position)tuple
Tuple of target flux, morphology and astrometry information
- aimfast.aimfast.get_image_products(images, mask)[source]#
Get a product of images with a mask
- images: list
List of fits images to get product
- mask: str
Mask to multiply the images
- prod_images: list
List of resulting fits images
- 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_shapelsm 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.
- fitsnamefits file
Restored image (cube).
- residualfits file
Residual image (cube).
- area_factor: int
Factor to multiply the beam area.
- DRdict
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_dictdict
Dictionary with output results to save.
- filenamestr
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.measure_psf(psffile, arcsec_size=20)[source]#
Measure point spread function after deconvolution.
- psfilefits file
Point spread function file.
- arcsec_sizefloat
Cross section size
- r0float
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.
- fitsnamefits file
Residual image (cube).
- lsmnamelsm.html or .txt file
Model .lsm.html from pybdsm (or .txt converted tigger file).
- beam_sizefloat
Average beam size in arcsec.
- area_factorfloat
Factor to multiply the beam area.
- DRdict
DRs - dynamic range values.
- aimfast.aimfast.noise_sigma(noise_image)[source]#
Determines the noise sigma level in a dirty image with no source
- noise_imagefile
Noise image (cube).
- noise_stdfloat
Noise image standard deviation
- aimfast.aimfast.normality_testing(data, test_normality='normaltest', data_range=None)[source]#
Performs a normality test on the image data.
- datanumpy.array
Residual residual array. i.e. fitsio.open(fitsname)[0].data
- test_normalitystr
Perform normality testing using either shapiro or normaltest.
- data_rangeint
Range of data to perform normality testing.
- normalitydict
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, off_axis=None)[source]#
Plot model-model positions from lsm.html/txt models
- modelsdict
Tigger/text formatted model files e.g {model1: model2}.
- labelstr
Use this label instead of the FITS image path when saving data.
- tolerance: float
Radius around the source to be cross matched.
- phase_centrestr
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_model_columns(catalog_file, x, y, x_err=None, y_err=None, svg=False, x_label=None, y_label=None, title=None, html_prefix=None, title_size='16pt', x_label_size='12pt', y_label_size='12pt', legend_size='10pt', xmajor_size='6pt', ymajor_size='6pt', units='micro')[source]#
Plot catalog columns including their uncertainties
- aimfast.aimfast.plot_photometry(models, label=None, tolerance=0.2, phase_centre=None, all_sources=False, flux_plot='log', off_axis=None, shape_limit=6.0)[source]#
Plot model-model fluxes from lsm.html/txt models
- modelsdict
Tigger/text formatted model files e.g {model1: model2}.
- labelstr
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_centrestr
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)
- labelstr
Use this label instead of the FITS image path when saving data.
- area_factorfloat
Factor to multiply the beam area.
- points: int
Number of data point to generate in case of random residuals.
- aimfast.aimfast.plot_subimage_stats(fitsnames, centre_coords, sizes, htmlprefix='default', title_size='12pt', x_label_size='10pt', y_label_size='10pt', bar_label_size='15pt', units='micro', svg=False)[source]#
Plot subimages and stats
- 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.
- fitsnamefile
Residual image (cube).
- test_normalitystr
Perform normality testing using either shapiro or normaltest.
- data_rangeint, optional
Range of data to perform normality testing.
- thresholdfloat, optional
Cut-off threshold to select channels in a cube
- chansstr, optional
Channels to compute stats (e.g. 1;0~50;100~200)
- maskfile
Fits mask to get stats in image
- propsdict
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, ‘SUM_NEG’: -0.1}
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, ‘SUM_NEG’: -0.1, ‘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.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