flint.sky_model¶
Attributes¶
Known models of PKS B1934-638 in different formats |
|
Known sky-model catalogues that have had some pre-processing operations applied. Discuss with maintainers for access, |
|
Normalised column names and their corresponding astropy units. |
Classes¶
Container describing a airy disc response |
|
Container for results of a Curved Power Law, |
|
Container describing a simple Gaussian taper |
|
Container describing a sinc-squared response |
|
Description of the derived sky-model |
|
Options that describe how to build a local sky-model, including |
|
Holds the expected names for different type of sky model outputs |
Functions¶
|
|
|
|
|
Create a sky-model to calibrate RACS based measurement sets. |
|
A curved power law model. |
|
Evaluate a SED of an object using its recordded |
|
Fit some specified set of datapoints with a generic |
|
Calculate the theoretical airy response of an aperture of |
|
Calculate the theoretical Gaussian taper for an aperture of |
|
Generate the primary beam response using a set of physical quantities. Each |
|
Calculate the theoretical sinc-squared response of an aperture of |
|
Construct the path to a 1934-638 model. This is intended to calibrate |
|
Get the parameters of a known catalogue |
|
Create a set of expected sky model output file paths |
|
Load in a catalogue table given a name or measurement set declinattion. |
|
Create a sky-model file that is compatible with the AO Calibrate software |
|
Create a DS9 region file of the sky-model derived |
|
Writes a Hyperdrive sky-model to a yaml file. |
|
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:
NamedTupleContainer describing a airy disc response
- class flint.sky_model.CurvedPL[source]¶
Bases:
NamedTupleContainer 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.
- class flint.sky_model.GaussianResponse[source]¶
Bases:
NamedTupleContainer describing a simple Gaussian taper
- class flint.sky_model.SincSquaredResponse[source]¶
Bases:
NamedTupleContainer describing a sinc-squared response
- class flint.sky_model.SkyModel[source]¶
Bases:
NamedTupleDescription of the derived sky-model
- 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
- class flint.sky_model.SkyModelOptions(/, **data: Any)[source]¶
Bases:
flint.options.BaseOptionsOptions 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
- 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.
- class flint.sky_model.SkyModelOutputPaths[source]¶
Bases:
NamedTupleHolds the expected names for different type of sky model outputs
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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_CATAS: dict[str, flint.catalogue.Catalogue][source]¶
Known sky-model catalogues that have had some pre-processing operations applied. Discuss with maintainers for access,