flint.leakage

Construct a leakge map between two polarisations, typically V/I

Attributes

Classes

FITSImage

Container to couple FITS header, image and WCS

LeakageFilters

Description of the filtering options to apply to components

PixelCoords

Slim container to help collect and maintain pixel coordinates. Not intended for extensive use

PolStatistics

Simple container for statistics around the extraction of leakage polarisation statistics

Functions

_get_output_catalogue_path(→ pathlib.Path)

Create the output leakage catalogue name

_load_component_table(→ astropy.table.Table)

Return a table given either a loaded table or a path to a table on disk

_load_fits_image(→ FITSImage)

Load in a FITS image and package the components into a consistent

cli(→ None)

create_leakge_component_table(→ pathlib.Path)

Create a component catalogue that includes enough information to describe the

extract_pol_stats_in_box(→ PolStatistics)

Construct two boxes around nominated pixel coordinates to:

filter_components(→ astropy.table.Table)

Apply the pre-processing operations to catalogue components to select an

get_parser(→ argparse.ArgumentParser)

get_xy_pixel_coords(→ PixelCoords)

Convert (RA, Dec) positions in a catalogue into (x, y)-pixels given an WCS

load_and_filter_components(→ astropy.table.Table)

Load in a component catalogue table and apply filters to them. The

Module Contents

class flint.leakage.FITSImage[source]

Bases: NamedTuple

Container to couple FITS header, image and WCS

data: numpy.ndarray[source]

The data of the fits image

header: dict[source]

Header of the fits image

path: pathlib.Path[source]

Path of the loaded FITS image on disk

wcs: astropy.wcs.WCS[source]

Celestial WCS of the fits image

class flint.leakage.LeakageFilters[source]

Bases: NamedTuple

Description of the filtering options to apply to components when characterising leakage

isolation_radius_deg: float = 0.0155[source]

The minimum distance to the nearest component

lower_int_peak_ratio: float = 0.8[source]

The lower limit on acceptable int/peak ratios

mean_box_size: int = 10[source]

The size of abox to compute a local mean measure over

noise_box_size: int = 30[source]

the size of a box to compute a local RMS noise measure from

search_box_size: int = 1[source]

The size of a box to search for peak polarised signal in

source_snr: float = 40[source]

Minimum stokes-I signal-to-noise ratio

upper_int_peak_ratio: float = 1.2[source]

The upper limit on acceptable int/peak ratios

class flint.leakage.PixelCoords[source]

Bases: NamedTuple

Slim container to help collect and maintain pixel coordinates. Not intended for extensive use

x: numpy.ndarray[source]

The x-coordinate of a set of pixels

y: numpy.ndarray[source]

The y-coordinate of a set of pixels

class flint.leakage.PolStatistics[source]

Bases: NamedTuple

Simple container for statistics around the extraction of leakage polarisation statistics

mean: numpy.ndarray[source]

The mean of pixels within a box

noise: numpy.ndarray[source]

The standard deviation of pixels within a box

peak: numpy.ndarray[source]

The peak pixel value

flint.leakage._get_output_catalogue_path(input_path: pathlib.Path, pol: str, output_path: pathlib.Path | None = None) pathlib.Path[source]

Create the output leakage catalogue name

flint.leakage._load_component_table(catalogue: TableOrPath) astropy.table.Table[source]

Return a table given either a loaded table or a path to a table on disk

flint.leakage._load_fits_image(fits_path: pathlib.Path) FITSImage[source]

Load in a FITS image and package the components into a consistent form. Not intended for extensive use.

Parameters:

fits_path (Path) – The path of the FITS image to examining

Returns:

Loaded FITS properties

Return type:

FITSImage

flint.leakage.cli() None[source]
flint.leakage.create_leakge_component_table(pol_image: pathlib.Path, catalogue: astropy.table.Table | pathlib.Path, pol: str = 'v', output_path: pathlib.Path | None = None) pathlib.Path[source]

Create a component catalogue that includes enough information to describe the polarisation fraction of sources across a field. This is intended to be used for leakage characterisation.

New catalogue columns will be added:

  • pol_fraction: The POL/I fraction. The peak flux is taken from the catalogue, using the appropriate column name

  • pol_peak: The peak polarised signal in the nearby region of a component position

  • pol_noise: The noise in the polarised image pixels around the component position

Parameters:
  • pol_image (Path) – The polarised image that will be used to extract peak polarised flux from

  • catalogue (Union[Table, Path]) – Component table describing positions to extract flux from

  • pol (str, optional) – The polarisation stokes being considered. Defaults to “v”.

  • output_path (Optional[Path], optional) – The path of the new catalogue. If None it is derived from the input catalogue path. Defaults to None.

Returns:

Path to the new catalogue use for leakage

Return type:

Path

flint.leakage.extract_pol_stats_in_box(pol_image: numpy.ndarray, pixel_coords: PixelCoords, search_box_size: int, noise_box_size: int, mean_box_size: int) PolStatistics[source]

Construct two boxes around nominated pixel coordinates to:

  • extract the peak signal within

  • calculate a local RMS value for

Parameters:
  • pol_image (np.ndarray) – The loaded polarised image

  • pixel_coords (PixelCoords) – Collection of pixel positioncs to evaluate the peak polarisation and noise at

  • search_box_size (int) – Size of box to extract the maximum polarised signal from

  • noise_box_size (int) – Size of box to calculate the RMS over

  • mean_box_size (int) – Size of box to calculate an mean over

Returns:

Extracted statistics, including peak polarised signal, noise and mean

Return type:

PolStatistics

flint.leakage.filter_components(table: astropy.table.Table, peak_col: str, int_col: str, int_err_col: str, leakage_filters: LeakageFilters, ra_col: str | None = None, dec_col: str | None = None) astropy.table.Table[source]

Apply the pre-processing operations to catalogue components to select an optimal sample of sources for leakage characterisation. Sources will be selected based on:

  • how isolated they are

  • compactness, as traced by their int/peak

Parameters:
  • table (Table) – Collection of sources, as produced from a source finder

  • peak_col (str) – The column name describing the peak flux density

  • int_col (str) – The column name describing integrated flux

  • int_err_col (str) – The column container errors that correspond to int_col to use when computing signal-to-noise

  • leakage_filters (LeakageFilters) – Criteria applied to the source components in the table

  • ra_col (Optional[str], optional) – The RA column name. If None, it will be guessed. Defaults to None.

  • dec_col (Optional[str], optional) – The Dec column name. If None, it will be guessed. Defaults to None.

Returns:

A filtered table

Return type:

Table

flint.leakage.get_parser() argparse.ArgumentParser[source]
flint.leakage.get_xy_pixel_coords(table: astropy.table.Table, wcs: astropy.wcs.WCS, ra_col: str | None = None, dec_col: str | None = None) PixelCoords[source]

Convert (RA, Dec) positions in a catalogue into (x, y)-pixels given an WCS

Parameters:
  • table (Table) – The table containing sources to collect (x, y)-coordinates

  • wcs (WCS) – The WCS description to use to resolve (RA, Dec) to (x, y)

  • ra_col (Optional[str], optional) – The RA column name. If None, it will be guessed. Defaults to None.

  • dec_col (Optional[str], optional) – The Dec column name. If None, it will be guessed. Defaults to None.

Returns:

_description_

Return type:

PixelCoords

flint.leakage.load_and_filter_components(catalogue: TableOrPath, leakage_filters: LeakageFilters) astropy.table.Table[source]

Load in a component catalogue table and apply filters to them. The remaining components will be used to characterise leakage

Parameters:
  • catalogue (TableOrPath) – The path to a component catalogue, or a loaded component catalogue

  • leakage_filters (LeakageFilters) – Filtering options to find ideal components for leakage characterisation

Returns:

Filtered component catalogue

Return type:

Table

flint.leakage.TableOrPath[source]