flint.sky_model

Attributes

KNOWN_1934_FILES

Known models of PKS B1934-638 in different formats

KNOWN_CATAS

Known sky-model catalogues that have had some pre-processing operations applied. Discuss with maintainers for access,

KNOWN_PB_TYPES

NORM_COLS

Normalised column names and their corresponding astropy units.

Classes

AiryResponse

Container describing a airy disc response

CurvedPL

Container for results of a Curved Power Law,

GaussianResponse

Container describing a simple Gaussian taper

SincSquaredResponse

Container describing a sinc-squared response

SkyModel

Description of the derived sky-model

SkyModelOptions

Options that describe how to build a local sky-model, including

SkyModelOutputPaths

Holds the expected names for different type of sky model outputs

Functions

_jinc(x)

cli(→ None)

create_sky_model(→ SkyModel | None)

Create a sky-model to calibrate RACS based measurement sets.

curved_power_law(→ numpy.ndarray)

A curved power law model.

evaluate_src_model(→ astropy.units.Jy)

Evaluate a SED of an object using its recordded

fit_curved_pl(→ CurvedPL)

Fit some specified set of datapoints with a generic

generate_airy_pb(→ AiryResponse)

Calculate the theoretical airy response of an aperture of

generate_gaussian_pb(→ GaussianResponse)

Calculate the theoretical Gaussian taper for an aperture of

generate_pb(...)

Generate the primary beam response using a set of physical quantities. Each

generate_sinc_squared_pb(→ SincSquaredResponse)

Calculate the theoretical sinc-squared response of an aperture of

get_1934_model(→ pathlib.Path)

Construct the path to a 1934-638 model. This is intended to calibrate

get_known_catalogue(→ flint.catalogue.Catalogue)

Get the parameters of a known catalogue

get_parser()

get_sky_model_output_paths(→ SkyModelOutputPaths)

Create a set of expected sky model output file paths

load_catalogue(→ tuple[flint.catalogue.Catalogue, ...)

Load in a catalogue table given a name or measurement set declinattion.

make_calibrate_model(→ pathlib.Path)

Create a sky-model file that is compatible with the AO Calibrate software

make_ds9_region(→ pathlib.Path)

Create a DS9 region file of the sky-model derived

make_hyperdrive_model(→ pathlib.Path)

Writes a Hyperdrive sky-model to a yaml file.

preprocess_catalogue(→ astropy.table.QTable)

Apply the flux and separation cuts to a loaded table, and transform input column names to an

Module Contents

class flint.sky_model.AiryResponse[source]

Bases: NamedTuple

Container describing a airy disc response

atten: numpy.ndarray[source]

The attenuation of the response

freqs: numpy.ndarray[source]

The frequencies the beam is evaluated at

fwhms: numpy.ndarray[source]

The full-width at half-maximum corresponding to freqs

offset: float[source]

Angular offset of the source

class flint.sky_model.CurvedPL[source]

Bases: NamedTuple

Container for results of a Curved Power Law,

>>> S_nu = S_nu_0 * (nu/nu_0)**alpha * exp(q*ln(nu/nu_0)**2.)

Note that in the case of q=0. the model reduces to a normal power-law.

alpha: float[source]

The fitted spectral index

norm: float[source]

The fitted normalisation of the fitted model

q: float[source]

The fitted curvature of the spectral index

ref_nu: float[source]

The nominated reference frequency

class flint.sky_model.GaussianResponse[source]

Bases: NamedTuple

Container describing a simple Gaussian taper

atten: numpy.ndarray[source]

The attenuation of the response

freqs: numpy.ndarray[source]

The frequencies the beam is evaluated at

fwhms: numpy.ndarray[source]

The full-width at half-maximum corresponding to freqs

offset: float[source]

Angular offset of the source

class flint.sky_model.SincSquaredResponse[source]

Bases: NamedTuple

Container describing a sinc-squared response

atten: numpy.ndarray[source]

The attenuation of the response

freqs: numpy.ndarray[source]

The frequencies the beam is evaluated at

fwhms: numpy.ndarray[source]

The full-width at half-maximum corresponding to freqs

offset: float[source]

Angular offset of the source

class flint.sky_model.SkyModel[source]

Bases: NamedTuple

Description of the derived sky-model

apparent: bool = True[source]

Whether the sources and model are absolute of apparent fluxes

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

Path to the sky-model file created to use with calibrate

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

Path to the DS9 region file representing the sky-model

flux_jy: float[source]

Total flux in Jansky

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

Path to the sky-model file created to use with hyperdrive

no_sources: int[source]

Number of source that are included in the sky-model

class flint.sky_model.SkyModelOptions(/, **data: Any)[source]

Bases: flint.options.BaseOptions

Options that describe how to build a local sky-model, including where reference catalogues are stored, the preferred catalogue, the types of models to produce, and filtering criteria

assumed_alpha: float = -0.83[source]

Assume this to be the typical spectral index if it is not recorded in the reference catalogue

assumed_q: float = 0.0[source]

Assume this to be the typical amount of spectral curvature should they not be in the reference catalogue

flux_cutoff: float = 0.02[source]

The intrinsic brightness a source needs to be for it to be included in the sky model

fwhm_scale_cutoff: float = 1[source]

A source needs to be within this many FWHM units from the direction of interest for it to be included

reference_catalogue_directory: pathlib.Path[source]

The reference catalogue directory that contains the known flint reference catalogues

reference_name: str | None = None[source]
write_calibrate_model: bool = False[source]

Should the model for calibrate be created. The output will have .calibrate.txt suffix appended to the MS path.

write_ds9_region: bool = False[source]

Should a DS9 region file be created. The output will have .ds9.reg suffix appended to the MS path.

write_hyperdrive_model: bool = False[source]

Should the model for hyperdrive be created. The output will have .hypderdrive.yaml suffix appended to the MS path.

class flint.sky_model.SkyModelOutputPaths[source]

Bases: NamedTuple

Holds the expected names for different type of sky model outputs

calibrate_path: pathlib.Path[source]

Path of the calibrate style sky catalogue

hyperdrive_path: pathlib.Path[source]

Path of the hyperdrive style sky catalogue

region_path: pathlib.Path[source]

Path of the ds9 region file

flint.sky_model._jinc(x)[source]
flint.sky_model.cli() None[source]
flint.sky_model.create_sky_model(ms_path: pathlib.Path, sky_model_options: SkyModelOptions) SkyModel | None[source]

Create a sky-model to calibrate RACS based measurement sets.

If no sources were selected then None is returned.

Parameters:
  • ms_path (Path) – Measurement set to create sky-model for

  • sky_model_options (SkyModelOptions) – Options to use to construct the sky model

Returns:

SkyModel | None – Basic informattion concerning the sky-model derived and the output files. If no sources were selected then None is returned.

flint.sky_model.curved_power_law(nu: numpy.ndarray, norm: float, alpha: float, beta: float, ref_nu: float) numpy.ndarray[source]

A curved power law model.

>>> S_nu = S_nu_0 * (nu/nu_0)**alpha * exp(q*ln(nu/nu_0)**2.)

Note that in the case of q=0. the model reduces to a normal power-law.

Parameters:
  • nu (np.ndarray) – Frequency array.

  • norm (float) – Reference flux.

  • alpha (float) – Spectral index.

  • beta (float) – Spectral curvature.

  • ref_nu (float) – Reference frequency.

Returns:

Model flux.

Return type:

np.ndarray

flint.sky_model.evaluate_src_model(freqs: astropy.units.Quantity, src_row: astropy.table.row.Row, ref_nu: astropy.units.Quantity) astropy.units.Jy[source]

Evaluate a SED of an object using its recordded Normalisation, alpha and q components.

Parameters:
  • freqs (u.Quantity) – Frequencies to evaluate

  • src_row (Row) – Source propertieis from which the parameters are extracted

  • ref_nu (u.Quantity) – Reference frequency of the model parameterization

Returns:

Brightness of model evaluated across frequency

Return type:

u.Jy

flint.sky_model.fit_curved_pl(freqs: astropy.units.Quantity, flux: astropy.units.Quantity, ref_nu: astropy.units.Quantity) CurvedPL[source]

Fit some specified set of datapoints with a generic curved powerlaw. This is _not_ meant for real data, ratther as a way of representing the functional form of a model after it has been perturbed by some assumed primary beam.

Parameters:
  • freqs (np.ndarray) – Frequencies corresponding to each brightness

  • flux (np.ndarray) – Brightness corresponding to each frequency

  • ref_nu (float) – Reference frequency that the model is set to

Returns:

The fitted parameter results

Return type:

CurvedPL

flint.sky_model.generate_airy_pb(freqs: astropy.units.Quantity, aperture: astropy.units.Quantity, offset: astropy.units.Quantity) AiryResponse[source]

Calculate the theoretical airy response of an aperture of a known size.

Parameters:
  • reqs (u.Quantity) – Frequencies to evaluate the beam at

  • aperture (u.Quantity) – Size of the dish

  • offset (u.Quantity) – Offset from the centre of the beam

Returns:

Numerical results of the theoretical sinc-squared primary beam

Return type:

AiryResponse

flint.sky_model.generate_gaussian_pb(freqs: astropy.units.Quantity, aperture: astropy.units.Quantity, offset: astropy.units.Quantity) GaussianResponse[source]

Calculate the theoretical Gaussian taper for an aperture of known size

Parameters:
  • freqs (u.Quantity) – Frequencies to evaluate the beam at

  • aperture (u.Quantity) – Size of the dish

  • offset (u.Quantity) – Offset from the centre of the beam

Returns:

Numerical results of the theoretical gaussian primary beam

Return type:

GaussianResponse

flint.sky_model.generate_pb(pb_type: str, freqs: astropy.units.Quantity, aperture: astropy.units.Quantity, offset: astropy.units.Quantity) GaussianResponse | SincSquaredResponse | AiryResponse[source]

Generate the primary beam response using a set of physical quantities. Each is assumed to be rotationally invariant, so a 1-D slice can be evaluated.

Known approximations are:

  • gaussian

  • sincsquared

  • airy

Parameters:
  • pb_type (str) – The type of approximation to use

  • freqs (u.Quantity) – The frequency to valuate at.

  • aperture (u.Quantity) – The size of the dish

  • offset (u.Quantity) – The distance to measure out to

Raises:

ValueError – Raised if pb_type is not known

Returns:

Constructed primary beam responses

Return type:

Union[GaussianResponse, SincSquaredResponse, AiryResponse]

flint.sky_model.generate_sinc_squared_pb(freqs: astropy.units.Quantity, aperture: astropy.units.Quantity, offset: astropy.units.Quantity) SincSquaredResponse[source]

Calculate the theoretical sinc-squared response of an aperture of a known size.

See Equation 3.78 and 3.79 from: https://www.cv.nrao.edu/~sransom/web/Ch3.html

Parameters:
  • reqs (u.Quantity) – Frequencies to evaluate the beam at

  • aperture (u.Quantity) – Size of the dish

  • offset (u.Quantity) – Offset from the centre of the beam

Returns:

Numerical results of the theoretical sinc-squared primary beam

Return type:

SincSquaredResponse

flint.sky_model.get_1934_model(mode: str = 'calibrate') pathlib.Path[source]

Construct the path to a 1934-638 model. This is intended to calibrate the bandpass.

Parameters:

mode (str, optional) – Calibration software intended to be used. This will determine model file to load. Supported modes are ‘calibrate’. Defaults to ‘calibrate’.

Raises:

ValueError – When supplied ‘mode’ is not known.

Returns:

Path to 1934-638 calibration model.

Return type:

Path

flint.sky_model.get_known_catalogue(cata: str) flint.catalogue.Catalogue[source]

Get the parameters of a known catalogue

TODO: Replace with configuration based method to load known cata

Parameters:

cata (str) – The lookup name of the catalogue

Returns:

properties of known catalogue

Return type:

Catalogue

flint.sky_model.get_parser()[source]
flint.sky_model.get_sky_model_output_paths(ms_path: pathlib.Path) SkyModelOutputPaths[source]

Create a set of expected sky model output file paths

Parameters:

ms_path (Path) – The base name to construct the names against

Raises:

ValueError – If it appears ms_path does not point to a measurement set

Returns:

The set of paths to use when creating models

Return type:

SkyModelOutputPaths

flint.sky_model.load_catalogue(catalogue_dir: pathlib.Path, catalogue: str | None = None, ms_pointing: astropy.coordinates.SkyCoord | None = None, assumed_alpha: float = -0.83, assumed_q: float = 0.0) tuple[flint.catalogue.Catalogue, astropy.table.Table][source]

Load in a catalogue table given a name or measurement set declinattion.

Parameters:
  • catalogue_dir (Path) – Directory containing known catalogues

  • catalogue (Optional[str], optional) – Catalogue name to look up from known catalogues. Defaults to None.

  • ms_pointing (Optional[SkyCoord], optional) – Pointing direction of the measurement set. Defaults to None.

  • assumed_alpha (float, optional) – The assumed spectral index to use if there is no spectral index column known in model catalogue. Defaults to -0.83.

  • assumed_q (float, optional) – The assumed curvature to use if there is no curvature column known in model catalogue. Defaults to 0.0.

Raises:

FileNotFoundError – Raised when a catalogue can not be resolved.

Returns:

The Catalogue information and Table of components loaded

Return type:

Tuple[Catalogue,Table]

flint.sky_model.make_calibrate_model(out_path: pathlib.Path, sources: list[tuple[astropy.table.row.Row, CurvedPL]]) pathlib.Path[source]

Create a sky-model file that is compatible with the AO Calibrate software

Parameters:
  • out_path (Path) – Output path of the model file

  • sources (List[Tuple[Row,CurvedPL]]) – The sources and their (apparent) SED to write

Returns:

Output path of the model file

Return type:

Path

flint.sky_model.make_ds9_region(out_path: pathlib.Path, sources: list[astropy.table.row.Row]) pathlib.Path[source]

Create a DS9 region file of the sky-model derived

Parameters:
  • out_path (Path) – Output path to of the region file to write

  • sources (List[Row]) – Collection of Row objects (with normalised column names)

Returns:

Path to the region file created

Return type:

Path

flint.sky_model.make_hyperdrive_model(out_path: pathlib.Path, sources: list[tuple[astropy.table.row.Row, CurvedPL]]) pathlib.Path[source]

Writes a Hyperdrive sky-model to a yaml file.

Parameters:
  • out_path (Path) – The output path that the sky-model would be written to

  • sources (List[Tuple[Row,CurvedPL]]) – Collection of sources to write, including the

  • SED (normalized row and the results of fitting to the estimated apparent)

Returns:

The path of the file created

Return type:

Path

flint.sky_model.preprocess_catalogue(cata_info: flint.catalogue.Catalogue, cata_tab: astropy.table.Table, ms_pointing: astropy.coordinates.SkyCoord, flux_cut: float = 0.02, radial_cut: astropy.units.deg = 1.0 * u.deg) astropy.table.QTable[source]

Apply the flux and separation cuts to a loaded table, and transform input column names to an expected set of column names.

Parameters:
  • cata_info (Catalogue) – Description of the catalogue from known catalogues

  • cata_tab (Table) – The loaded catalogue table

  • ms_pointing (SkyCoord) – Pointing of the measurement set

  • flux_cut (float, optional) – Flux cut in Jy. Defaults to 0.02.

  • radial_cut (u.deg, optional) – Radial separation cut in deg. Defaults to 1..

Returns:

_description_

Return type:

QTable

flint.sky_model.KNOWN_1934_FILES[source]

Known models of PKS B1934-638 in different formats

flint.sky_model.KNOWN_CATAS: dict[str, flint.catalogue.Catalogue][source]

Known sky-model catalogues that have had some pre-processing operations applied. Discuss with maintainers for access,

flint.sky_model.KNOWN_PB_TYPES = ('gaussian', 'sincsquared', 'airy')[source]
flint.sky_model.NORM_COLS[source]

Normalised column names and their corresponding astropy units.