The Field class

The Field class is used to manage the overall state and parameters of observed field, including observations, images, calibration solutions, etc.

class rapthor.lib.field.Field(parset, mininmal=False)

The Field object stores parameters needed for processing of the field

Parameters:
parsetdict

Parset with processing parameters

minimalbool

If True, only initialize the minimal set of required parameters

adjust_sector_boundaries()

Adjusts the imaging sector boundaries for overlaping sources

check_selfcal_progress()

Checks whether selfcal has converged or diverged by comparing the current image noise to that of the previous cycle

Convergence is determined by comparing the noise and dynamic range ratios to self.convergence_ratio, which is the minimum ratio of the current noise to the previous noise above which selfcal is considered to have converged (must be in the range 0.5 – 2). E.g., self.convergence_ratio = 0.95 means that the image noise must decrease by ~ 5% or more from the previous cycle for selfcal to be considered as not yet converged. The same is true for the dynamic range but reversed (the dynamic range must increase by ~ 5% or more from the previous cycle for selfcal to be considered as not yet converged).

Divergence is determined by comparing the noise ratio to self.divergence_ratio, which is the minimum ratio of the current noise to the previous noise above which selfcal is considered to have diverged (must be >= 1). E.g., divergence_ratio = 1.1 means that, if image noise worsens by ~ 10% or more from the previous cycle, selfcal is considered to have diverged

Returns:
converged, divergedtuple of bools
The selfcal state, where (converged, diverged) is one of:

(True, False) - if selfcal has converged (False, False) - if selfcal has not yet converged (or diverged) (False, True) - if selfcal has diverged

chunk_observations(data_fraction=1.0)

Break observations into smaller time chunks if desired

Chunking is done if:

  • the specified data_fraction < 1 (so part of an observation is to be processed)

  • nobs * nsectors < nnodes (so all nodes can be used efficiently. In particular, the predict pipeline parallelizes over sectors and observations, so we need enough observations to allow all nodes to be occupied.)

Parameters:
data_fractionfloat, optional

Fraction of data to use during processing

define_bright_source_sectors(index)

Defines the bright source sectors

Parameters:
indexint

Iteration index

define_imaging_sectors()

Defines the imaging sectors

define_outlier_sectors(index)

Defines the outlier sectors

Parameters:
indexint

Iteration index

find_intersecting_sources()

Finds sources that intersect with the intial sector boundaries

Returns:
intersecting_source_polys: list of Polygons

List of source polygons that intersect one or more sector boundaries

get_obs_parameters(parameter)

Returns list of parameters for all observations

Parameters:
parameterstr

Name of parameter to return

Returns:
parameterslist

List of parameters of each observation

makeWCS()

Makes simple WCS object

Returns:
wastropy.wcs.WCS object

A simple TAN-projection WCS object for specified reference position

make_outlier_skymodel()

Make a sky model of any outlier calibration sources, not included in any imaging sector

make_skymodels(skymodel_true_sky, skymodel_apparent_sky=None, regroup=True, find_sources=False, target_flux=None, target_number=None, index=0)

Groups a sky model into source and calibration patches

Grouping is done on the apparent-flux sky model if available. Note that the source names in the true- and apparent-flux models must be the same (i.e., the only differences between the two are the fluxes and spectral indices)

Parameters:
skymodel_true_skystr or LSMTool skymodel object

Filename of input makesourcedb true-flux sky model file

skymodel_apparent_skystr or LSMTool skymodel object, optional

Filename of input makesourcedb apparent-flux sky model file

regroupbool, optional

If False, the calibration sky model is not regrouped to the target flux. Instead, the existing calibration groups are used

find_sourcesbool, optional

If True, group the sky model by thresholding to find sources. This is not needed if the input sky model was filtered by PyBDSF in the imaging pipeline

target_fluxfloat, optional

Target flux in Jy for grouping

target_numberint, optional

Target number of patches for grouping

indexindex

Iteration index

radec2xy(RA, Dec)

Returns x, y for input RA, Dec

Parameters:
RAlist

List of RA values in degrees

Declist

List of Dec values in degrees

Returns:
x, ylist, list

Lists of x and y pixel values corresponding to the input RA and Dec values

scan_observations()

Checks input MS files and initializes the associated Observation objects

set_obs_parameters()

Sets parameters for all observations from current parset and sky model

transfer_patches(from_skymodel, to_skymodel, patch_dict=None)

Transfers the patches defined in from_skymodel to to_skymodel.

Parameters:
from_skymodelsky model

Sky model from which to transfer patches

to_skymodelsky model

Sky model to which to transfer patches

patch_dictdict, optional

Dict of patch positions

Returns:
to_skymodelsky model

Sky model with patches matching those of from_skymodel

update(step_dict, index, final=False)

Updates parameters, sky models, etc. for current step

Parameters:
step_dictdict

Dict of parameter values for given iteration

indexint

Index of iteration

finalbool, optional

If True, process as the final pass (combine initial and new sky models and rechunk the input datasets)

update_skymodels(index, regroup, target_flux=None, target_number=None, final=False)

Updates the source and calibration sky models from the output sector sky model(s)

Parameters:
indexint

Iteration index (counts starting from 1)

regroupbool

Regroup sky model

target_fluxfloat, optional

Target flux in Jy for grouping

target_numberint, optional

Target number of patches for grouping

finalbool, optional

If True, process as the final pass (combine initial and new sky models)

xy2radec(x, y)

Returns input RA, Dec for input x, y

Parameters:
xlist

List of x values in pixels

ylist

List of y values in pixels

Returns:
RA, Declist, list

Lists of RA and Dec values corresponding to the input x and y pixel values