Applying static RFI mask
The pipeline pulls the channel-dependent RFI mask from the Telescope Model Data Repository and applies it to the visibilities. Therefore, the mask should be uploaded to the repository by the user of this pipeline. Instructions on how to do this are given below.
To apply the mask, the repository hosting the mask should first be set as an environment variable as in the example below:
export SKA_TELMODEL_SOURCES=gitlab://gitlab.com/ska-telescope/ska-telmodel-data?yan-1618-add-rfi-model#tmdata
The --apply_mask command line argument should be given, and the full path to
the RFI file supplied via the --rfi_file command line argument . For example:
--rfi_file instrument/ska1_mid/static-rfi/rfi_mask.h5
The pipeline pulls the mask from the specified location in real time and applies
it to the visibilities. The pipeline is able to extract a smaller mask from the
existing larger mask and apply that to the visibilities if the frequency
channels of the observation are fewer than the RFI mask in the Telescope Model
Data Repository. In such a case, the observing start and end frequencies,
however few, should match those in the mask exactly. If this is not the case,
an error ("Start and end frequencies of observation do not fall exactly within
those of the static RFI mask!") will be raised.
The pipeline cannot apply a mask with less frequency coverage than the
observing frequencies. In such a case, the pipeline will raise an
error ("Observation has more frequency channels than static RFI mask!")
Generating static RFI mask in HDF5 format
The pointing pipeline supports the RFI mask in HDF5 format only. To generate the
mask for your observation, use the
export_staticmasktable_to_hdf5()
as in the example below after installing ska-sdp-datamodels.
from ska_sdp_datamodels.visibility.vis_io_and_convert import StaticMaskTable
from ska_sdp_datamodels.visibility import export_staticmasktable_to_hdf5
# First create the mask table (xarray object) for the mask
mask_table = StaticMaskTable.constructor(frequency, channel_bandwidth, mask)
# Write the mask table to HDF5 format and save to disc
export_staticmasktable_to_hdf5(mask_table, filename)
The arguments are defined as follows:
frequency: Array of the frequencies of your observation in Hz.channel_bandwidth: Array of the bandwidth of your observation in Hz. Has the same length asfrequency.mask: 1-D array of ones and zeros you want to apply. 1 is a flagged channel and 0 is an accepted channel. Themaskhas the same length asfrequency.filename: The filename of the output HDF5 file to be uploaded to the Telescope Model Data Repository.
Uploading the static RFI mask to Telescope Model Data Repository
To upload the mask you have generated with the lines of code above to the Telescope Model Data Repository, follow the steps below:
Create a branch in the repository. Set the
SKA_TELMODEL_SOURCESenvironment variable to point to this branch (in the example aboveyan-1618-add-rfi-modelis the branch name, which you need to replace with yours).Upload the generated mask (in HDF5 format) to
tmdata/instrument/<telescope_name>/static-rfi/rfi_mask.h5. The filename used here should be referenced as the expected file provided to the pipeline with the--rfi_filecommand line argument.