flint.validation

Utility function to create a one figure multi panel validation plot for continuum imaging of RACS data

Attributes

Classes

MatchResult

Simple container to hold results of a quick cross match

PSFTableRow

Something that is only used to internally

RMSImageInfo

Class to hold basic RMS Image information, excluding the actual raw image data

SourceCounts

A small container to pass around source count information

Tables

Container for all the tables that are loaded in

ValidationCatalogues

Container for all the catalogues that are loaded in and

ValidationTables

Container for all the tables that are generated by the validation routine

ValidatorLayout

Simple container for all the matplotlib axes objects

XMatchTables

Container for all the cross matched tables

Functions

_make_beam_psf_row(→ PSFTableRow)

Collects the information required of a single beam image

calculate_area_correction_per_flux(→ numpy.ndarray)

This derives a rough correction to the area term when calculating

cli(→ None)

CLI entry point for validation plot creation

create_validation_plot(→ pathlib.Path)

Create a simple multi-panel validation figure intended to asses

create_validation_tables(→ ValidationTables)

Create a set of validation tables that can be used to assess the

extract_inner_image_array_region(→ numpy.ndarray)

Extract an inner region of an image array. The size of the extracted array

get_known_catalogue_info(→ flint.catalogue.Catalogue)

Return the parameters of a recognised catalogue.

get_parser(→ argparse.ArgumentParser)

Create the argument parser for the validation plot creation

get_rms_image_info(→ RMSImageInfo)

Extract information about the RMS image and construct a representative structure

get_source_counts(→ SourceCounts)

Derive source counts for a set of fluxes and known area

load_catalogues(→ tuple[ValidationCatalogues, Tables])

Load in all the catalogues that are required for the validation.

load_known_catalogue(→ tuple[astropy.table.Table, ...)

Load in a known catalogue table

make_field_stats_table(→ pathlib.Path)

make_psf_table(→ pathlib.Path)

make_validator_axes_layout(→ ValidatorLayout)

Create the figure layout to use for the quick look validation plot.

make_xmatch_table(→ tuple[astropy.table.Table, ...)

Create a simple cross match table between two catalogues

match_nearest_neighbour(→ MatchResult)

Match two catalogues together, and construct common properties.

plot_astrometry_comparison(→ matplotlib.axes.Axes)

Plot the astrometry of cross matches from a match result set

plot_field_info(→ matplotlib.axes.Axes)

plot_flag_summary(→ matplotlib.axes.Axes)

Plot the percentage of the spectrum that is flagged for

plot_flux_comparison(→ matplotlib.axes.Axes)

Create a flux comparison plot showing the flux densities from two catalogues compared

plot_psf(→ matplotlib.axes.Axes)

Create a plot highlighting the synthesised beam recorded in the

plot_rms_map(→ matplotlib.axes.Axes)

Add the RMS image to the figure

plot_source_counts(→ matplotlib.axes.Axes)

Create a figure of source counts from a astropy Table. If

scale_flux_alpha(→ float | numpy.ndarray)

Scale a flux density to a reference frequency using a spectral index

Module Contents

class flint.validation.MatchResult[source]

Bases: NamedTuple

Simple container to hold results of a quick cross match

flux1: numpy.ndarray | None = None[source]

Brightness in Jy of source in the first survey

flux2: numpy.ndarray | None = None[source]

Brightness in Jy of source in the second survey

freq1: float[source]

Frequency in Hz of the first survey

freq2: float[source]

Frequency in Hz of the second survey

idx1: numpy.ndarray[source]

The indices of the matched sources from the original input table 1

idx2: numpy.ndarray[source]

The indices of the matched sources from the original input table 2

name1: str[source]

Name of the first survey

name2: str[source]

Name of the second survey

pos1: astropy.coordinates.SkyCoord[source]

Sky-positions of sources in the first survey

pos2: astropy.coordinates.SkyCoord[source]

Sky-positions of sources in the second survey

class flint.validation.PSFTableRow[source]

Bases: NamedTuple

Something that is only used to internally represent the PSF information of a beam image. Currently no reason to use this.

b: float[source]
beam: int[source]
bmaj: float[source]
bmin: float[source]
bpa: float[source]
dec: float[source]
image_name: str[source]
l: float[source]
ra: float[source]
vis_flagged: int[source]
vis_total: int[source]
class flint.validation.RMSImageInfo[source]

Bases: NamedTuple

Class to hold basic RMS Image information, excluding the actual raw image data

area: float[source]

The area of valid sky, in degrees squared

centre: astropy.coordinates.SkyCoord[source]

The centre of the image

header: astropy.io.fits.Header[source]

Header from the FITS image

maximum: float[source]

The maximum value of the image

median: float[source]

The median value of the image

minimum: float[source]

The minimum value of the image

mode: float[source]

The mode of the image

no_valid_pixels: int[source]

Number of valid pixels in the image

path: pathlib.Path[source]

Path to the RMS fits image

shape: tuple[int, int][source]

Dimension of the image

std: float[source]

The standard deviation of the image

wcs: astropy.wcs.WCS[source]

The WCS of the image

class flint.validation.SourceCounts[source]

Bases: NamedTuple

A small container to pass around source count information

area: float[source]

The area in square degrees that the sources cover, i.e. image footprint sky-area

area_fraction: numpy.ndarray | None = None[source]

The fraction of the image that was above a sigma level per flux bin. This may be used as a rough term to scale the Euclidean Normalised source counts. This is not intended to be a robust way of correcting the source counts - just quick

bin_center: numpy.ndarray[source]

The bin centers to use in Jy

bins: numpy.ndarray[source]

The bin edges of the source counts in Jy

counts_per_bin: numpy.ndarray[source]

The counts of sources per flux bin

counts_per_bin_err: numpy.ndarray[source]

The rough estimate on the errors per bin

euclid_counts: numpy.ndarray[source]

Euclidean normalised source counts

euclid_counts_err: numpy.ndarray[source]

Rough estimate of error on the euclidean normalised source counts

class flint.validation.Tables[source]

Bases: NamedTuple

Container for all the tables that are loaded in

askap: astropy.table.Table[source]

ASKAP catalogue

icrf: astropy.table.Table[source]

ICRF catalogue

nvss: astropy.table.Table[source]

NVSS catalogue

racs_high: astropy.table.Table | None = None[source]

RACS high catalogue

racs_mid: astropy.table.Table | None = None[source]

RACS mid catalogue

sumss: astropy.table.Table[source]

SUMSS catalogue

tgss: astropy.table.Table | None = None[source]

TGSS catalogue

vlass: astropy.table.Table | None = None[source]

VLASS catalogue

class flint.validation.ValidationCatalogues[source]

Bases: NamedTuple

Container for all the catalogues that are loaded in and used throughout validation processing

askap: flint.catalogue.Catalogue[source]

ASKAP catalogue

icrf: flint.catalogue.Catalogue[source]

ICRF catalogue

nvss: flint.catalogue.Catalogue[source]

NVSS catalogue

racs_high: flint.catalogue.Catalogue | None = None[source]

RACS high catalogue

racs_mid: flint.catalogue.Catalogue | None = None[source]

RACS mid catalogue

sumss: flint.catalogue.Catalogue[source]

SUMSS catalogue

tgss: flint.catalogue.Catalogue | None = None[source]

TGSS catalogue

vlass: flint.catalogue.Catalogue | None = None[source]

VLASS catalogue

class flint.validation.ValidationTables[source]

Bases: NamedTuple

Container for all the tables that are generated by the validation routine

psf_table_path: pathlib.Path[source]

Path to the PSF table

stats_table_path: pathlib.Path[source]

Path to the statistics table

xmatch_tables: XMatchTables[source]

Cross-matched tables

class flint.validation.ValidatorLayout[source]

Bases: NamedTuple

Simple container for all the matplotlib axes objects

ax_astrometry: matplotlib.axes.Axes[source]

Axes to compare astrometry of sources

ax_astrometry1: matplotlib.axes.Axes[source]

Axes to compare astrometry of sources from the first catalogue

ax_astrometry2: matplotlib.axes.Axes[source]

Axes to compare astromnetry of sources from the first catalogue

ax_brightness1: matplotlib.axes.Axes[source]

Axes to compare brightness of sources from the first catalogue

ax_brightness2: matplotlib.axes.Axes[source]

Axes to compare brightness of sources from the first catalogue

ax_counts: matplotlib.axes.Axes[source]

Axes for quick look source counts

ax_flag_summary: matplotlib.axes.Axes[source]

Axes to summarise the flagging of the MS

ax_legend: matplotlib.axes.Axes[source]

Container for basic SBID information

ax_psf: matplotlib.axes.Axes[source]

Axes for the PSF of the image

ax_rms: matplotlib.axes.Axes[source]

Axes for the RMS of the field

class flint.validation.XMatchTables[source]

Bases: NamedTuple

Container for all the cross matched tables

icrf: pathlib.Path[source]

ICRF catalogue

nvss: pathlib.Path[source]

NVSS catalogue

racs_high: pathlib.Path | None = None[source]

RACS high catalogue

racs_mid: pathlib.Path | None = None[source]

RACS mid catalogue

sumss: pathlib.Path[source]

SUMSS catalogue

tgss: pathlib.Path | None = None[source]

TGSS catalogue

vlass: pathlib.Path | None = None[source]

VLASS catalogue

flint.validation._make_beam_psf_row(beam_summary: flint.summary.BeamSummary) PSFTableRow[source]

Collects the information required of a single beam image and measurement set for entry into the PSF table.

Not intended for usage other than int he creation of the PSF table.

Parameters:

beam_summary (BeamSummary) – The input set of collected properties

Returns:

Extracted information

Return type:

PSFTableRow

flint.validation.calculate_area_correction_per_flux(rms_image_path: pathlib.Path, flux_bin_centre: numpy.ndarray, sigma: float = 5) numpy.ndarray[source]

This derives a rough correction to the area term when calculating the source counts. This is not intended to correct for completeness, although they are closely related.

The RMS image is read in and a CDF is calculated. This is used to return a scaling term that indicates what fraction a flux-bin was sigma times the RMS, which could be used to scale the area.

Parameters:
  • rms_image_path (Path) – RMS image that will be use to calculate the area correction

  • flux_bin_centre (np.ndarray) – Fluxes to calculate the area fraction at

  • sigma (float, optional) – Mutliplicate term indicating what sigma level source finding cropped at. Defaults to 5.

Returns:

Fraction of the image that was available for source finding at a flux density

Return type:

np.ndarray

flint.validation.cli() None[source]

CLI entry point for validation plot creation

flint.validation.create_validation_plot(field_summary: flint.summary.FieldSummary, rms_image_path: pathlib.Path, source_catalogue_path: pathlib.Path, output_path: pathlib.Path, reference_catalogue_directory: pathlib.Path) pathlib.Path[source]

Create a simple multi-panel validation figure intended to asses the correctness of an image and associated source catalogue.

The image described by rms_image_path should be a FITS file. The WCS of this file is used for plotting and rreading the synthesised beam information using the standard CRVAL/BMAJ/BMIN keywords.

The source catalogue is read using astropy.table.Table. This routine also expects that some level of units are embedded in the catalogue. For Aegean produced catalogues this is the case.

The reference_catalogue_directory sets the directory to look into when searching for the reference ICRF, NVSS and SUMSS cataloues.

Parameters:
  • field_summary (FieldSummary) – A description of the key properties of the field

  • rms_image_path (Path) – The RMS fits image the source catalogue was constructed against.

  • source_catalogue_path (Path) – The source catalogue.

  • output_path (Path) – The output path of the figure to create

  • reference_catalogue_directory (Path) – The directory that contains the reference ICRF, NVSS and SUMSS catalogues.

Returns:

The output path of the figure

Return type:

Path

flint.validation.create_validation_tables(field_summary: flint.summary.FieldSummary, rms_image_path: pathlib.Path, source_catalogue_path: pathlib.Path, output_path: pathlib.Path, reference_catalogue_directory: pathlib.Path) ValidationTables[source]

Create a set of validation tables that can be used to assess the correctness of an image and associated source catalogue.

Parameters:
  • field_summary (FieldSummary) – A description of the key properties of the field

  • rms_image_path (Path) – The RMS fits image the source catalogue was constructed against.

  • source_catalogue_path (Path) – The source catalogue.

  • output_path (Path) – The output path of the figure to create

  • reference_catalogue_directory (Path) – The directory that contains the reference catalogues installed

Returns:

The tables that were created

Return type:

ValidationTables

flint.validation.extract_inner_image_array_region(image: numpy.ndarray, fraction: float) numpy.ndarray[source]

Extract an inner region of an image array. The size of the extracted array is specified via the fraction parameter, which should be in the range of 0 to 1.

Parameters:
  • image (np.ndarray) – The image to extract pixels from

  • fraction (float) – The size of the region to extraction.

Returns:

The extracted sub-region

Return type:

np.ndarray

flint.validation.get_known_catalogue_info(name: str) flint.catalogue.Catalogue[source]

Return the parameters of a recognised catalogue.

These are currently hardcoded.

The structure returneed outlines the name of columns of interest: - RA - Dec - Integrated flux - Major / Minor / PA

Parameters:

name (str) – The survey name of interest

Raises:

ValueError – Raised when an unrecongised catalogue is provided

Returns:

Information of the survey catalogue

Return type:

Catalogue

flint.validation.get_parser() argparse.ArgumentParser[source]

Create the argument parser for the validation plot creation

Returns:

CLI entry point

Return type:

ArgumentParser

flint.validation.get_rms_image_info(rms_path: pathlib.Path, extract_fraction: float = 0.5) RMSImageInfo[source]

Extract information about the RMS image and construct a representative structure

When computing the pixel statistics an inner region of the RMS map is extracted to avoid the primary beam roll off. Other properties of the RMSImageInfo are computed on the whole image (e.g. area)

Parameters:
  • rms_path (Path) – The RMS image that will be presented

  • extract_fraction (float, optional) – Extract the inner region of the base RMS image map. Defaults to 0.5.

Returns:

Extracted RMS image information

Return type:

RMSImageInfo

flint.validation.get_source_counts(fluxes: numpy.ndarray, area: float, minlogf: float = -4, maxlogf: float = 2, Nbins: int = 81, rms_image_path: pathlib.Path | None = None) SourceCounts[source]

Derive source counts for a set of fluxes and known area

Parameters:
  • fluxes (np.ndarray) – The fluxes in Jy to count

  • area (float) – Area over which the sources were collected

  • minlogf (float, optional) – The minimum bin edge, in Jy. Defaults to -4.

  • maxlogf (float, optional) – The maximum bin edgem, in Jy. Defaults to 2.

  • Nbins (int, optional) – Number of bins to include in the source counts. Defaults to 81.

  • rms_image_path (Optional[Path], optional) – Path to the RMS image. If not None, it is used to calculate a rough area correction. Defaults to None.

Returns:

Source counts and their properties

Return type:

SourceCounts

flint.validation.load_catalogues(source_catalogue_path: pathlib.Path, reference_catalogue_directory: pathlib.Path, askap_survey_name: str, rms_info: RMSImageInfo) tuple[ValidationCatalogues, Tables][source]

Load in all the catalogues that are required for the validation.

Parameters:
  • source_catalogue_path (Path) – The source catalogue to load

  • reference_catalogue_directory (Path) – The directory that contains the reference ICRF, NVSS and SUMSS catalogues.

  • askap_survey_name (str) – The name that will be given to the ASKAP field data

  • rms_info (RMSImageInfo) – The extracted information from the RMS image

Returns:

The loaded catalogues and tables

Return type:

Tuple[ValidationCatalogues, Tables]

flint.validation.load_known_catalogue(name: str, reference_catalogue_directory: pathlib.Path) tuple[astropy.table.Table, flint.catalogue.Catalogue][source]

Load in a known catalogue table

Parameters:
  • name (str) – Name of the survey to load

  • reference_catalogue_directory (Path) – The directory location with the reference catalogues installed

Returns:

The loaded table and Catalogue structure describing the columns

Return type:

Tuple[Table,Catalogue]

flint.validation.make_field_stats_table(field_summary: flint.summary.FieldSummary, rms_info: RMSImageInfo, output_path: pathlib.Path) pathlib.Path[source]
flint.validation.make_psf_table(field_summary: flint.summary.FieldSummary, output_path: pathlib.Path) pathlib.Path[source]
flint.validation.make_validator_axes_layout(fig: matplotlib.figure.Figure, rms_path: pathlib.Path) ValidatorLayout[source]

Create the figure layout to use for the quick look validation plot.

Parameters:
  • fig (Figure) – The figure canvas to add the axes to

  • rms_path (Path) – Path to the RMS image that will be presented. Loaded to access the WCS

Returns:

Representation of all axes objects

Return type:

ValidatorLayout

flint.validation.make_xmatch_table(table1: astropy.table.Table, table2: astropy.table.Table, catalogue1: flint.catalogue.Catalogue, catalogue2: flint.catalogue.Catalogue, match_result: MatchResult, output_path: pathlib.Path) tuple[astropy.table.Table, pathlib.Path][source]

Create a simple cross match table between two catalogues

Parameters:
  • table1 (Table) – The catalogue table from survey one

  • table2 (Table) – The catalogue table from survey two

  • catalogue1 (Catalogue) – Catalogue metadata for survey one

  • catalogue2 (Catalogue) – Catalogue metadata for survey two

  • match_result (MatchResult) – A result set of the cross-match between two catalogues

  • output_path (Path) – Location to save the table to

Returns:

The table and the output path

Return type:

Tuple[Table, Path]

flint.validation.match_nearest_neighbour(table1: astropy.table.Table, table2: astropy.table.Table, catalogue1: flint.catalogue.Catalogue, catalogue2: flint.catalogue.Catalogue, radius: float = 10) MatchResult[source]

Match two catalogues together, and construct common properties.

Parameters:
  • table1 (Table) – The catalogue table from survey one

  • table2 (Table) – The catalogue table from survey two

  • catalogue1 (Catalogue) – Catalogue metadata for survey one

  • catalogue2 (Catalogue) – Catalogue metadata for survey two

  • radius (float, optional) – Maximum matching radius. Defaults to 10.

Returns:

Object containing source matches and common properties

Return type:

MatchResult

flint.validation.plot_astrometry_comparison(fig: matplotlib.figure.Figure, ax: matplotlib.axes.Axes, match_result: MatchResult) matplotlib.axes.Axes[source]

Plot the astrometry of cross matches from a match result set

Parameters:
  • fig (Figure) – The figure canvas plotting on

  • ax (Axes) – The Axes being plotted on

  • match_result (MatchResult) – The set of sources cross-matched and found in common

Returns:

The Axes plotted on

Return type:

Axes

flint.validation.plot_field_info(fig: matplotlib.figure.Figure, ax: matplotlib.axes.Axes, field_summary: flint.summary.FieldSummary, rms_info: RMSImageInfo, askap_table: astropy.table.Table) matplotlib.axes.Axes[source]
flint.validation.plot_flag_summary(fig: matplotlib.figure.Figure, ax: matplotlib.axes.Axes, field_summary: flint.summary.FieldSummary) matplotlib.axes.Axes[source]

Plot the percentage of the spectrum that is flagged for each measurement set

Parameters:
  • fig (Figure) – The figure canvas that is being plotted to

  • ax (Axes) – The axes object that is being plotted to

  • field_summary (FieldSummary) – An active field summary object with the collection of MSSummary structures

Returns:

The axes object with the plotted RMS image

Return type:

Axes

flint.validation.plot_flux_comparison(fig: matplotlib.figure.Figure, ax: matplotlib.axes.Axes, match_result: MatchResult) matplotlib.axes.Axes[source]

Create a flux comparison plot showing the flux densities from two catalogues compared to one another.

Parameters:
  • fig (Figure) – The figure canvas that the axes is on

  • ax (Axes) – The axes object that will be render the plot

  • match_result (MatchResult) – A result set of the cross-match between two catalogues

Returns:

The aces object that was used for plotting

Return type:

Axes

flint.validation.plot_psf(fig: matplotlib.figure.Figure, ax: matplotlib.axes.Axes, rms_info: RMSImageInfo) matplotlib.axes.Axes[source]

Create a plot highlighting the synthesised beam recorded in the RMS image header

Parameters:
  • fig (Figure) – Fogire canvas being used

  • ax (Axes) – The axes object that will be used for plotting

  • rms_info (RMSImageInfo) – Extracted information from the RMS image

Returns:

The aces object used for plotting

Return type:

Axes

flint.validation.plot_rms_map(fig: matplotlib.figure.Figure, ax: matplotlib.axes.Axes, rms_path: pathlib.Path, source_positions: astropy.coordinates.SkyCoord | None = None) matplotlib.axes.Axes[source]

Add the RMS image to the figure

Parameters:
  • fig (Figure) – Figure that contains the axes object

  • ax (Axes) – The axes that will be plotted

  • rms_path (Path) – Location of the RMS image

  • source_positions (Optional[SkyCoord], optionals) – Sources in the ASKAP catalogue to overlay onto the RMS image. Defaults to None.

Returns:

The axes object with the plotted RMS image

Return type:

Axes

flint.validation.plot_source_counts(catalogue: astropy.table.Table, rms_info: RMSImageInfo, ax: matplotlib.axes.Axes, freq: float | None = None, dezotti: astropy.table.Table | None = None, skads: astropy.table.Table | None = None) matplotlib.axes.Axes[source]

Create a figure of source counts from a astropy Table. If freq and either dezotti / skads are supplied then these precomputed source count tables are also included in the panel.

When computing the source counts for catalogue, only a minimumal set of corrections are derived and applied.

Parameters:
  • catalogue (Table) – The catalogue to derive source counts for

  • rms_info (RMSImageInfo) – Look up information from the RMS file that catalogue was constructed against

  • ax (Axes) – The axes panel the counts will be plottedd on

  • freq (Optional[float], optional) – Frequency that the source catalogue. Used to scale the Dezotti and SKADS tables. Defaults to None.

  • dezotti (Optional[Table], optional) – Loaded reference table of Dezotti source counts. Defaults to None.

  • skads (Optional[Table], optional) – Loaded reference table of SKADS source counts. Defaults to None.

Returns:

The axes object used for plotting

Return type:

Axes

flint.validation.scale_flux_alpha(flux: float | numpy.ndarray, freq: float | numpy.ndarray, ref_freq: float, alpha: float = -0.8) float | numpy.ndarray[source]

Scale a flux density to a reference frequency using a spectral index

Parameters:
  • flux (float) – The flux density to scale

  • freq (float) – The frequency of the flux density

  • ref_freq (float) – The reference frequency to scale to

  • alpha (float, optional) – The spectral index to use. Defaults to -0.8.

Returns:

The scaled flux density

Return type:

float

flint.validation.F_HUGE = 20[source]
flint.validation.F_LARGE = 12[source]
flint.validation.F_MED = 8[source]
flint.validation.F_SMALL = 7[source]
flint.validation.MAX_SOURCES_TO_PLOT = 10000[source]