flint.validation¶
Utility function to create a one figure multi panel validation plot for continuum imaging of RACS data
Attributes¶
Classes¶
Simple container to hold results of a quick cross match |
|
Something that is only used to internally |
|
Class to hold basic RMS Image information, excluding the actual raw image data |
|
A small container to pass around source count information |
|
Container for all the tables that are loaded in |
|
Container for all the catalogues that are loaded in and |
|
Container for all the tables that are generated by the validation routine |
|
Simple container for all the matplotlib axes objects |
|
Container for all the cross matched tables |
Functions¶
|
Collects the information required of a single beam image |
|
This derives a rough correction to the area term when calculating |
|
CLI entry point for validation plot creation |
|
Create a simple multi-panel validation figure intended to asses |
|
Create a set of validation tables that can be used to assess the |
|
Extract an inner region of an image array. The size of the extracted array |
|
Return the parameters of a recognised catalogue. |
|
Create the argument parser for the validation plot creation |
|
Extract information about the RMS image and construct a representative structure |
|
Derive source counts for a set of fluxes and known area |
|
Load in all the catalogues that are required for the validation. |
|
Load in a known catalogue table |
|
|
|
|
|
Create the figure layout to use for the quick look validation plot. |
|
Create a simple cross match table between two catalogues |
|
Match two catalogues together, and construct common properties. |
|
Plot the astrometry of cross matches from a match result set |
|
|
|
Plot the percentage of the spectrum that is flagged for |
|
Create a flux comparison plot showing the flux densities from two catalogues compared |
|
Create a plot highlighting the synthesised beam recorded in the |
|
Add the RMS image to the figure |
|
Create a figure of source counts from a astropy Table. If |
|
Scale a flux density to a reference frequency using a spectral index |
Module Contents¶
- class flint.validation.MatchResult[source]¶
Bases:
NamedTupleSimple container to hold results of a quick cross match
- class flint.validation.PSFTableRow[source]¶
Bases:
NamedTupleSomething that is only used to internally represent the PSF information of a beam image. Currently no reason to use this.
- class flint.validation.RMSImageInfo[source]¶
Bases:
NamedTupleClass to hold basic RMS Image information, excluding the actual raw image data
- class flint.validation.SourceCounts[source]¶
Bases:
NamedTupleA 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
- class flint.validation.Tables[source]¶
Bases:
NamedTupleContainer for all the tables that are loaded in
- class flint.validation.ValidationCatalogues[source]¶
Bases:
NamedTupleContainer 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:
NamedTupleContainer for all the tables that are generated by the validation routine
- xmatch_tables: XMatchTables[source]¶
Cross-matched tables
- class flint.validation.ValidatorLayout[source]¶
Bases:
NamedTupleSimple container for all the matplotlib axes objects
- 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
- class flint.validation.XMatchTables[source]¶
Bases:
NamedTupleContainer for all the cross matched tables
- 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:
- 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.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:
- 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:
- 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
RMSImageInfoare 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:
- 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:
- 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:
- 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:
- Returns:
Object containing source matches and common properties
- Return type:
- 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