rascil_rcal
rascil_rcal is a command line app written using RASCIL. It simulates the real-time calibration pipeline RCAL. In the SKA, an initial calibration is performed in real-time as the visibility data are accumulated. An accurate sky model is assumed to be available or a point source model is used.
In rascil_rcal a MeasurementSet is read in and then iterated through in time-order solving for the gains. The gaintables are accumulated into a single gain table that is written as an HDF file.
There is also an additional plotting function that plots the gaintable values (gain amplitude, phase and residual) over time. If plotting is required, please make sure you have the correct path –plot_dir set up. The output file name will contain the datetime of the first time sample in the data.
RFI Flagger
rascil_rcal also implements reading RFI (Radio Frequency Interference) flags and using them as part of the pipeline. Flagging is optional and can be controlled with the flag_rfi argument.
RASCIL’s Visibility object contains a “flags” data array with the same dimensions as the visibilities. This array is updated with the results of the SKA Processing Function Library RFI Flagger, which uses the sum-threshold method for flagging. The RFI flagger requires initial threshold and rho values (both needed to provide a list of thresholds used for finding RFI signal in the data), which can be set via CLI arguments, though we recommend using the defaults at this stage.
Example script
The following runs the real time calibration pipeline on an MS generated by the MID continuum imaging simulations (with an optional input components file):
#!/bin/bash
python3 $RASCIL/rascil/apps/rascil_rcal.py \
--ingest_msname SKA_MID_SIM_custom_B2_dec_-45.0_nominal_nchan100_actual.ms \
--ingest_components_file SKA_MID_SIM_custom_B2_dec_-45.0_nominal_nchan100_components.hdf
There are also additional options if you want the sky model to have primary beams applied. Currently we support internal beam from MID and LOW, or additional beam file (in FITS format). An example:
#!/bin/bash
python3 $RASCIL/rascil/apps/rascil_rcal.py \
--ingest_msname myms.ms \
--ingest_components_file my_components.hdf \
--apply_beam True --ingest_beam_file my_beam.fits \
Command line arguments
RASCIL RCAL simulator
usage: rascil_rcal [-h] [--ingest_msname INGEST_MSNAME]
[--ingest_dd [INGEST_DD ...]] [--logfile LOGFILE]
[--ingest_components_file INGEST_COMPONENTS_FILE]
[--apply_beam APPLY_BEAM]
[--ingest_beam_file INGEST_BEAM_FILE] [--cal_type {T,G}]
[--do_plotting DO_PLOTTING] [--plot_dir PLOT_DIR]
[--use_previous_gaintable USE_PREVIOUS_GAINTABLE]
[--phase_only_solution PHASE_ONLY_SOLUTION]
[--solution_tolerance SOLUTION_TOLERANCE]
[--flag_rfi FLAG_RFI]
[--initial_threshold INITIAL_THRESHOLD] [--rho RHO]
Named Arguments
- --ingest_msname
MeasurementSet to be read
- --ingest_dd
Data descriptors in MS to read (all must have the same number of channels)
Default: [0]
- --logfile
Name of logfile (default is to construct one from msname)
- --ingest_components_file
Name of components file (HDF5/txt) format
- --apply_beam
If yes, apply primary beam correction to the ingested components
Default: False
- --ingest_beam_file
Name of external beam file in FITS format
- --cal_type
Possible choices: T, G
Type of calibration to perform. T=Atmospheric Phase, G=Electronics Gain
Default: “T”
- --do_plotting
If yes, plot the gain table values over time
Default: False
- --plot_dir
Full path of the directory to save the gain plots into (default is the same directory the MS file is located)
- --use_previous_gaintable
Use previous gaintable as starting point for solution
Default: “False”
- --phase_only_solution
Solution should be for phases only
Default: “True”
- --solution_tolerance
Tolerance for solution: stops iteration when changes below this level
Default: 1e-12
- --flag_rfi
Whether to run the RFI flagger (before obtaining calibration solutions), or not.
Default: “False”
- --initial_threshold
The initial threshold to be used by the flagger. Used for calculating a list of thresholds.Note: use default value since flagger is still under development
Default: 8.0
- --rho
The initial rho used by flagger. Used for calculating a list of thresholds. Note: use default value since flagger is still under development
Default: 1.5