VLA-S-CASA Pipeline-CASA6.2.1: Difference between revisions

From CASA Guides
Jump to navigationJump to search
 
(211 intermediate revisions by 4 users not shown)
Line 3: Line 3:




S-band===============================
== Introduction ==


== Introduction ==
When VLA observations are complete, the raw data need to be calibrated and imaged for scientific applications. This is achieved through various steps as explained in the [https://casaguides.nrao.edu/index.php/Karl_G._Jansky_VLA_Tutorials VLA CASA tutorials.] The different calibration procedures are also bundled in a general VLA calibration pipeline that is described on the [http://go.nrao.edu/vla-pipe VLA pipeline webpage.] The pipeline can also include continuum target imaging.
 
At NRAO, the calibration portion of the pipeline is executed on every science scheduling block (SB) that the VLA observes successfully. Target imaging is left to the user, who can run either the imaging pipeline steps (cf. the [https://science.nrao.edu/facilities/vla/data-processing/pipeline/VIPL VLA pipeline imaging webpage]) or revert to manual imaging as explained in the [https://casaguides.nrao.edu/index.php/Karl_G._Jansky_VLA_Tutorials VLA CASA tutorials].
The [http://go.nrao.edu/vla-pipe VLA pipeline webpage] describes how to run, modify, and re-execute the VLA pipeline. There are also instructions on how to restore archived pipeline products as well as a list of known issues. In the following material, we provide an example of a VLA pipeline weblog (calibration and imaging), explain the different pipeline stages, and  describe some of the diagnostic information and plots. Frequent issues with VLA data, and how to address them with the pipeline are discussed on the [[Pipeline: Frequent VLA problems]] page, where signatures and treatment of problematic data are discussed.


When VLA observations are complete, the raw data need to be calibrated for scientific applications. This is achieved through various steps, as explained in the [https://casaguides.nrao.edu/index.php/Karl_G._Jansky_VLA_Tutorials VLA CASA tutorials.] The different calibration procedures are also bundled in a general VLA calibration pipeline that is described on the [http://go.nrao.edu/vla-pipe VLA pipeline webpage.] At NRAO, the pipeline is executed on every science scheduling block (SB) that the VLA observes successfully. At this time, scientific target imaging is not part of the VLA pipeline. Manual imaging steps, however, are explained in the [https://casaguides.nrao.edu/index.php/Karl_G._Jansky_VLA_Tutorials VLA CASA tutorials].
The following data are VLA S-band continuum observations of the galaxy 3C75, a bright radio galaxy. The pipeline calibration discussed here can be followed up by polarization calibration and imaging as described in the CASA guide [https://casaguides.nrao.edu/index.php/Polarization_Calibration_based_on_CASA_pipeline_standard_reduction:_The_radio_galaxy_3C75 Polarization Calibration based on CASA pipeline (3C75)].
The  [http://go.nrao.edu/vla-pipe VLA pipeline webpage] describes how to run, modify, and re-execute the VLA pipeline. There are also instructions on how to restore archived pipeline products as well as a list of known issues.  In the following material, we provide an example of a VLA pipeline weblog, explain the different pipeline stages, describe some of the diagnostic information and plots, and point out potential issues with the data or the pipeline results.


== The Pipeline Weblog ==
== The Pipeline Weblog ==


The pipeline run can be inspected through a weblog that is launched by pointing a web browser to ''file:///<path to your working directory>/pipelineTIME/html/index.html'' . Note that we regularly test the weblog on Firefox but less so on other browsers. So if you don't use Firefox, there's a chance that not all items are displayed correctly.  
The pipeline run can be inspected through a weblog that is launched by pointing a web browser to ''file:///<path to your working directory>/pipelineTIME/html/index.html''. Note that we regularly test the weblog on Firefox but less so on other browsers. So if you don't use Firefox, there's a chance that not all items are displayed correctly. Additionally, some browser security features may prevent the weblog from being displayed. The weblog may actually show a warning and a solution in the browser.  


The following discussion is based on a weblog that can be viewed through the following link:  
The following discussion is based on a weblog that can be viewed through the following link:  
Line 19: Line 21:




Alternatively, the weblog can be downloaded from [https://casa.nrao.edu/Data/EVLA/Pipeline/VLApipe-guide-weblog-CASA6.2.1.tar.gz https://casa.nrao.edu/Data/EVLA/Pipeline/VLApipe-guide-weblog-CASA6.2.1.tar.gz] (188 MB)  
Alternatively, the weblog can be downloaded from [https://casa.nrao.edu/Data/EVLA/Pipeline/VLApipe-Sguide-weblog-CASA6.2.1.tar.gz https://casa.nrao.edu/Data/EVLA/Pipeline/VLApipe-Sguide-weblog-CASA6.2.1.tar.gz] (25 MB)  


and extracted via:
and extracted via:
Line 28: Line 30:
</source>
</source>


then point your browser to '''html/index.html''' (as of CASA 6.2.1 Firefox seems to work best, although there can be a security setting that needs to be set first; the weblog will prompt you with instructions if this is the case. Chrome may not show all items properly unless started like ''Chrome --args --allow-file-access-from-files /path/to/weblog//html/index.html'').
then point your browser to '''html/index.html''' (as of CASA 6.2.1 there can be a security setting in Firefox that needs to be set first; the weblog will prompt you with instructions if this is the case [frequently go to "about:config" in FIrefox and set security.fileuri.strict_origin_policy to false]). Chrome may not show all items properly unless started like ''Chrome --args --allow-file-access-from-files /path/to/weblog//html/index.html'').


At the top of the landing page one can find the items '''Home''' (the index.html landing page), '''By Topic''' and '''By Task''' that  provide navigation through the pipeline results.  
At the top of the landing page one can find the items '''Home''' (the index.html landing page), '''By Topic''' and '''By Task''' that  provide navigation through the pipeline results.  
Line 34: Line 36:
=== Home Screen ===
=== Home Screen ===


The [https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/ Home page] of the weblog (Fig. 1) contains essential information such as the project archive code, the PI name, and the start and end time of the observations. The CASA and pipeline versions that were used for the pipeline run are also listed on this page, as well as a table with the MS name, receiver bands, number of antennas, on source time, min/max baseline lengths, the atmospheric phase monitor rms, and the file size. The data were processed with earth orientation parameters that were available at the time of the processing. The pipeline uses predicted parameters when current ones are not available. The respected file versions for predicted and evaluated earth orientation parameters are listed under "IERSpredict" and "IERSeop2000", as provided by the [https://www.iers.org/IERS/EN/Science/EarthRotation/EOP.html International Earth Rotation and Reference System Service] (IERS). Note that it usually takes a few months until the IERS re-evaluates and publishes updated earth orientation parameters. Whereas the actual numbers of the data products change numerically after obtaining new parameters, the differences for VLA data are usually small and scientifically insignificant.
The [https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/ Home page] of the weblog (Fig. 1) contains essential information such as the project archive code, the PI name, and the start and end time of the observations. The CASA and pipeline versions that were used for the pipeline run are also listed on this page, as well as a table with the MS name, receiver bands, number of antennas, on source time, min/max baseline lengths and their rms, and the file size BEFORE CALIBRATION (after processing and adding the MODEL and CORRECTED_DATA columns, the file size triples, as seen in Stage 13: applycals). The data were processed with earth orientation parameters that were available at the time of the processing. The pipeline uses predicted parameters when current ones are not available. The respected file versions for predicted and evaluated earth orientation parameters are listed under "IERSpredict" and "IERSeop2000", as provided by the [https://www.iers.org/IERS/EN/Science/EarthRotation/EOP.html International Earth Rotation and Reference System Service] (IERS). Note that it usually takes a few months until the IERS re-evaluates and publishes updated earth orientation parameters. While the actual numbers of the data products change numerically after obtaining new parameters, the differences for VLA data are usually small and scientifically insignificant.
 
Since we also include target imaging, the weblog displays two MeasurementSets, the full one used for calibration, and one that only contains the target data.  


[[Image:VLApipe-S-home-CASA6.2.1.png|400px|thumb|center|Fig. 1: The main page of the weblog]]
[[Image:VLApipe-S-home-CASA6.2.1.png|400px|thumb|center|Fig. 1: The main page of the weblog]]
Line 40: Line 44:
=== Overview Screen ===
=== Overview Screen ===


An [https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/t2-1.html?sidebar=sidebar_13A_398_sb17165245_eb19476558_56374_213876608796_ms&subpage=t2-1_details.html Overview] of the observations (Fig. 2) can be obtained by clicking on the MS name.
An [https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-1.html?sidebar=sidebar_13A_398_sb17165245_eb19476558_56374_213876608796_ms&subpage=t2-1_details.html Overview] of the observations (Fig. 2) can be obtained by clicking on the MS name. As mentioned above, we look at the first MS, which is the full MS that is used for calibration.


[[Image:VLApipe-S-overview-CASA6.2.1.png |400px|thumb|center|Fig. 2: The weblog overview page.]]
[[Image:VLApipe-S-overview-CASA6.2.1.png |400px|thumb|center|Fig. 2: The weblog overview page.]]
   
   


This page provides additional information about the observation. It includes ''Observation Execution Time'' (date, time on source), ''Spatial Setup'' (science target and calibrator field names), ''Antenna Setup'' (min/max baseline lengths, number of antennas and baselines), ''Spectral Setup'' (band designations, including VLA baseband information; science bands include most calibrators, but exclude pointing and setup scans), and ''Sky Setup'' (min/max elevation). The page also provides graphical overviews of the scan intent and field ID observing sequence. A plot with weather information is also included. Clicking the blue headers provides additional information on each topic.  
This page provides additional information about the observation. It includes ''Observation Execution Time'' (date, time on source in UTC), ''Spatial Setup'' (science target and calibrator field names), ''Antenna Setup'' (min/max baseline lengths, number of antennas and baselines), ''Spectral Setup'' (band designations, including VLA baseband information; science bands include most calibrators, but exclude pointing and setup scans), and ''Sky Setup'' (min/max elevation). The page also provides graphical overviews of the scan intent and field ID observing sequence. A plot with weather information is also included. Clicking the blue headers provides additional information on each topic.  




Line 55: Line 59:




The '''Antenna Setup''' (Fig. 4) page lists the locations of all antennas (antenna pad name and offset from array center) and contains graphical location plots for the array configuration (one linear and one logarithmically scaled for better separation of close antenna labels). A third plot shows a representative uv-coverage. On a second tab, baseline lengths are listed and the 'percentile' column provides a rough indication of how many baselines are shorter than that in each row.  
The '''Antenna Setup''' (Fig. 4a) page lists the locations of all antennas (antenna pad name and offset from array center) and contains graphical location plots for the array configuration (one linear and one logarithmically scaled for better separation of close antenna labels). A third plot shows a representative uv-coverage. On a second tab, baseline lengths are listed and the 'percentile' column provides a rough indication of how many baselines are shorter than that in each row (Fig. 4b).
 
Note that antenna IDs are not the same as antenna names. Antennas IDs are assigned when the data are imported to CASA. Thus, antenna ID 1 may or may not be the same as antenna 'ea01'. The '''Antenna setup''' page here shows the mapping between IDs and names.  


{|
{|
Line 65: Line 71:
The '''Spectral Setup''' page (Fig. 5) contains all spectral window descriptions, including start, center and end frequencies, the bandwidth of each spectral window (spw), as well as the number of spectral channels and their widths in frequency and velocity units. For each spw, the polarization products and the receiver bands are also listed. The real id is the spw id of each SB; the virtual id is a renumbered identifier when multiple SBs are combined (currently only an ALMA option).
The '''Spectral Setup''' page (Fig. 5) contains all spectral window descriptions, including start, center and end frequencies, the bandwidth of each spectral window (spw), as well as the number of spectral channels and their widths in frequency and velocity units. For each spw, the polarization products and the receiver bands are also listed. The real id is the spw id of each SB; the virtual id is a renumbered identifier when multiple SBs are combined (currently only an ALMA option).


Note that ''Science Windows'' contain all spws that are used for calibration. Setup and pointing scans are not part of science windows but they are available under ''All Windows'' together with their intents. (Note though that in our case, however, pointing scans are mistakenly identified as science scans, this is due to its peculiar data structure, which labeled a setup scan as a target scan).  
Note that ''Science Windows'' contain all spws that are used for calibration. Setup and pointing scans are not part of science windows but they are available under ''All Windows'' together with their intents.  


{|
{|
Line 72: Line 78:




Clicking the '''Sky Setup''' page (Fig. 6) leads to Elevation versus Azimuth and Elevation versus Time plots for the entire observation and once more a representative uv-coverage. The temporal plots are colorized by field id.
Clicking the '''Sky Setup''' page (Fig. 6) leads to Elevation versus Azimuth and Elevation versus Time plots for the entire observation. The temporal plots are colorized by field id. The page also contains a representative uv-coverage and a solar elevation plot is also shown.


{|
{|
Line 84: Line 90:
|}
|}


Most of the above information can also be accessed by the 'LISTOBS OUTPUT' button. The link leads to the output of the CASA [https://casadocs.readthedocs.io/en/v6.2.0/api/tt/casatasks.information.listobs.html listobs] task, which summarizes the details of the observations (Fig. 8), including the scan characteristics, with observing times, scan ids, field ids and names, associated spectral windows, integration times, and scan intents. Further down, the spectral window characteristics are provided through their ids, channel numbers, channel widths, start and central frequencies. Sources and antenna locations are part of the [https://casadocs.readthedocs.io/en/v6.2.0/api/tt/casatasks.information.listobs.html listobs] output, too.  
Most of the above information can also be accessed by the 'LISTOBS OUTPUT' button. The link leads to the output of the CASA  
[https://casadocs.readthedocs.io/en/v6.2.1/api/tt/casatasks.information.listobs.html listobs] task, which summarizes the details of the observations (Fig. 8), including the scan characteristics, with observing times, scan ids, field ids and names, associated spectral windows, integration times, and scan intents. Further down, the spectral window characteristics are provided through their ids, channel numbers, channel widths, start and central frequencies. Sources and antenna locations are also part of the [https://casadocs.readthedocs.io/en/v6.2.1/api/tt/casatasks.information.listobs.html listobs] output (On some browsers the listobs text is best readable when opened in a new tab without line wrapping).


[[Image:VLApipe-S-listobs-CASA6.2.1.png|400px|thumb|center|Fig. 8: The [https://casadocs.readthedocs.io/en/v6.2.0/api/tt/casatasks.information.listobs.html listobs] output.]]
{|
|[[Image:VLApipe-S-listobs-CASA6.2.1.png|400px|thumb|center|Fig. 8: The [https://casadocs.readthedocs.io/en/v6.2.1/api/tt/casatasks.information.listobs.html listobs] output.]]
|}


=== By Topic Screen ===
=== By Topic Screen ===


The top-level [https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/t1-3.html By Topic] link leads to a page that provides basic pipeline summaries such as warnings, the four lowest QA scores (see below), and flagging summaries as functions of field, antenna, and spectral window (spw; Fig. 9). Links are provided to jump directly to the pipeline step that issued the warning or low score.
The top-level [https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t1-3.html By Topic] link leads to a page that provides basic pipeline summaries such as warnings, the four lowest QA scores (see below), and flagging summaries as functions of field, antenna, and spectral window (spw; Fig. 9). Links are provided to jump directly to the pipeline step that issued the warning or low score.




Line 97: Line 106:
== By Task Screen: Overview of the Pipeline Heuristic Stages ==
== By Task Screen: Overview of the Pipeline Heuristic Stages ==


The pipeline is divided into 19 (20 when including the exportdata stage) individual pipeline heuristic stages with heuristic ('hif' or 'hifv' for ''heuristics interferometric [vla]'') tasks listed under the [https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/t1-4.html By Task] tab (Fig. 10). Each stage has an associated score for success. If there are informational messages, warnings, or errors in tasks, they are indicated by '?', '!', and 'x' icons near the task names, respectively. In our example, an informational message and a few warnings are issued, mostly related to flagging. Note, however, that warnings use antenna ids and not antenna names. They are usually not identical and the mapping between them is shown on the '''Antenna Setup''' page.  
The calibration pipeline is divided into 19 (20 when including the exportdata stage) individual pipeline heuristic stages with heuristic ('hif' or 'hifv' for ''heuristics interferometric [vla]'') tasks listed under the [https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t1-4.html By Task] tab (Fig. 10). The imaging pipeline adds another 5 steps for a total of 26 steps in our example (including two archiving exportdata stages). Each stage has an associated score for success. If there are informational messages, warnings, or errors in tasks, they are indicated by '?', '!', and 'x' icons near the task names, respectively. In our example, an informational message and a few warnings are issued, mostly related to flagging.  


[[Image:VLApipe-S-tasks-CASA6.2.1.png|400px|thumb|center|Fig. 10: The '''By Task''' pipeline execution stages.]]
[[Image:VLApipe-S-tasks-CASA6.2.1.png|400px|thumb|center|Fig. 10: The '''By Task''' pipeline execution stages.]]
Line 105: Line 114:
The QA scores have the following meaning:  
The QA scores have the following meaning:  
* 0.9-1.0 Standard/Good: <font color="green">green</font> color -  the stage appears to have completed successfully  
* 0.9-1.0 Standard/Good: <font color="green">green</font> color -  the stage appears to have completed successfully  
* 0.66-0.90 Below Standard: <font color="blue">blue</font> color -  the stage has identified some issues, but they are not likely to affect the results substantially. It is still worth to check though.
* 0.66-0.90 Below Standard: <font color="blue">blue</font> color -  the stage has identified some issues, but they are not likely to affect the results substantially. It is still worth a check though.
* 0.33-0.66 Warning: <font color="#FFC300">yellow</font> color - there are serious issues identified in this stage. The results should be inspected carefully. Intervention may be needed.  
* 0.33-0.66 Warning: <font color="#FFC300">yellow</font> color - there are serious issues identified in this stage. The results should be inspected carefully. Intervention may be needed.  
* 0.00-0.33 Error: <font color="red">red</font> color - there are severe problems with the data processing. It may or may not be possible to rescue the data.  
* 0.00-0.33 Error: <font color="red">red</font> color - there are severe problems with the data processing. It may or may not be possible to rescue the data.  




=== The Individual Stages ===
''' The Individual Stages'''
Before we go through the stages step by step, it is worth mentioning that the lines in the calibration table plots connect data  along the x-axis when they have otherwise the exact same properties (i.e. same spw, field, polarization, etc.). When data are flagged, the connector will not be plotted, so only consecutive, non-flagged data, with the same properties are connected and gaps between data with the same color indicate flagged data.  
 
Before we go through the stages step by step, it is worth mentioning that the lines in the calibration table plots connect data  along the x-axis when they have otherwise the exact same properties (i.e. same spw, field, polarization, etc.). When data are flagged the connector will not be plotted, so only consecutive, non-flagged data with the same properties are connected and gaps between data with the same color indicate flagged data.  
   
   
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage1&ms=all&subpage=t2-4m_details.html  Stage 1. hifv_importdata]: Register VLA measurement sets with the pipeline''' ====
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage1&ms=all&subpage=t2-4m_details.html  Stage 1. hifv_importdata]: Register VLA measurement sets with the pipeline''' ====
   
   
In the first stage, the raw SDM-BDF is imported into the VLA pipeline. An MS is created and basic information on the MS is provided, such as SchedBlock ID, the number of scans and fields, and the size of the MS. The MS is also checked for suitable scan intents and a summary of the initial flags is calculated (check the "CASA logs" attached to the bottom of the page).  "Flux densities" is used for ALMA and is not relevant to VLA data at this time.
In the first stage, the raw SDM-BDF is imported into the VLA pipeline. An MS is created and basic information on the MS is provided, such as SchedBlock ID, the number of scans and fields, science targets, and the size of the MS. The MS is also checked for suitable scan intents and a summary of the initial flags is calculated (check the "CASA logs" attached to the bottom of the page).   
{|
{|
|[[Image:VLApipe-S-importdata-CASA6.2.1.png|400px|thumb|left|Fig. 11: The ''hifv_importdata'' task page.]]
|[[Image:VLApipe-S-importdata-CASA6.2.1.png|400px|thumb|left|Fig. 11: The ''hifv_importdata'' task page.]]
Line 128: Line 138:
</pre>
</pre>


==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage2&ms=all&subpage=t2-4m_details.html Stage 2. hifv_hanning]: VLA Hanning Smoothing''' ====
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage2&ms=all&subpage=t2-4m_details.html Stage 2. hifv_hanning]: VLA Hanning Smoothing''' ====


This stage Hanning-smooths the MS. This procedure reduces the [https://en.wikipedia.org/wiki/Gibbs_phenomenon Gibbs phenomenon] (ringing) when extremely bright and narrow spectral features are present and spill over into adjacent spectral channels. Gibbs ringing is typically caused by strong RFI or a strong maser line. As part of the process, Hanning smoothing will reduce the spectral resolution by a factor of 2 while maintaining the same number of channels. (Note: this means that data in adjacent channels will no longer be independent.) Hanning smoothing is turned off when any spectral window (spw) was frequency-averaged inside the WIDAR correlator. For such data, Hanning smoothing cannot correct for the Gibbs phenomenon anymore and would only add additional smearing.  
This stage Hanning-smooths the MS. This procedure reduces the [https://en.wikipedia.org/wiki/Gibbs_phenomenon Gibbs phenomenon] (ringing) when extremely bright and narrow spectral features are present and spill over into adjacent spectral channels. Gibbs ringing is typically caused by strong RFI or a strong maser line. As part of the process, Hanning smoothing will reduce the spectral resolution by a factor of 2 while maintaining the same number of channels. (Note: this means that data in adjacent channels will no longer be independent.) The first and last edge channel will be flagged. Hanning smoothing is turned off when any spectral window (spw) was frequency-averaged inside the WIDAR correlator. For such data, Hanning smoothing cannot correct for the Gibbs phenomenon anymore and would only add additional smearing.  


<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
Line 140: Line 150:
</pre>
</pre>


==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage3&ms=all&subpage=t2-4m_details.html Stage 3. hifv_flagdata]: VLA Deterministic flagging''' ====
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage3&ms=all&subpage=t2-4m_details.html Stage 3. hifv_flagdata]: VLA Deterministic flagging''' ====


This stage applies flags that were generated by the VLA online system during the observations. The flags include antennas not on source (ANOS), shadowed antennas, scans with intents that are of no use for the pipeline (such as pointing and setup scans), autocorrelations, the first and last 5% edge channels of each spectral window (with a minimum of 1 channel), clipping absolute zero values that the correlator occasionally produces, quacking (i.e. flagging start or end integrations of scans; the pipeline will flag the first integration after a field change), and flagging  
This stage applies flags that were generated by the VLA online system during the observations. The flags include antennas not on source (ANOS), shadowed antennas, scans with intents that are of no use for the pipeline (such as pointing and setup scans), autocorrelations, the first and last 5% edge channels of each spectral window (with a minimum of 1 channel), clipping absolute zero values that the correlator occasionally produces, quacking (i.e. flagging start or end integrations of scans; the pipeline will flag the first integration after a field change), and flagging  
the end 20MHz of the top and bottom spw of each baseband. "Agent Commands" is the actual list of flagging commands that is sent to the CASA task [https://casadocs.readthedocs.io/en/v6.2.0/api/tt/casatasks.flagging.flagdata.html flagdata]. The flags are reported as a fraction of the total data for the full dataset as well as broken up into the individual calibrator scans and target data. A plot is provided that displays the online antenna flags as a function of time.  
the end 20MHz of the top and bottom spw of each baseband (when the baseband is <1GHz, the baseband flagging will be disabled). "Agent Commands" is the actual list of flagging commands that is sent to the CASA task [https://casadocs.readthedocs.io/en/v6.2.1/api/tt/casatasks.flagging.flagdata.html flagdata]. The flags are reported as a fraction of the total data for the full dataset as well as broken up into the individual calibrator scans and target data (according to their intents). A plot is provided that displays the online antenna flags as a function of time.  


A flagging template can also be provided to the pipeline which applies known flags to the data (see [http://go.nrao.edu/vla-pipe The VLA Pipeline Webpage]).  
A flagging template can also be provided to the pipeline which applies known flags to the data (see [http://go.nrao.edu/vla-pipe The VLA Pipeline Webpage]). These templates are created by a user before starting the pipeline. They are also prepared by NRAO staff for Science Ready Data products when needed.  
   
   
In our example (Fig. 12), the target sources start with 3.12% flagged data; the deterministic flagging stage adds 6.05% for antenna not on source; 0.82% of other online flags (e.g., subreflector rotations or translations); edge channels amount to 6.4%; clipping of absolute zero values to 0.09%; quack removes bad first integrations (0%) in scans; and 1.4% of flags are due to baseband clipping. This combines to a total of 8.71% of flagged data for the scientific targets. Other sources are also listed and the entire MS is flagged on a 8.84% level. No flagging template was applied.
In our example (Fig. 12), the target sources start with 3.125% flagged data that are due to Hanning smoothing, which flags the first and last channel of each spw (2 out of 64 channels in our case). The deterministic flagging stage adds various ANOS, baseband, and other flags (e.g. subreflector rotation, like the error in ea05 as plotted in the graph) for a total 4.4%. No flagging template was applied.
{|
{|
|[[Image:VLApipe-S-flagdata-CASA6.2.1.png|400px|thumb|left|Fig. 12: The ''hifv_flagdata'' task page.]]
|[[Image:VLApipe-S-flagdata-CASA6.2.1.png|400px|thumb|left|Fig. 12: The ''hifv_flagdata'' task page.]]
Line 160: Line 170:
</pre>
</pre>


==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage4&ms=all&subpage=t2-4m_details.html Stage 4. hifv_vlasetjy]: Set calibrator model visibilities''' ====
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage4&ms=all&subpage=t2-4m_details.html Stage 4. hifv_vlasetjy]: Set calibrator model visibilities''' ====
 
Stage number 4 calculates and sets the calibrator spectral and spatial model for the standard VLA flux density calibrators (3C48, 3C138, 3C147, or 3C286 with a CALIBRATE_FLUX scan intent). The task page (Fig. 13) lists the calculated flux densities for each spectral window (spw). It also contains plots of the amplitude versus uv-distance for the models per spw that are calculated and used to specify the flux density calibrator characteristics. Our example uses 3C48, and for this array configuration and band the source appears largely as a point source given the flat uv-distance amplitudes. The spectral index, however is visible in the colored spws that are at different flux density levels.


Stage number 4 calculates and sets the calibrator spectral and spatial model for the standard VLA flux density calibrators (3C48, 3C138, 3C147, or 3C286 with a CALIBRATE_FLUX scan intent). The task page (Fig. 13) lists the calculated flux densities for each spectral window (spw). It also contains plots of the amplitude versus uv-distance for the models per spw that are calculated and used to specify the flux density calibrator characteristics. If the scan intent CALIBRATE_FLUX is absent or the calibrator not a standard VLA flux density calibrator, the absolute flux density scale calibration will be on an arbitrary level.
If the scan intent CALIBRATE_FLUX is absent the pipeline will not run. If the calibrator is not a standard VLA flux density calibrator, the absolute flux density scale calibration will be on an arbitrary level.
{|
{|
|[[Image:VLApipe-S-setjy-CASA6.2.1.png|400px|thumb|right|Fig. 13: The ''hifv_setjy'' task page.]]
|[[Image:VLApipe-S-setjy-CASA6.2.1.png|400px|thumb|right|Fig. 13: The ''hifv_setjy'' task page.]]
Line 175: Line 187:
</pre>
</pre>


==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage5&ms=all&subpage=t2-4m_details.html Stage 5. hifv_priorcals]: Priorcals (gaincurves, opacities, antenna positions corrections and rq gains)''' ====
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage5&ms=all&subpage=t2-4m_details.html Stage 5. hifv_priorcals]: Priorcals (gaincurves, opacities, antenna positions corrections and rq gains)''' ====
 
Next, the prior calibration tables are being derived. They include gain-elevation dependencies, atmospheric opacity corrections, antenna offset corrections, and requantizer (rq) gains. They are independent of the calibrator observations themselves and can be derived from ancillary data such as antenna offset tables, weather data, and antenna elevation. Switched power measurements are provided but currently not used in the pipeline. They can be manually inspected, e.g. for gain compression in the presence of strong RFI.


Next, the prior calibration tables are being derived. They include gain-elevation dependencies, atmospheric opacity corrections, antenna offset corrections, and requantizer (rq) gains. They are independent of the calibrator observations themselves and can be derived from ancillary data such as antenna offset tables, weather data, antenna elevation, and switched power measurements.  
Opacities are calculated per spw and plotted together with additional information on the weather conditions during the observation (Fig. 14a). For S-band they are very low, as expected for frequencies that are largely unaffected by water vapor.  


Opacities are calculated per spw and plotted together with additional information on the weather conditions during the observation (Fig. 14a).
{|
{|
|[[Image:VLApipe-precal1-CASA6.2.1.png|400px|thumb|left|Fig. 14a: The ''hifv_priorcals'' task page.]]
|[[Image:VLApipe-S-priorcals-CASA6.2.1.png|400px|thumb|left|Fig. 14a: The ''hifv_priorcals'' task page.]]
|[[Image:VLApipe-precal2-CASA6.2.1.png|400px|thumb|right|Fig. 14b: The ''hifv_priorcals'' task page, continued.]]
|[[Image:VLApipe-S-priorcals2-CASA6.2.1.png|400px|thumb|right|Fig. 14b: The ''hifv_priorcals'' task page, continued.]]
|}
|}


The antenna positions are usually updated within a few days after an antenna was repositioned during the cycle, and for our case corrections (on the order of a few millimeters) for four antennas are applied.  
The antenna positions are usually updated within a few days after an antenna was repositioned during the cycle (Fig. 14b). For our case, however, 7 antennas have updated positional corrections (on the order of a few millimeters) that will be applied during calibration.  


<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
Line 195: Line 208:
</pre>
</pre>


==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage6&ms=all&subpage=t2-4m_details.html Stage 6. hifv_testBPdcals]: Initial test calibrations''' ====
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage6&ms=all&subpage=t2-4m_details.html Stage 6. hifv_testBPdcals]: Initial test calibrations''' ====


Now it is time to determine the delays and the bandpass solutions (gain and phase) for the first time. Applying the initial solution will make it easier to identify RFI that needs to be flagged. There will be a couple of similar iterations for the calibration tables in the following pipeline stages to eventually obtain the final set of calibration tables.  
Now it is time to determine the delays and the bandpass solutions (gain and phase) for the first time. Applying the initial solution will make it easier to identify RFI that needs to be flagged. There will be a couple of similar iterations for the calibration tables in the following pipeline stages to eventually obtain the final set of calibration tables.  


A warning is shown for antenna ea21 to point out that spectral windows 50 to 65 were completely flagged.
The plot on the main page (Fig. 15) shows the bandpass calibrator with the initial bandpass solutions applied. There are links to other plots showing delay, gain amplitude, gain phase, bandpass amplitude, and bandpass phase solutions for each antenna. Note that the pipeline will typically switch reference antennas, and therefore phase solutions of reference antennas may not be perfectly zero and may show some steps. When delays are more than +/-10ns it will be worth examining the data more closely. Some additional flagging may be needed.  
 
 
The plot on the main page (Fig. 15) shows the bandpass calibrator with the initial bandpass solutions applied. There are links to other plots showing delay, gain amplitude, gain phase, bandpass amplitude, and bandpass phase solutions for each antenna. Note that the pipeline will typically switch reference antennas so phase solutions of reference antennas may not be perfectly zero and show some steps (an example will be shown later). When delays are more than +/-10ns it will be worth examining the data more closely. Some additional flagging may be needed.  
{|  
{|  
|[[Image:VLApipe-testbpdcal-CASA6.2.1.png|400px|thumb|left|Fig. 15: The ''hifv_testBPdcals'' task page.]]
|[[Image:VLApipe-S-testbpdcal-CASA6.2.1.png|400px|thumb|left|Fig. 15: The ''hifv_testBPdcals'' task page.]]
|}
|}


The gain amplitude and phase solutions are derived per integration and they are used to correct for decorrelation before any spectral bandpass solutions are calculated. The latter are determined over a full solution interval, usually for all bandpass scans together. Bandpasses should be smooth although they can vary substantially over wide frequency bands. The bandpass (BP) phase solutions are derived after systematic slopes were accounted for by the delay solutions.  
The gain amplitude and phase solutions are derived per integration and they are used to correct for decorrelation before any spectral bandpass solutions are calculated (note that later stages do not show this plot anymore). The latter are determined over a full solution interval, usually for all bandpass scans together. Bandpasses should be smooth although they can vary substantially over wide frequency bands. The bandpass (BP) phase solutions are derived after systematic slopes were accounted for by the delay solutions.  


Example delays are shown in Fig. 16a-c: The delays for ea13 vary but are within a narrow range of only a few ns (and small offsets between spws)(Fig. 16a). These are good solutions. The delays for ea13 and ea06 are fine given that they are only a few ns. Ea06 furthermore shows a systematic offset of the delays between the polarizations (Fig. 16b). This is nothing to worry about. Delays for ea28 are all zero (Fig. 16c). This is expected as ea28 is the reference antenna.
Very large delays of hundreds of ns, very different delays between spws, random scatter or systematic problems (antenna, correlator, RFI, etc), should be flagged.


Example delays are shown in Fig. 16: The delays for ea16 vary but are within a narrow range of only a few ns (and small offsets between spws). These are good solutions. The delays for ea21 are fine except for the 33-35GHz frequency range where many solutions failed or scatter substantially. The respective frequency range/spectral window (spw) should be flagged manually (best through a flagging template) if the following pipeline steps will not take care of it. For ea22 the delays in the spw that covers the 35-37GHz range are excessive with a value of about -68ns. It is likely that the pipeline will be able to calibrate these values correctly but one may need to flag the respective spws if not.
{|  
{|  
|[[Image:VLApipe-step6-delay-ea16-CASA6.2.1.png|400px|thumb|left|Fig. 16a: Delays for ea16.]]
|[[Image:VLApipe-S-step6-delay-ea13-CASA6.2.1.png|400px|thumb|left|Fig. 16a: Delays for ea13.]]
|[[Image:VLApipe-step6-delay-ea21-CASA6.2.1.png|400px|thumb|center|Fig. 16b: Delays for ea21.]]
|[[Image:VLApipe-S-step6-delay-ea06-CASA6.2.1.png|400px|thumb|center|Fig. 16b: Delays for ea06.]]
|}
|}
{|
{|
|[[Image:VLApipe-step6-delay-ea22-CASA6.2.1.png|400px|thumb|left|Fig. 16c: Delays for ea22.]]
|[[Image:VLApipe-S-step6-delay-ea28-CASA6.2.1.png|400px|thumb|left|Fig. 16c: Delays for ea28.]]
|}
|}




In Fig. 17, we show some gain amplitude plot examples. Antenna ea03 shows credible solutions (the colors represent different spectral windows and polarizations; an amplitude spread as a function of frequency is expected given the spectral index of the source), whereas ea04 has elevated values until 8:06. Those should be flagged (but the pipeline may be able to detect and flag them in one of the subsequent stages). Some of the baselines in ea18 show low values in the 2-3Jy range, but they are constant in time. At this stage one can assume that they reflect the correct calibration values. It might still be worth making a note and check if calibration downstream was applied correctly. The situation is different for ea25 which shows an extreme decrease of amplitude as a function of time (also ea18 shows that in the last few integrations). This is likely an antenna mechanical error. This antenna should be inspected carefully, there could be a problem which will make it unusable. Although the bandpass solutions seem to be ok, the bandpass and flux density calibrators coincide and it is likely that the absolute flux density calibration is very unreliable for this antenna.
The gain as a function of time for ea13 is shown in Fig. 17. It is flat and well behaved per spw. Offsets between the colored spws will be taken out as part of the calibration.  
 
{|  
{|  
|[[Image:VLApipe-step6-gainamp-ea03-CASA6.2.1.png|400px|thumb|left|Fig. 17a: Gain Amplitude for ea03. ]]
|[[Image:VLApipe-S-step6-gainamp-ea13-CASA6.2.1.png|400px|thumb|left|Fig. 17: Gain Amplitude for ea13. ]]
|[[Image:VLApipe-step6-gainamp-ea04-CASA6.2.1.png|400px|thumb|center|Fig. 17b: Gain Amplitude for ea04.]]
|}
{|
|[[Image:VLApipe-step6-gainamp-ea18-CASA6.2.1.png|400px|thumb|left|Fig. 17c: Gain Amplitude for ea18.]]
|[[Image:VLApipe-step6-gainamp-ea25-CASA6.2.1.png|400px|thumb|center|Fig. 17d: Gain Amplitude for ea25.]]
|}
|}




Since the gain amp/phase steps per integration are only performed to reduce decorrelation, the phase plots are the most important diagnostics in this context. In Fig. 18 we show a few solutions. All phases for the reference antenna ea09 are by definition zero. The phase variations as a function of time increase for higher frequencies and longer baselines. Therefore both, ea03 and ea21 have good solutions given that ea03 is closer to to the reference ea09 than ea21 (cf. the ''Antenna Setup'' on the ''Overview'' page). There are no jumps in the phases - remember that -180 and +180 are identical phase values and lines connecting those values are only a plotting issue, not the actual phase behavior.  
Since the gain amp/phase steps per integration are only performed to reduce decorrelation, the phase plots are the most important diagnostics in this context. In Fig. 18 we show the solutions for ea13. They are flat and well behaved again, little decorrelation is visible that this table would correct for.  
 
{|  
{|  
|[[Image:VLApipe-step6-gainphase-ea09-CASA6.2.1.png|400px|thumb|left|Fig. 18a: Gain Phase for ea09.]]
|[[Image:VLApipe-S-step6-gainphase-ea13-CASA6.2.1.png|400px|thumb|left|Fig. 18: Gain Phase for ea13.]]
|[[Image:VLApipe-step6-gainphase-ea03-CASA6.2.1.png|400px|thumb|center|Fig. 18b: Gain Phase for ea03.]]
|}
{|
|[[Image:VLApipe-step6-gainphase-ea21-CASA6.2.1.png|400px|thumb|left|Fig. 18c: Gain Phase for ea21.]]
|}
|}




Now let's have a look at the bandpasses themselves (Fig. 19). Antenna ea17 shows very good bandpass solutions. Since the spectral windows (spws) are small compared to the entire frequency range, the edges of each spw dominate the variations. The 37-39GHz range of ea18 varies considerably more. In fact this antenna, polarization and baseband shows a deformatter timing error, which needs to be flagged. Some flagging was already performed for the 33-35GHz range of ea21; this is mentioned by the warning at the top of the page (note, that the warning shows antenna ids not antenna names, the mapping is shown in the '''Antenna Setup''' page, here antenna 20 is the id for ea21). This range corresponds to the failed and noisy delays that we saw earlier in Fig. 16b. Antenna ea24 shows a few high values. They usually are fine as they also correspond to the edges of the spws. In particular if an spw edge coincides with a baseband edge, such spikes are usually more pronounced. Keep an eye on those although they are likely not a problem for the calibration. Finally, we show the bandpass of ea25, the antenna with the likely mechanical error. Although the Gain Amplitude showed decreasing values as a function of time (Fig. 17d), the bandpass itself does not look suspicious and can likely be used, based on this plot. The mechanical error, however, may also be present for other scans and since we identified it first for a flux density calibrator scan, that antenna should be flagged.
Now let's have a look at the bandpasses themselves (Fig. 19). Antenna ea13 is again a good representative for all antennas. The colored spws are clearly distinguishable (2 polarizations plotted on top of each other). Edge channels show lower gain, in particular at the edge of the baseband, below ~2.6GHz.  
 
{|  
{|  
|[[Image:VLApipe-step6-BPgain-ea17-CASA6.2.1.png|400px|thumb|left|Fig. 19a: BP Gain for ea17.]]
|[[Image:VLApipe-S-step6-bpgain-ea13-CASA6.2.1.png|400px|thumb|left|Fig. 19: BP Gain for ea13.]]
|[[Image:VLApipe-step6-BPgain-ea18-CASA6.2.1.png|400px|thumb|center|Fig. 19b: BP Gain for ea18.]]
|}
{|
|[[Image:VLApipe-step6-BPgain-ea21-CASA6.2.1.png|400px|thumb|left|Fig. 19c: BP Gain for ea21.]]
|[[Image:VLApipe-step6-BPgain-ea24-CASA6.2.1.png|400px|thumb|center|Fig. 19d: BP Gain for ea24.]]
|}
{|
|[[Image:VLApipe-step6-BPgain-ea25-CASA6.2.1.png|400px|thumb|left|Fig. 19e: BP Gain for ea25.]]
|}
|}


The bandpass (BP) phases as a function of frequency/channel are shown in Fig. 20. Again the reference antenna ea09 only shows zero phases by definition. Antenna ea11 is an example of proper phase solutions across the bandpass. Note again that edges of the spectral windows are showing the largest deviations. Some variations are larger than others, but they are all in a similar range. We already saw the large scatter in the bandpass amplitude of ea18 at 37-39GHz due to a signal path (bad deformatter) problem and the pattern is apparent in the phases. Finally, we show ea24 again and find that the edge spike in the amplitudes is also seen in the phases. At this level, the solution should be usable.  
The bandpass (BP) phases as a function of frequency/channel are shown in Fig. 20a-b. Spw edges have large phase changes, but they are still only a few degrees (Fig. 20a). Ea28 phases are zero, as expected for the reference antenna (Fig. 20b).  
 


{|  
{|  
|[[Image:VLApipe-step6-BPphase-ea09-CASA6.2.1.png|400px|thumb|left|Fig. 20a: BP Phase for ea09. ]]
|[[Image:VLApipe-S-step6-bpphase-ea13-CASA6.2.1.png|400px|thumb|left|Fig. 20a: BP Phase for ea13. ]]
|[[Image:VLApipe-step6-BPphase-ea11-CASA6.2.1.png|400px|thumb|center|Fig. 20b: BP Phase for ea11.]]
|[[Image:VLApipe-S-step6-bpphase-ea28-CASA6.2.1.png|400px|thumb|center|Fig. 20b: BP Phase for ea28.]]
|}
|}
{|
|[[Image:VLApipe-step6-BPphase-ea18-CASA6.2.1.png|400px|thumb|left|Fig. 20c: BP Phase for ea18.]]
'''Flagging bad deformatter data'''
|[[Image:VLApipe-step6-BPphase-ea24-CASA6.2.1.png|400px|thumb|center|Fig. 20d: BP Phase for ea24.]]
|}
Included in this stage is the detection and removal of data transmission problems (aka 'bad deformatter' issue). A description of the effect is provided on the [[Pipeline: Frequent VLA problems]] page.


<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
Line 273: Line 272:
</pre>
</pre>


===== '''Flagging bad deformatter data''' =====
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage7&ms=all&subpage=t2-4m_details.html Stage 7. hifv_checkflag]: Flag possible RFI on BP calibrator using rflag''' ====


The digital transmission system (''DTS'') of each VLA antenna includes a formatting stage to convert the electronic to an optical signal before it is injected on the optical fiber link. On the correlator end the signal will be deformatted back to an electronic signal. Occasionally, the timing on the deformatter can be misaligned which results in very strong amplitude or phase slopes as a function of frequency. Sometimes the signal is similar to an ''abs(sin)'', or a 'bouncing' signal across a baseband for one polarization. The stage 6 tries to identify such deformatter errors by checking for deviations more than 15% over the average bandpass. If more than 4 spws of a baseband are affected this way, the entire baseband will be flagged.  
Rflag as part of CASA's [https://casadocs.readthedocs.io/en/v6.2.1/api/tt/casatasks.flagging.flagdata.html flagdata] is a threshold-based automatic flagging algorithm in CASA. Tfcrop is a 2D (frequency/time) flagging algorithm that works on uncalibrated data.  A combination of the two algorithms is run on the bandpass calibrator to remove relatively bright RFI and to obtain improved bandpass calibrations tables later on. The plots in Fig. 21 show the data before and after flagging. Note that sometimes the plots after flagging look worse, which is typically due to different averaging of the data.


For our data, no deformatter issues were automatically detected in the data (see the tables in the bottom of the main page (Fig. 15, bottom). We did see, however, that ea18 has a DTS problem in the 37-39GHz baseband (Figs. 19b/21a and 20c). Since this stage 6 did not detect and flag this range (which shows the limitations of the underlying code), manual flagging will be required for the affected antenna, polarization, and baseband for all sources. An example from a different dataset is provided in Fig. 21b. The 'V' shape close to 5.3 GHz with some values reaching close to zero are a sign for a deformatter problem.


{|  
{|  
|[[Image:VLApipe-step6-BPgain-ea18-CASA6.2.1.png|400px|thumb|left|Fig. 21a: Same as 19b, ea18 which shows a digital transmission issue that ''hifv_flagbaddef'' was not able to identify.]]
|[[Image:VLApipe-S-checkflag7-CASA6.2.1.png|400px|thumb|left|Fig. 21: Checkflag on the bandpass calibrator.]]
|[[Image:VLApipe-baddefromatterexampleBP.png|400px|thumb|left|Fig. 21b: An example of a bad deformatter from a different dataset.]]
|}
 
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage7&ms=all&subpage=t2-4m_details.html Stage 7. hifv_checkflag]: Flag possible RFI on BP calibrator using rflag''' ====
 
Rflag as part of [https://casadocs.readthedocs.io/en/v6.2.0/api/tt/casatasks.flagging.flagdata.html flagdata] is a threshold-based automatic flagging algorithm in CASA. In this step, rflag is run on the bandpass calibrator to remove relatively bright RFI and to obtain improved bandpass calibrations tables later on. The plots in Fig. 22 show the data before and after flagging.
 
 
{|
|[[Image:VLApipe-checkflag7-CASA6.2.1.png|400px|thumb|left|Fig. 22: Checkflag on the bandpass calibrator.]]
|}
|}


Line 302: Line 289:
</pre>
</pre>


==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage8&ms=all&subpage=t2-4m_details.html Stage 8. hifv_semiFinalBPdcals]: Semi-final delay and bandpass calibrations''' ====
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage8&ms=all&subpage=t2-4m_details.html Stage 8. hifv_semiFinalBPdcals]: Semi-final delay and bandpass calibrations''' ====


Now that some RFI was flagged, stage 6 is repeated here at stage 8, which results in better bandpass and delay solutions. The warning is the same as in stage 6.  
Now that some RFI was flagged, stage 6 is repeated here at stage 8, which results in better bandpass and delay solutions. The warning is the same as in stage 6.  
Line 314: Line 301:
</pre>
</pre>


==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage9&ms=all&subpage=t2-4m_details.html Stage 9. hifv_checkflag]: Flag possible RFI on BP calibrator using rflag''' ====
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage9&ms=all&subpage=t2-4m_details.html Stage 9. hifv_checkflag]: Flag possible RFI on all calibrators using rflag''' ====


Once more, rflag is executed, this time to all calibrator scans (Fig. 23). For the bandpass, after the bright RFI has been removed in step 7 and a new bandpass solution has been applied in step 8, a new flagging threshold will account for weaker RFI, which will be removed in this step 9.  
Once more, tfcrop and rflag are executed, this time on all calibrator scans (Fig. 22). For the bandpass, after the bright RFI has been removed in stage 7 and a new bandpass solution has been applied in stage 8, a new flagging threshold will account for weaker RFI, which will be removed here in stage 9. The RFI is somewhat reduced but not fully removed. The complex gain calibrator (all calibrators are in common plots) shows an amplitude drop in a small frequency range around 2.7GHz, likely one spw. The calibration will take that into account.  


{|  
{|  
|[[Image:VLApipe-checkflag9-CASA6.2.1.png|400px|thumb|left|Fig. 23: Checkflag on the all calibrators.]]
|[[Image:VLApipe-S-checkflag9-CASA6.2.1.png|400px|thumb|left|Fig. 22: Checkflag on all calibrators.]]
|}
|}


Line 331: Line 318:
</pre>
</pre>


==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage10&ms=all&subpage=t2-4m_details.html Stage 10. hifv_solint]: Determine solint and Test gain calibrations''' ====
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage10&ms=all&subpage=t2-4m_details.html Stage 10. hifv_solint]: Determine solint and Test gain calibrations''' ====


For the final calibration, the pipeline determines the shortest and longest applicable solution interval (''solint''). Typically they refer to the (longest) visibility integration time and the length of the longest gain calibration scan, respectively.  
For the final calibration, the pipeline determines the shortest and longest applicable solution intervals (''solint''). Typically the short solint is a visibility integration (dump) time interval; the longest of those are used when they differ during the observations. The long solint is derived from the length of the longest gain calibration scan.
 
In our case (Fig. 23) the longest solution interval, capturing the length of gain calibrator scans after flagging, is 207s. The short solution interval is 'int', which corresponds to one integration length, or 5s (cf. the overview page).  


In our case (Fig. 24) the longest time per integration is 3 seconds which therefore also corresponds the shortest solution interval (in CASA gaincal language this is 'int' for integration). The longest solution interval is based on the longest phase calibrator scan, which lasts for ~85s. When subtracting the slew time and allowing for 'quack' flagging of the longest solution interval, the longest solution interval results in ~76s.


{|  
{|  
|[[Image:VLApipe-solint-CASA6.2.1.png|400px|thumb|left|Fig. 24: The ''hifv_solint'' task page.]]
|[[Image:VLApipe-S-solint-CASA6.2.1.png|400px|thumb|left|Fig. 23: The ''hifv_solint'' task page.]]
|}
|}


Temporal gain and phase solutions are calculated for each antenna, spectral window, and polarization using these time intervals. In Fig. 25 we show some examples for the gains. Antenna ea03 shows consistent gain solutions with small variations over the time of the observations. Note that the last scan is the flux density calibrator and thus a different source with a different gain amplitude. Antenna ea04 shows increased values for the last few calibrator scans that may need to be flagged. This could be due to a bad pointing solution (scan 54 is a pointing, cf. the listobs output). Antenna ea25 has likely a pointing error that deteriorates over the first half of the observations. The [https://casadocs.readthedocs.io/en/v6.2.0/api/tt/casatasks.information.listobs.html listobs] output tells us that a pointing update was obtained around 6:40UT at which point ea25 indeed recovered and shows good solutions.  
Initial temporal gain and phase solutions are calculated for each antenna, spectral window, and polarization using these time intervals. In Fig. 24a-d we show some examples for the gains. At this stage, the solutions are already quite good. The variations are very small, as can be seen for the representative antenna ea13 (the amplitude offsets between the scans are the different calibrator sources that are observed) (Fig. 24a). Antenna ea12, however, has some anomaly at around 7:28UT that the pipeline may try to flag (Fig. 24b). It should be flagged by hand, if the pipeline will not address it for the final calibration tables (stage 12). Also ea03 shows lower gain solutions in the second half of the run. That may need to be flagged, but could also reflect a true lower gain of that antenna in some spw/polarization (Fig. 24c).  


Unfortunately, the plotting algorithm produces a somewhat convoluted plot with lines that criss-cross. The algorithm always connects only points that have the same spw, antenna, antenna2, and correlation id, with interruptions for flagged points. This can result in  connectors like those shown between the short integration intervals.
Given the plotting algorithm, lines only connect the exact same setup (antenna spw, pol, etc). Flagged data will not be connected. The plots therefore sometimes look different in their visual appearance with connected lines sometimes even criss-crossing. E.g. ea28 has little flagging and most connectors are present whereas for other antennas the connectors are broken at flag boundaries (Fig. 24d).  
 


{|  
{|  
|[[Image:VLApipe-solint-gain-ea03-CASA6.2.1.png|400px|thumb|left|Fig. 25a: Gain versus Time for ea03.]]
|[[Image:VLApipe-S-solint-gain-ea13-CASA6.2.1.png|400px|thumb|left|Fig. 24a: Gain versus Time for ea13.]]
|[[Image:VLApipe-solint-gain-ea04-CASA6.2.1.png|400px|thumb|center|Fig. 25b: Gain versus Time for ea04.]]
|[[Image:VLApipe-S-solint-gain-ea12-CASA6.2.1.png|400px|thumb|center|Fig. 24b: Gain versus Time for ea12.]]
|}
|}
{|
{|
|[[Image:VLApipe-solint-gain-ea25-CASA6.2.1.png|400px|thumb|left|Fig. 25c: Gain versus Time for ea25.]]
|[[Image:VLApipe-S-solint-gain-ea03-CASA6.2.1.png|400px|thumb|left|Fig. 24c: Gain versus Time for ea03.]]
|[[Image:VLApipe-S-solint-gain-ea28-CASA6.2.1.png|400px|thumb|left|Fig. 24d: Gain versus Time for ea28.]]
|}
|}




Although the phase solution plots are very crowded (Fig. 26), we can see that ea03 has very steady values over time. The pipeline will apply phase corrections that are determined from this solution so that, later on, additional phase solutions will be close to zero. Antenna ea04 shows larger variations. Antenna ea09 is the initial phase reference antenna. The underlying [https://casadocs.readthedocs.io/en/v6.2.0/api/tt/casatasks.calibration.gaincal.html gaincal] command, however, was given a few possible reference antennas, ea09, ea14, ea13, ea03, in case a single reference is not usable for all times and spectral windows. Check the ''CASA log for stage 11'' at the bottom for the actual command. Indeed, [https://casadocs.readthedocs.io/en/v6.2.0/api/tt/casatasks.calibration.gaincal.html gaincal] decided to choose different reference antennas for the solutions as the CASA log reports. To keep the phase interpolation consistent, ea09 phases have to absorb the offsets introduced by the alternate reference antennas. This explains the plot that we see here, i.e., not a constant zero for all spectral window phases.
 
Phase solutions are provided in Fig. 25a-d for antennas ea13, ea28, and ea18. Ea13 shows reasonably flat phases with little variations, except for phase jumps between different calibrators (Fig. 25a). The almost vertical lines seen for ea18 are irrelevant as they are connectors for -180 to 180 degree phase wraps (Fig. 25b). Ea28 is again the reference antenna with zero phases (Fig. 25c). For the calibrator around 5:55 UT, J2355+4950, however, the phases for ea28 spread out, indicating that a different antenna was the reference at that point. Indeed, ea19 shows zero phases for that scan and was used as the reference antenna at that time (Fig. 25d).


{|  
{|  
|[[Image:VLApipe-solint-ph-ea03-CASA6.2.1.png|400px|thumb|left|Fig. 26a: Phase versus Time for ea03.]]
|[[Image:VLApipe-S-solint-ph-ea13-CASA6.2.1.png|400px|thumb|left|Fig. 25a: Phase versus Time for ea13.]]
|[[Image:VLApipe-solint-ph-ea04-CASA6.2.1.png|400px|thumb|center|Fig. 26b: Phase versus Time for ea04.]]
|[[Image:VLApipe-S-solint-ph-ea18-CASA6.2.1.png|400px|thumb|left|Fig. 25b: Phase versus Time for ea18.]]
|}
|}
{|
{|
|[[Image:VLApipe-solint-ph-ea09-CASA6.2.1.png|400px|thumb|left|Fig. 26c: Phase versus Time for ea09.]]
|[[Image:VLApipe-S-solint-ph-ea28-CASA6.2.1.png|400px|thumb|center|Fig. 25c: Phase versus Time for ea28.]]
|[[Image:VLApipe-S-solint-ph-ea19-CASA6.2.1.png|400px|thumb|left|Fig. 25d: Phase versus Time for ea19.]]
|}
|}


<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
CHECK for: consistency with the data. The shortest solution interval should be close to the (longest) visibility integration time and the longest
CHECK for: consistency with the data. The shortest solution interval should be close to the (longest) visibility integration time and the longest gain calibration scan. Gains should be smooth with little variations in time (where larger gain variations are more likely to occur for higher frequencies), phases should not show any jumps and should be relatively smooth in time (where larger phase variations are likely to occur for higher frequencies and longer baselines).
gain calibration scan. Gains should be smooth with little variations in time (where larger gain variations are more likely to occur for higher
frequencies), phases should not show any jumps and should be relatively smooth in time (where larger phase variations are likely to occur for higher frequencies and longer baselines).
</pre>
</pre>


Line 374: Line 364:
</pre>
</pre>


==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage11&ms=all&subpage=t2-4m_details.html Stage 11. hifv_fluxboot]: Gain table for flux density bootstrapping''' ====
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage11&ms=all&subpage=t2-4m_details.html Stage 11. hifv_fluxboot]: Gain table for flux density bootstrapping''' ====


Now, the fluxes are bootstrapped from the flux density calibrator to the complex gain (amplitude and phase) calibrator. To do so, polynominal functions are fitted for the secondary calibrators and the absolute flux densities are determined for each channel. They are then inserted in the MODEL column via [https://casadocs.readthedocs.io/en/v6.2.0/api/tt/casatasks.imaging.setjy.html setjy] and reported for each spectral window.  
Now, the flux densities are bootstrapped from the flux density calibrator to all other calibrators, including the complex gain (amplitude and phase) calibrator. To do so, polynominal functions are fitted for the secondary calibrators and the absolute flux densities are determined for each spw. They are then inserted in the MODEL column via [https://casadocs.readthedocs.io/en/v6.2.1/api/tt/casatasks.imaging.setjy.html setjy] and reported for each spectral window.  


For our example, the pipeline derives flux densities between 0.65 and 0.70 Jy for the phase calibrator, depending on frequency. The value at the band center frequency of 35GHz is 0.68286 +/- 0.00064Jy (note that the error is only for the fit and not an overall error including systematics). The algorithm decided to fit a first order polynomial and derives a spectral index of -0.32 (Fig. 27); a negative spectral index corresponds to a decline in flux density with increasing frequency. The residuals of the fit and the logarithmic fit to the data points itself are shown in the last two plots at the top. The resulting flux gaintable ('fluxgaincal.g') is shown in the first plot and the second one contains the flux density calibrator model together with the bootstrapped, fitted gain calibrator models. If the plots show RFI or badly calibrated data, it is possible to edit the 'fluxgaincal.g' file using e.g. [https://casadocs.readthedocs.io/en/v6.2.0/api/tt/casatasks.visualization.plotms.html plotms]. The [https://science.nrao.edu/facilities/vla/data-processing/pipeline VLA pipeline webpage] has instructions on how to insert an edited table into the calibration run.
For our example, the pipeline derives frequency-dependent flux densities between 0.94 and 0.99 Jy for 'J0259+0747' and 1.94 to 1.62 Jy for 'J2355+4950', the two calibrators that are observed with a PHASE intent. This is reflected in the polynomial fit results, where one source has a positive and the other a negative spectral index, also shown by the fits in the fourth panel in Fig. 26. The third panel shows the (very small) residual errors of the fits. A gaintable ('fluxgaincal.g') is generated based on these numbers and shown in the first plot, based on the source model that is shown in the second plot. If the plots show RFI or badly calibrated data, it is possible to edit the 'fluxgaincal.g' file using e.g. [https://casadocs.readthedocs.io/en/v6.2.1/api/tt/casatasks.visualization.plotms.html plotms]. The [https://science.nrao.edu/facilities/vla/data-processing/pipeline VLA pipeline webpage] has instructions on how to insert an edited table into the calibration run.  
 
Our example has a small degradation in the maximum rms of the residuals and reports this through an information '?' icon.  


{|  
{|  
|[[Image:VLApipe-fluxboot-CASA6.2.1.png|400px|thumb|left|Fig. 27: The ''hifv_fluxboot'' task page.]]
|[[Image:VLApipe-S-fluxboot-CASA6.2.1.png|400px|thumb|left|Fig. 26: The ''hifv_fluxboot'' task page.]]
|}
|}


<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
CHECK for: that the values are close to the known fluxes of the calibrator. Check the VLA calibrator manual at https://science.nrao.edu/facilities/vla/observing/callist for consistency. Since most calibrator sources are time variable AGN, some differences to the VLA catalog are expected. In particular at higher frequencies they could be up to tens of percent.
CHECK for: that the flux density values are close to the known values for the calibrator. Check the VLA calibrator manual at https://science.nrao.edu/facilities/vla/observing/callist for consistency. Since most calibrator sources are time variable AGN, some differences to the VLA catalog are expected. In particular, at higher frequencies they could be different by up to tens of percent.
</pre>
</pre>


Line 394: Line 382:
</pre>
</pre>


==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage12&ms=all&subpage=t2-4m_details.html Stage 12. hifv_finalcals]: Final Calibration Tables''' ====
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage12&ms=all&subpage=t2-4m_details.html Stage 12. hifv_finalcals]: Final Calibration Tables''' ====
 
The final calibration tables are now derived. Those are the most important ones given that they are actually applied to the data in stage 13. The tables, which contain antenna based solutions, are: Final delay, bandpass (BP) initial gain phase, BP Amp solution, BP Phase solution, Phase (short) gain solution, Final amp time cal, Final amp freq cal, and Final phase gain cal. In Fig. 27a-h, we show an example of each of these for ea18. For this antenna all of the data look good. Bandpasses are smooth (although steep at the lower frequency end), phase solutions are within a few degree and gains (temporal and spectral) are close to unity with little deviation. The short phase solution is also pretty flat, indicating that decorrelation is very low.


The final calibration tables are now derived (with the same warning as in previous BPDdcals steps). Those are the most important ones given that they are actually applied to the data in stage 14. The tables, which contain antenna based solutions, are: Final delay, bandpass (BP) initial gain phase, BP Amp solution, BP Phase solution, Phase (short) gain solution, Final amp time cal, Final amp freq cal, and Final phase gain cal. We have already inspected and discussed similar solutions for the bandpass and for the temporal gain/phase calibration earlier. We shall now investigate further, starting with the temporal gains.


The gains vary significantly for this observation. Typically, the gains stay within 10% around a normalized value of 1. Here, a few spectral windows (spws) show substantial deviations. Examples are (Fig. 28): Antenna ea02 has a drop around 5:50UT and should be checked (also ea01 which is not shown). Maybe the entire time between the adjacent, good calibrator scans should be flagged for this antenna. Antenna ea04 has an inverse behavior later, around 8:00UT. It appears that only a subset, e.g., a baseband, deviates from the rest. Antenna ea07 is more smooth, with some variations between the individual spws but overall a consistent temporal behavior. Likely, this solution can be used with no further flagging. Note that the last scan is the flux density calibrator. This scan is expected to have different gains from those of the complex gain calibrator. Next, note that the ea09 gains are almost unity, which is expected. The gains in ea18 are smooth with a large dip in the first half.  This, in fact, does calibrate some characteristics of the observations and can be left for the moment. As mentioned before, around 6:40UT, a pointing update was performed which seems to have rectified a possibly mis-pointed ea18. Antenna ea23 requires a single spectral window at a single time to be investigated and probably be flagged. The mechanical error that we have identified for the bandpass/flux calibrator scan using ea25 has affected the phase solutions. That explains the amplitude spread of the spws. In addition, this antenna also has a pointing error for the first half of the observation. We again recommend to flag the entire antenna. 
{|  
{|  
|[[Image:VLApipe-gains-ea02-CASA6.2.1.png|400px|thumb|left|Fig. 28a: Temporal Gains for ea02.]]
|[[Image:VLApipe-S-final-delay-ea18-CASA6.2.1.png|400px|thumb|left|Fig. 27a: Final delay calibration table for ea18.]]
|[[Image:VLApipe-gains-ea04-CASA6.2.1.png|400px|thumb|center|Fig. 28b: Temporal Gains for ea04.]]
|[[Image:VLApipe-S-final-initalbpphase-ea18-CASA6.2.1.png|400px|thumb|center|Fig. 27b: Final, initial gain phase for bandpass for ea18.]]
|}
|}
{|
{|
|[[Image:VLApipe-gains-ea07-CASA6.2.1.png|400px|thumb|left|Fig. 28c: Temporal Gains for ea07.]]
|[[Image:VLApipe-S-final-bpamp-ea18-CASA6.2.1.png|400px|thumb|left|Fig. 27ac: Final bandpass gain amplitude for ea18.]]
|[[Image:VLApipe-gains-ea09-CASA6.2.1.png|400px|thumb|center|Fig. 28d: Temporal Gains for ea09.]]
|[[Image:VLApipe-S-final-bpphase-ea18-CASA6.2.1.png|400px|thumb|center|Fig. 27d: Final bandpass phase for ea18.]]
|}
|}
{|
{|
|[[Image:VLApipe-gains-ea18-CASA6.2.1.png|400px|thumb|left|Fig. 28e: Temporal Gains for ea18.]]
|[[Image:VLApipe-S-final-shortphase-ea18-CASA6.2.1.png|400px|thumb|left|Fig. 27e: Short phase solution for ea18.]]
|[[Image:VLApipe-gains-ea23-CASA6.2.1.png|400px|thumb|center|Fig. 28f: Temporal Gains for ea23.]]
|[[Image:VLApipe-S-final-gain-ea18-CASA6.2.1.png|400px|thumb|center|Fig. 27f: Temporal Gains for ea18.]]
|}
{|
|[[Image:VLApipe-gains-ea25-CASA6.2.1.png|400px|thumb|left|Fig. 28g: Temporal Gains for ea25.]]
|}
 
 
 
Now let's have a look at the gains as a function of frequency (Fig. 29). For ea02 we see that one line is below the rest. This is likely one specific time interval and indeed we have seen such a slip in Fig. 28a. Antenna ea04 has a very noisy time interval, which is also in agreement with what we have seen in the previous temporal gain plot. Antenna ea08 shows a consistent calibration and ea20 repeats the extra noise in the 34-35GHz range that may need to be flagged. Antenna ea25 now reflects the bandpass pattern that we have seen earlier and that explains the spread in Fig. 28.
 
{|
|[[Image:VLApipe-gainsfreq-ea02-CASA6.2.1.png|400px|thumb|left|Fig. 29a: Spectral Gains for ea02.]]
|[[Image:VLApipe-gainsfreq-ea04-CASA6.2.1.png|400px|thumb|center|Fig. 29b: Spectral Gains for ea04.]]
|}
|}
{|
{|
|[[Image:VLApipe-gainsfreq-ea08-CASA6.2.1.png|400px|thumb|left|Fig. 29c: Spectral Gains for ea08.]]
|[[Image:VLApipe-S-final-gainfreq-ea18-CASA6.2.1.png|400px|thumb|left|Fig. 27g: Gains as a function of frequency for ea18.]]
|[[Image:VLApipe-gainsfreq-ea20-CASA6.2.1.png|400px|thumb|center|Fig. 29d: Spectral Gains for ea20.]]
|[[Image:VLApipe-S-final-phase-ea18-CASA6.2.1.png|400px|thumb|center|Fig. 27h: Temporal phases for ea18.]]
|}
|}
{|
|[[Image:VLApipe-gainsfreq-ea25-CASA6.2.1.png|400px|thumb|left|Fig. 29e: Spectral Gains for ea25.]]
|}


Some antennas, however, show some problems (Fig. 28a-d). The gains for ea12 and ea03 start deviating from their ideal value for a few spws at about half of the observing run (Fig. 28a-b). This could be flagged. Also one spw for ea12 shows a spread around 2.67 GHz (Fig. 28c). That could be flagged, too. Ea28 is only displayed to show that this one is the phase reference (Fig. 28d).


The phases versus time ("Final phase gain cal") plots are shown in Fig. 30. Antenna ea02 clearly shows very erratic phase variations for one baseband or polarization. This is likely not recoverable. The user may plot the solution in [https://casadocs.readthedocs.io/en/v6.2.0/api/tt/casatasks.visualization.plotms.html plotms] and ''Locate'' the faulty spectral windows or polarizations and flag them. Antenna ea04, in contrast, exhibits very smooth phase variations until near the end of the observations. This has already been observed in the amplitude gains (Fig. 28b), should be looked at, and likely needs to be flagged. Antenna ea09 is the reference antenna and therefore has phase solutions that are zero as function of time. Antenna ea13 shows smooth variations and is an example of a credible calibration table. A spread between basebands or polarizations can be seen for ea15. The behavior is nevertheless smooth and the data should be calibrated nicely with this table. Antenna ea17, however, has, in addition to different behaviors for the basebands, also relatively large and erratic jumps between the calibration scans. This clearly needs to be looked into further and may require flagging, although the antenna did not show any issues in previous plots. Finally, ea20 has a relatively smooth behavior until the pointing update was performed (although the variations are relatively large). After the pointing scan, however, phases vary by about +/-50degree between individual, consecutive calibrator scans, which is large enough to be unreliable and to be flagged.
{|
|[[Image:VLApipe-phases-ea02-CASA6.2.1.png|400px|thumb|left|Fig. 30a: Temporal Phases for ea02.]]
|[[Image:VLApipe-phases-ea04-CASA6.2.1.png|400px|thumb|center|Fig. 30b: Temporal Phases for ea04.]]
|}
{|
{|
|[[Image:VLApipe-phases-ea09-CASA6.2.1.png|400px|thumb|left|Fig. 30c: Temporal Phases for ea09.]]
|[[Image:VLApipe-S-final-gain-ea12-CASA6.2.1.png|400px|thumb|left|Fig. 28a: Temporal gain for ea12.]]
|[[Image:VLApipe-phases-ea13-CASA6.2.1.png|400px|thumb|center|Fig. 30d: Temporal Phases for ea13.]]
|[[Image:VLApipe-S-final-gain-ea03-CASA6.2.1.png|400px|thumb|left|Fig. 28b: Temporal gain for ea03.]]
|}
|}
{|
{|
|[[Image:VLApipe-phases-ea15-CASA6.2.1.png|400px|thumb|left|Fig. 30e: Temporal Phases for ea15.]]
|[[Image:VLApipe-S-final-gainfreq-ea12-CASA6.2.1.png|400px|thumb|left|Fig. 28c: Gains as a function of frequency for ea12.]]
|[[Image:VLApipe-phases-ea17-CASA6.2.1.png|400px|thumb|center|Fig. 30f: Temporal Phases for ea17. ]]
|[[Image:VLApipe-S-final-phase-ea28-CASA6.2.1.png|400px|thumb|left|Fig. 28d: Temporal phases for ea28.]]
|}
|}
{|
 
|[[Image:VLApipe-phases-ea20-CASA6.2.1.png|400px|thumb|left|Fig. 30g: Temporal Phases for ea20.]]
|}


<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
CHECK for: strong RFI and whether it was eliminated in later flagging stages or not (especially via a comparison with the output plots of stage 12). Also check for jumps in phase and/or amplitude away from spectral window edges. If there are phase jumps for all but the reference antenna, maybe a different choice for the reference antenna should be considered. Also watch out for extreme delays of tens of ns and for very noisy data.  
CHECK for: strong RFI as well as jumps in phase and/or amplitude away from spectral window edges. If there are phase jumps for all but the reference antenna, maybe a different choice for the reference antenna should be considered. Also watch out for extreme delays of tens of ns and for very noisy data.  


Note that carefully checking calibrator tables in this stage is of particular importance as they are the final tables that are applied to the target source. Phase (and gain) calibration solutions should be inspected in their temporal variations to be smooth and consistent for each calibrator.
Note that carefully checking calibrator tables in this stage is of particular importance as they are the final tables that are applied to the target source. Phase (and gain) calibration solutions should be inspected in their temporal variations to be smooth and consistent for each calibrator.
Line 459: Line 426:
</pre>
</pre>


==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage13&ms=all&subpage=t2-4m_details.html Stage 13. hifv_applycals]: Apply calibrations from context''' ====
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage13&ms=all&subpage=t2-4m_details.html Stage 13. hifv_applycals]: Apply calibrations from context''' ====


The calibration itself now concludes with the application of the derived calibration tables to the entire dataset. That includes all calibrators as well as the target sources. Note that there is no system temperature weighting of the calibration tables for the VLA (and the pipeline sets ''calwt=False'') since the switched power calibration is currently not used.  
The calibration itself now concludes with the application of the derived calibration tables to the entire dataset. That includes all calibrators as well as the target sources. Note that there is no system temperature weighting of the calibration tables for the VLA (and the pipeline sets ''calwt=False'' in the CASA task [https://casadocs.readthedocs.io/en/v6.2.1/api/tt/casatasks.calibration.applycal.html applycal]) since the switched power/Tsys calibration is currently not used.  


In Fig. 31, we show the results of this step. The first table lists the calibration tables that are applied, and the fields, spectral windows, and antennas that are calibrated (although note that the spw 0 and 1 are only used for pointing scans and are not calibrated, despite them being listed here). The table also shows the field and spw mapping that was uses as well as the interpolation mode (see [https://casadocs.readthedocs.io/en/v6.2.0/api/tt/casatasks.calibration.applycal.html applycal] for the interpretation). For convenience, the final, actually applied calibration table names are available through the links in the last column.  The second table provides information on the flagging statistics. Failed calibration solutions result in flagged calibrator table entries and eventually the data will also be flagged as no calibration can be derived for such data.  
In Fig. 29, we show the results of this step. The first table lists the calibration tables that are applied, and the fields, spectral windows, and antennas that are calibrated. The table also shows the field and spw mappings that were used as well as the interpolation mode (see [https://casadocs.readthedocs.io/en/v6.2.1/api/tt/casatasks.calibration.applycal.html applycal] for the interpretation). For convenience, the final, actually applied calibration table names are available through the links in the last column.  The second table provides information on the flagging statistics. Failed calibration solutions result in flagged calibrator table entries and eventually the data will also be flagged as no calibration can be derived for such data.  


{|  
{|  
|[[Image:VLApipe-applycals-CASA6.2.1.png|400px|thumb|left|Fig. 31: The ''hifv_applycals'' task page.]]
|[[Image:VLApipe-S-applycals-CASA6.2.1.png|400px|thumb|left|Fig. 29: The ''hifv_applycals'' task page.]]
|}
|}


Note that this stage also shows the final MS file size after the creation of the additional MODEL and CORRECTED_DATA columns.


<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
Line 478: Line 446:
</pre>
</pre>


==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage14&ms=all&subpage=t2-4m_details.html Stage 14. hifv_checkflag]: Flag RFI on target using rflag''' ====
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage14&ms=all&subpage=t2-4m_details.html Stage 14. hifv_checkflag]: Flag RFI on target using rflag''' ====


The checkflag rflag heuristics are now applied to the target, to prepare it for imaging (Fig. 32).   
The rflag and tfcrop heuristics are now applied to the target to prepare it for imaging (Fig. 30).   


{|  
{|  
|[[Image:VLApipe-checkflag14-CASA6.2.1.png|400px|thumb|left|Fig. 32: Checkflag on the target.]]
|[[Image:VLApipe-S-checkflag14-CASA6.2.1.png|400px|thumb|left|Fig. 30: Checkflag on the target.]]
|}
|}


Line 495: Line 463:
</pre>
</pre>


==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage15&ms=all&subpage=t2-4m_details.html Stage 15. hifv_targetflag]: Targetflag''' ====
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage15&ms=all&subpage=t2-4m_details.html Stage 15. hifv_targetflag]: Targetflag''' ====


After the calibration tables are applied, the [https://casadocs.readthedocs.io/en/v6.2.0/api/tt/casatasks.flagging.flagdata.html flagdata] automated flagging routine rflag is run one more time on all sources to remove RFI and other outliers from the data.  
The [https://casadocs.readthedocs.io/en/v6.2.1/api/tt/casatasks.flagging.flagdata.html flagdata] automated flagging routine rflag is run one more time with slightly different heuristics on all sources to remove additional RFI and other outliers from the data.  


<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
CHECK for: RFI removal in the target data (use plotms). Although flagging is performed for all fields, the calibration is applied in a previous stage and any additional flags have no more influence on the calibration tables. Flagging may, however, improve all images that are made in the following stages. In particular the target fields are flagged here for the first time which will benefit their image quality. FOR SPECTRAL LINE DATA: do not run this step unless a cont.dat file is provided (c.f. the VLA Pipeline Webpage at http://go.nrao.edu/vla-pipe). Otherwise the spectral lines may be flagged, too.
CHECK for: RFI removal in the target data (use plotms). Although flagging is performed for all fields, any additional flags have no more influence on the calibration tables because the calibration was applied in a previous stage. Flagging may, however, improve all images that are made in the following stages. In particular, the target fields are flagged here for the first time which will benefit their image quality. FOR SPECTRAL LINE DATA: do not run this step unless a cont.dat file is provided (c.f. the VLA Pipeline Webpage at http://go.nrao.edu/vla-pipe). Otherwise the spectral lines may be flagged, too.
</pre>
</pre>


Line 507: Line 475:
</pre>
</pre>


==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage16&ms=all&subpage=t2-4m_details.html Stage 16. hifv_statwt]: Reweighting visibilities''' ====
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage16&ms=all&subpage=t2-4m_details.html Stage 16. hifv_statwt]: Reweighting visibilities''' ====


Since the VLA pipeline is currently not using the switched power calibration, there can be some sensitivity variations of the data over time due to changes in opacity, elevation, temperature (gradients) of the antennas, etc. So it is usually advisable to weigh the data according to the inverse of the square of their noise. This is done via the CASA task [https://casadocs.readthedocs.io/en/v6.2.0/api/tt/casatasks.manipulation.statwt.html statwt] and will increase the signal-to noise ratio of images. Note that features such as RFI spikes and spectral lines will influence RMS calculations and usually result in down-weighting data that includes such features.
Since the VLA pipeline is currently not using the switched power calibration, there can be some sensitivity variations of the data over time due to changes in opacity, elevation, temperature (gradients) of the antennas, etc. It is usually advisable to weigh the data according to the inverse of the square of their noise. This is done via the CASA task [https://casadocs.readthedocs.io/en/v6.2.1/api/tt/casatasks.manipulation.statwt.html statwt] and will increase the signal-to-noise ratio of images.  
It might be worth going to the casa log that is linked on this page and check the variance and mean of the weights. If the variance is more than 100 times larger than the mean, then something is likely wrong and the data should be inspected further.
 
Note that features such as RFI spikes and spectral lines will influence RMS calculations and usually result in down-weighting data that includes such features.


<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
CHECK for: there is no obvious diagnostic plot for this step but images that are created later should improve in their signal-to-noise. FOR SPECTRAL LINE DATA: do not run this step as spectral lines may be weighted down unless a cont.dat file is provided (cf the VLA Pipeline Webpage at http://go.nrao.edu/vla-pipe).
CHECK for: mean and variance of the weights. Also: images that are created later should improve in their signal-to-noise. FOR SPECTRAL LINE DATA: do not run this step as spectral lines may be weighted down unless a cont.dat file is provided (cf the VLA Pipeline Webpage at http://go.nrao.edu/vla-pipe).
</pre>
</pre>


Line 519: Line 490:
</pre>
</pre>


==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage17&ms=all&subpage=t2-4m_details.html Stage 17. hifv_plotsummary]: VLA Plot Summary''' ====
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage17&ms=all&subpage=t2-4m_details.html Stage 17. hifv_plotsummary]: VLA Plot Summary''' ====


This task produces diagnostic plots of the final, calibrated data. This includes calibrated phase for all targets as a function of time and amplitudes as a function of UVwave (UVdistance) for all science targets (incl. calibrators; Fig 33a), the amplitudes and phases as a function of frequency for the phase calibrator(s) colored by antenna (Fig. 33b), and amplitude against frequency for all science targets, colorized by spw (Fig. 33c).
This task produces diagnostic plots of the final, calibrated data. These include: calibrated phase as a function of time for all calibrators, and amplitudes as a function of UVwave (UVdistance) for all science fields (incl. calibrators; Fig 31a); the amplitudes and phases as a function of frequency for the bandpass and phase calibrator(s) colored by antenna (Fig. 31b); amplitude against frequency for all science targets, colorized by spw (Fig. 31c); and phases as a function of time for all cross-hands (RL, LR) of the polarization calibrators (Fig. 31d).


The phases for all calibrators should be around zero. A large scatter like at 5:50 UT should be inspected and could indicate that more flagging is required. Indeed we had already identified scans at this time range to show some problems in some antennas (e. g. ea01 and ea02; cf Fig. 28a). Point sources with a flat spectral index should show up in the UVwave plots as straight, horizontal lines. This can be best seen for the phase calibrator J1041+0610 (field 2), which, however, still shows some scattered points due to the calibration uncertainties that we discussed earlier. Additional flagging should reduce the number of outliers. The flux calibrator J1331+3030 (field 12) shows spectral and spatial structure. Spectral variations increase the vertical width and spatial structure is identified by a deviation from a flat line as a function of UVwave. This is all expected for the VLA standard and the reason why we use a frequency dependent flux and spatial model for those sources in ''hifv_vlasetjy''. Field 11 is also the flux calibrator, but for this run it was labeled with a TARGET intent, so the calibration was bootstrapped from the last gain calibrator, which was far away from the source.  (At the time of the observations TARGET was frequently used for requantizer gain calibrations as the SETUP intent was not available then. This scan should be entirely flagged.) 
The phases for all calibrators should be around zero. A large scatter like at 5:50 UT (first plot in Fig. 31a) should be inspected and could indicate that more flagging is required. We have already identified scans at this time range to show some problems in some antennas (e.g. ea01 and ea02; cf. Fig. 28a). Point sources with a flat spectral index should show up in the UVwave plots as straight, horizontal lines. The offset between the colored spws shows the spectral index of the sources.  


The phases and amplitudes as a function of frequency for the phase calibrator show some internal structure and non-Gaussian scatter but overall look fine. The slope is due to a spectral index of the source. Again some of the scatter can be reduced with additional flagging. The zig-zag pattern of the phases is due to a small mismatch in the delay measurement timing (also known as 'delay clunking'). This is an internally generated effect. Typically the effect is averaged out over time.  
The phases and amplitudes as a function of frequency for the phase calibrator overall look fine. Some scatter could be flagged and calibrated again, but if the scatter is symmetric, then the calibration table may still have good solutions. The zig-zag pattern of the phases is due to a small mismatch in the delay measurement timing (also known as 'delay clunking'). This is an internally generated effect. Typically the effect is averaged out over time.  
 
 
{|
|[[Image:VLApipe-S-plotsummary-CASA6.2.1.png|400px|thumb|left|Fig. 31a: The ''hifv_plotsummary'' task page; amplitudes as a function of UVwave.]]
|[[Image:VLApipe-S-plotsummary2-CASA6.2.1.png|400px|thumb|left|Fig. 31b: The ''hifv_plotsummary'' task page; amplitudes and phases as a function of frequency for calibrators.]]
|}


The amplitudes as a function of frequency for all targets can be used to identify RFI or other problems with the data. Structure is only expected for very strong target sources.
The amplitudes as a function of frequency for all targets can be used to identify RFI or other problems with the data. Structure is only expected for very strong target sources.


The pipeline does not perform polarization calibration. The CASA guide [https://casaguides.nrao.edu/index.php/Polarization_Calibration_based_on_CASA_pipeline_standard_reduction:_The_radio_galaxy_3C75 Polarization Calibration based on CASA pipeline (3C75)] explains how to do this, and is based on the results from this pipeline run.


{|  
{|
|[[Image:VLApipe-plotsummary-CASA6.2.1.png|400px|thumb|left|Fig. 33a: The ''hifv_plotsummary'' task page; amplitudes as a function of UVwave.]]
|[[Image:VLApipe-S-plotsummary3-CASA6.2.1.png|400px|thumb|left|Fig. 31c: The ''hifv_plotsummary'' task page; amplitudes as a function of frequency for all science targets.]]
|[[Image:VLApipe-plotsummary-2-CASA6.2.1.png|400px|thumb|left|Fig. 33b: The ''hifv_plotsummary'' task page; amplitudes and phases against frequency for phase calibrator.]]
|[[Image:VLApipe-S-plotsummary4-CASA6.2.1.png|400px|thumb|left|Fig. 31d: The ''hifv_plotsummary'' task page; phases for the polarization calibrators in the RL and LR hands.]]
|[[Image:VLApipe-plotsummary-3-CASA6.2.1.png|400px|thumb|left|Fig. 33c: The ''hifv_plotsummary'' task page; amplitudes agains frequency for all science targets.]]
|}
|}


Line 545: Line 521:
</pre>
</pre>


==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage18&ms=all&subpage=t2-4m_details.html Stage 18. hif_makeimlist (cals)]: Compile a list of cleaned images to be calculated''' ====
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage18&ms=all&subpage=t2-4m_details.html Stage 18. hif_makeimlist (cals)]: Compile a list of cleaned images to be calculated''' ====
 
Finally, diagnostic images are made for each receiver frequency band by combining all covered spws for calibrators with a PHASE or BANDPASS intent (note that in our case the bandpass was derived from the FLUX calibrator as no BANDPASS intent was present). The images and basic parameters such as pixel resolution (cell size) and image sizes are listed in this step. The images are available in the directory in which the pipeline was executed (usually where the SDM is located). Images are produced for each receiver frequency band using the multi-frequency synthesis algorithm, i.e. in continuum mode corrected for spectral dependencies using the stretched uv-coverage as sampled by the observed channel frequencies.


Finally, diagnostic images are made for each receiver frequency band by combining all covered spws for calibrators with a PHASE or BANDPASS intent (note that in our case the bandpass was derived from the FLUX calibrator as no BANDPASS intent was present). For each image, this stage calculates basic imaging parameters such as pixel resolution (cell size) and image sizes (cf. Fig. 32).


{|  
{|  
|[[Image:VLApipe-makeimlist-CASA6.2.1.png|400px|thumb|left|Fig. 34: The ''hifv_makeimlist'' task page.]]
|[[Image:VLApipe-S-makeimlist-cals-CASA6.2.1.png|400px|thumb|left|Fig. 32: The ''hifv_makeimlist'' task page.]]
|}
|}
This stage also issues warnings when spws are flagged entirely.


<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
Line 562: Line 539:
</pre>
</pre>


==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage19&ms=all&subpage=t2-4m_details.html Stage 19. hif_makeimages (cals)]: Calculate clean products''' ====
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage19&ms=all&subpage=t2-4m_details.html Stage 19. hif_makeimages (cals)]: Calculate clean products''' ====


The images from the previous stage are shown in this final pipeline task.  
Based on the information from the previous ''hif_makeimlist'' stage, the images are now created by running the CASA task [https://casadocs.readthedocs.io/en/v6.2.1/api/tt/casatasks.imaging.tclean.html tclean] and made available in the directory in which the pipeline was executed (usually where the SDM is located). Images are produced for each receiver frequency band using the multi-frequency synthesis algorithm, i.e. in continuum mode corrected for spectral dependencies using the stretched uv-coverage as sampled by the observed channel frequencies.


Imaging parameters are provided for each image (Fig. 35). They contain beam characteristics as well as image statistics.   
Image properties are provided for each image (Fig. 33). They contain beam characteristics as well as image statistics.   


{|  
{|  
|[[Image:VLApipe-makeimages-CASA6.2.1.png|400px|thumb|left|Fig. 35: The ''hifv_makeimages'' task page.]]
|[[Image:VLApipe-makeimages-cals-CASA6.2.1.png|400px|thumb|left|Fig. 33: The ''hifv_makeimages'' task page.]]
|}
|}


The full range of [https://casadocs.readthedocs.io/en/v6.2.0/api/tt/casatasks.imaging.tclean.html tclean] results can be accessed by the link under the images: "View other QA images...". For the first field, an example is given in Fig. 36. "Other QA images" will include: image, residual, and clean mask in the first row; the dirty image on the second row; and the primary beam, psf, and final model in the third row. A clean mask is shown, too, but it is currently not created for the VLA pipeline.  
The full range of [https://casadocs.readthedocs.io/en/v6.2.1/api/tt/casatasks.imaging.tclean.html tclean] products can be accessed by the link under the images: "View other QA images...". For the first field, an example is given in Fig. 34. The cleaning is performed in two stages, where the first stage is simply a dirty image, and the next iteration starts the actual deconvolution. For each iteration, the image and the residual are shown, together with a clean mask (here, the truncated primary beam). Other images on this page include the primary beam, the psf, and the final model.  


{|  
{|  
|[[Image:VLApipe-cleanresults-CASA6.2.1.png|400px|thumb|left|Fig. 36: All QA images.]]
|[[Image:VLApipe-cleanresults-cals-CASA6.2.1.png|400px|thumb|left|Fig. 34: All QA images.]]
|}
|}


This step concludes the calibration pipeline.


<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
CHECK for: degraded images, strong ripples, calibrators that do not resemble the point spread function (psf). Such images may indicate RFI or mis-calibrated sources. If the actual rms is far from the theoretical noise, this could indicate that deeper cleaning is required. But that may not be important for these calibrator images.
CHECK for: degraded images, strong ripples, calibrators that do not resemble the point spread function (psf). Such images may indicate RFI or mis-calibrated sources.  
</pre>
</pre>


Line 587: Line 566:
</pre>
</pre>


==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage20&ms=all&subpage=t2-4m_details.html Stage 20. hif_exportdata]: Create data products to be archived.''' ====
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage20&ms=all&subpage=t2-4m_details.html Stage 20. hif_exportdata]: Create data products to be archived.''' ====
 
This stage is only shown for data that were run through the NRAO production pipeline and will usually not show up during manual execution of the pipeline. It provides information on the data products that will be available in the archive. Weblogs and calibration files are bundled and zipped in addition to the flags (Fig. 35). Images are converted to FITS format. More information on the files and the restoration process is provided on the [http://go.nrao.edu/vla-pipe  VLA pipeline homepage].


This stage is only shown for data that has been run by the NRAO production pipeline run and will not show up for manual execution of the pipeline. It provides information on the data products that are available to the archive. Weblogs, and calibration files are bundled and zipped in addition to the flags (Fig. 37). More information on the files and the restoration process is provided on the [http://go.nrao.edu/vla-pipe  VLA pipeline homepage].
{|  
{|  
|[[Image:VLApipe-exportdata-CASA6.2.1.png|400px|thumb|left|Fig. 37: Exportdata screen.]]
|[[Image:VLApipe-S-exportdata-CASA6.2.1.png|400px|thumb|left|Fig. 35: Exportdata screen.]]
|}
|}


<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
CHECK for: N/A
</pre>
<pre style="white-space: pre-wrap; background-color: #d8bfd8;">
QA: N/A
</pre>
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage21&ms=all&subpage=t2-4m_details.html Stage 21. hif_mstransform]: Create MS for imaging.''' ====
This stage is the first step of the target imaging pipeline. All 'TARGET' scans are extracted from the parent MS and written into a new MS.
{|
|[[Image:VLApipe-S-mstransform-CASA6.2.1.png|400px|thumb|left|Fig. 36: Extraction of all TARGET scans into a new MS.]]
|}
<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
CHECK for: N/A
</pre>
<pre style="white-space: pre-wrap; background-color: #d8bfd8;">
QA: N/A
</pre>
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage22&ms=all&subpage=t2-4m_details.html Stage 22. hif_checkproductsize]: Derive the size of the image products.''' ====
Before the target imaging starts, ''hif_checkproductsize'' will attempt to determine the optimum for cell size (based on the longest baseline), field of view (based on the primary beam), and number of spectral channels (in our case this is a single continuum channel). The scientifically ideal size of the image, however, may not always be practical and sometimes be too large. Settable parameters can limit the size of the image (cube). If the calculations exceed this limit, the image size will be reduced by increasing the cell size, decreasing the image size, or creating somewhat wider spectral channels (Fig. 37). The current, maximum size for continuum imaging is 16384x16384 pixels.
{|
|[[Image:VLApipe-S-checkprods-CASA6.2.1.png|400px|thumb|left|Fig. 37: Check product size.]]
|}
<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
CHECK for: Plausibility of the parameters, in particular when the task tries to adjust the optimal imaging parameters to match a size limit.
</pre>
<pre style="white-space: pre-wrap; background-color: #d8bfd8;">
QA: N/A
</pre>
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage23&ms=all&subpage=t2-4m_details.html Stage 23. hif_makeimlist (cont)]: Calculate and define the target imaging parameters.''' ====
If the previous stage had limitations in the imaging parameters, they will now be used here. Otherwise, this stage itself is setting the parameters for the list of targets that will be imaged (Fig. 38). The image size aims to cover the inner primary beam for Ku and higher frequency and intends to reach the second null for X-band and lower (to include potential, bright sources that may still throw sidelobes into the main image). For A-configuration, though, images may be restricted by the 16384x16384 limit. Note that VLA Pipeline imaging only uses the standard gridder and is currently not applying special gridders like widefield or (a)w-projection.
{|
|[[Image:VLApipe-S-makeimlist-target-CASA6.2.1.png|400px|thumb|left|Fig. 38: Makeimlist for the target sources.]]
|}
<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
CHECK for: appropriate cell size for the images.
</pre>
<pre style="white-space: pre-wrap; background-color: #d8bfd8;">
QA: N/A
</pre>
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage24&ms=all&subpage=t2-4m_details.html Stage 24. hif_makeimages (cont)]: Create the target images.''' ====
The target images are now created by CASA's [https://casadocs.readthedocs.io/en/v6.2.1/api/tt/casatasks.imaging.tclean.html tclean] based on the previously determined imaging parameters. Image statistics and properties are provided here (Fig. 39). Additional imaging products are also available, similar to those in stage 19. Since the images are more complex, there are three stages now. The 0th stage is the creation of the dirty image, and the two subsequent stages include automasking procedures at two different cleaning depths (Fig. 40).
{|
|[[Image:VLApipe-S-makeimages-target-CASA6.2.1.png|400px|thumb|left|Fig. 39: Images screen.]]
|[[Image:VLApipe-S-cleanresults-target-CASA6.2.1.png|400px|thumb|left|Fig. 40: Images clean screen.]]
|}
<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
CHECK for: Image artifacts, missing short spacings, not fully deconvolved sources etc. The science target may be faint and not well shown in the weblog images. Use an image viewer to properly inspect the target image.
</pre>
<pre style="white-space: pre-wrap; background-color: #d8bfd8;">
QA: N/A
</pre>
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage25&ms=all&subpage=t2-4m_details.html Stage 25. hif_pbcor]: Apply primary beam corrections.''' ====
The Primary beam correction is applied in this stage that is separate from the imaging itself. Corrected images and residuals and new image statistics are displayed here (Fig. 41).
{|
|[[Image:VLApipe-S-pbcor-CASA6.2.1.png|400px|thumb|left|Fig. 41: Application of the primary beam.]]
|}
<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
CHECK for: N/A
</pre>
<pre style="white-space: pre-wrap; background-color: #d8bfd8;">
QA: N/A
</pre>
==== '''[https://casa.nrao.edu/Data/EVLA/Pipeline/S-CASA6.2.1/html/t2-4m.html?sidebar=sidebar_stage26&ms=all&subpage=t2-4m_details.html Stage 26. hif_exportdata]: Accumulate and prepare data to be archived.''' ====
For NRAO processing this step collects and packages the pipeline results for storage in the NRAO archive (Fig. 42). This is not required but could also be useful for users.
{|
|[[Image:VLApipe-S-exportdata26-CASA6.2.1.png|400px|thumb|left|Fig. 42: Exportdata screen.]]
|}


<pre style="white-space: pre-wrap; background-color: #E0FFFF;">
<pre style="white-space: pre-wrap; background-color: #E0FFFF;">

Latest revision as of 19:00, 28 February 2022

This guide is designed for CASA 6.2.1.


Introduction

When VLA observations are complete, the raw data need to be calibrated and imaged for scientific applications. This is achieved through various steps as explained in the VLA CASA tutorials. The different calibration procedures are also bundled in a general VLA calibration pipeline that is described on the VLA pipeline webpage. The pipeline can also include continuum target imaging.

At NRAO, the calibration portion of the pipeline is executed on every science scheduling block (SB) that the VLA observes successfully. Target imaging is left to the user, who can run either the imaging pipeline steps (cf. the VLA pipeline imaging webpage) or revert to manual imaging as explained in the VLA CASA tutorials. The VLA pipeline webpage describes how to run, modify, and re-execute the VLA pipeline. There are also instructions on how to restore archived pipeline products as well as a list of known issues. In the following material, we provide an example of a VLA pipeline weblog (calibration and imaging), explain the different pipeline stages, and describe some of the diagnostic information and plots. Frequent issues with VLA data, and how to address them with the pipeline are discussed on the Pipeline: Frequent VLA problems page, where signatures and treatment of problematic data are discussed.

The following data are VLA S-band continuum observations of the galaxy 3C75, a bright radio galaxy. The pipeline calibration discussed here can be followed up by polarization calibration and imaging as described in the CASA guide Polarization Calibration based on CASA pipeline (3C75).

The Pipeline Weblog

The pipeline run can be inspected through a weblog that is launched by pointing a web browser to file:///<path to your working directory>/pipelineTIME/html/index.html. Note that we regularly test the weblog on Firefox but less so on other browsers. So if you don't use Firefox, there's a chance that not all items are displayed correctly. Additionally, some browser security features may prevent the weblog from being displayed. The weblog may actually show a warning and a solution in the browser.

The following discussion is based on a weblog that can be viewed through the following link:

Pipeline Weblog


Alternatively, the weblog can be downloaded from https://casa.nrao.edu/Data/EVLA/Pipeline/VLApipe-Sguide-weblog-CASA6.2.1.tar.gz (25 MB)

and extracted via:

# In a Terminal
tar xzvf VLApipe-Sguide-weblog-CASA6.2.1.tar.gz

then point your browser to html/index.html (as of CASA 6.2.1 there can be a security setting in Firefox that needs to be set first; the weblog will prompt you with instructions if this is the case [frequently go to "about:config" in FIrefox and set security.fileuri.strict_origin_policy to false]). Chrome may not show all items properly unless started like Chrome --args --allow-file-access-from-files /path/to/weblog//html/index.html).

At the top of the landing page one can find the items Home (the index.html landing page), By Topic and By Task that provide navigation through the pipeline results.

Home Screen

The Home page of the weblog (Fig. 1) contains essential information such as the project archive code, the PI name, and the start and end time of the observations. The CASA and pipeline versions that were used for the pipeline run are also listed on this page, as well as a table with the MS name, receiver bands, number of antennas, on source time, min/max baseline lengths and their rms, and the file size BEFORE CALIBRATION (after processing and adding the MODEL and CORRECTED_DATA columns, the file size triples, as seen in Stage 13: applycals). The data were processed with earth orientation parameters that were available at the time of the processing. The pipeline uses predicted parameters when current ones are not available. The respected file versions for predicted and evaluated earth orientation parameters are listed under "IERSpredict" and "IERSeop2000", as provided by the International Earth Rotation and Reference System Service (IERS). Note that it usually takes a few months until the IERS re-evaluates and publishes updated earth orientation parameters. While the actual numbers of the data products change numerically after obtaining new parameters, the differences for VLA data are usually small and scientifically insignificant.

Since we also include target imaging, the weblog displays two MeasurementSets, the full one used for calibration, and one that only contains the target data.

Fig. 1: The main page of the weblog

Overview Screen

An Overview of the observations (Fig. 2) can be obtained by clicking on the MS name. As mentioned above, we look at the first MS, which is the full MS that is used for calibration.

Fig. 2: The weblog overview page.


This page provides additional information about the observation. It includes Observation Execution Time (date, time on source in UTC), Spatial Setup (science target and calibrator field names), Antenna Setup (min/max baseline lengths, number of antennas and baselines), Spectral Setup (band designations, including VLA baseband information; science bands include most calibrators, but exclude pointing and setup scans), and Sky Setup (min/max elevation). The page also provides graphical overviews of the scan intent and field ID observing sequence. A plot with weather information is also included. Clicking the blue headers provides additional information on each topic.


The Spatial Setup page (Fig. 3) lists all sources and fields (where a source is a field with additional information, e.g. it could describe flux variations). Names, IDs, positions, and scan intents are listed for each source/field.

Fig. 3: Spatial Setup page.


The Antenna Setup (Fig. 4a) page lists the locations of all antennas (antenna pad name and offset from array center) and contains graphical location plots for the array configuration (one linear and one logarithmically scaled for better separation of close antenna labels). A third plot shows a representative uv-coverage. On a second tab, baseline lengths are listed and the 'percentile' column provides a rough indication of how many baselines are shorter than that in each row (Fig. 4b).

Note that antenna IDs are not the same as antenna names. Antennas IDs are assigned when the data are imported to CASA. Thus, antenna ID 1 may or may not be the same as antenna 'ea01'. The Antenna setup page here shows the mapping between IDs and names.

Fig. 4a: Antenna Setup page (Antennas).
Fig. 4b: Antenna Setup page (Baselines).


The Spectral Setup page (Fig. 5) contains all spectral window descriptions, including start, center and end frequencies, the bandwidth of each spectral window (spw), as well as the number of spectral channels and their widths in frequency and velocity units. For each spw, the polarization products and the receiver bands are also listed. The real id is the spw id of each SB; the virtual id is a renumbered identifier when multiple SBs are combined (currently only an ALMA option).

Note that Science Windows contain all spws that are used for calibration. Setup and pointing scans are not part of science windows but they are available under All Windows together with their intents.

Fig. 5: Spectral Setup page.


Clicking the Sky Setup page (Fig. 6) leads to Elevation versus Azimuth and Elevation versus Time plots for the entire observation. The temporal plots are colorized by field id. The page also contains a representative uv-coverage and a solar elevation plot is also shown.

Fig. 6: Sky Setup page.


Scans (Fig. 7) provides a listing of all scans, including start and stop time stamps, durations, field names and intents, and the tuning (spw) setup for each. Again Science Scans and All Scans can be inspected in separate tabs.

Fig. 7: Scans page.

Most of the above information can also be accessed by the 'LISTOBS OUTPUT' button. The link leads to the output of the CASA listobs task, which summarizes the details of the observations (Fig. 8), including the scan characteristics, with observing times, scan ids, field ids and names, associated spectral windows, integration times, and scan intents. Further down, the spectral window characteristics are provided through their ids, channel numbers, channel widths, start and central frequencies. Sources and antenna locations are also part of the listobs output (On some browsers the listobs text is best readable when opened in a new tab without line wrapping).

Fig. 8: The listobs output.

By Topic Screen

The top-level By Topic link leads to a page that provides basic pipeline summaries such as warnings, the four lowest QA scores (see below), and flagging summaries as functions of field, antenna, and spectral window (spw; Fig. 9). Links are provided to jump directly to the pipeline step that issued the warning or low score.


Fig. 9: The By Topic page of the weblog.

By Task Screen: Overview of the Pipeline Heuristic Stages

The calibration pipeline is divided into 19 (20 when including the exportdata stage) individual pipeline heuristic stages with heuristic ('hif' or 'hifv' for heuristics interferometric [vla]) tasks listed under the By Task tab (Fig. 10). The imaging pipeline adds another 5 steps for a total of 26 steps in our example (including two archiving exportdata stages). Each stage has an associated score for success. If there are informational messages, warnings, or errors in tasks, they are indicated by '?', '!', and 'x' icons near the task names, respectively. In our example, an informational message and a few warnings are issued, mostly related to flagging.

Fig. 10: The By Task pipeline execution stages.

To obtain more details on each stage, click on the individual task name. Task sub-pages contain task results such as plots or derived numbers. Common to all pages is information on the Pipeline QA ('Quality Assurance'), the heuristic task Input Parameters, Task Execution Statistics (benchmarks), and the CASA logs. Those sections provide information on the triggered heuristics, as well as the actual CASA task execution commands and their return logger messages.

The QA scores have the following meaning:

  • 0.9-1.0 Standard/Good: green color - the stage appears to have completed successfully
  • 0.66-0.90 Below Standard: blue color - the stage has identified some issues, but they are not likely to affect the results substantially. It is still worth a check though.
  • 0.33-0.66 Warning: yellow color - there are serious issues identified in this stage. The results should be inspected carefully. Intervention may be needed.
  • 0.00-0.33 Error: red color - there are severe problems with the data processing. It may or may not be possible to rescue the data.


The Individual Stages

Before we go through the stages step by step, it is worth mentioning that the lines in the calibration table plots connect data along the x-axis when they have otherwise the exact same properties (i.e. same spw, field, polarization, etc.). When data are flagged the connector will not be plotted, so only consecutive, non-flagged data with the same properties are connected and gaps between data with the same color indicate flagged data.

Stage 1. hifv_importdata: Register VLA measurement sets with the pipeline

In the first stage, the raw SDM-BDF is imported into the VLA pipeline. An MS is created and basic information on the MS is provided, such as SchedBlock ID, the number of scans and fields, science targets, and the size of the MS. The MS is also checked for suitable scan intents and a summary of the initial flags is calculated (check the "CASA logs" attached to the bottom of the page).

Fig. 11: The hifv_importdata task page.
CHECK for: any errors in the import stage. Warnings will also be issued for missing, necessary scan intents or if the data had previously been processed. This is usually encountered when the pipeline is run on an MS rather than an SDM.  
QA: If the INTENT PHASE or FLUX are missing, the score will be set to 0. An existing processing history will set it to 0.5.

Stage 2. hifv_hanning: VLA Hanning Smoothing

This stage Hanning-smooths the MS. This procedure reduces the Gibbs phenomenon (ringing) when extremely bright and narrow spectral features are present and spill over into adjacent spectral channels. Gibbs ringing is typically caused by strong RFI or a strong maser line. As part of the process, Hanning smoothing will reduce the spectral resolution by a factor of 2 while maintaining the same number of channels. (Note: this means that data in adjacent channels will no longer be independent.) The first and last edge channel will be flagged. Hanning smoothing is turned off when any spectral window (spw) was frequency-averaged inside the WIDAR correlator. For such data, Hanning smoothing cannot correct for the Gibbs phenomenon anymore and would only add additional smearing.

CHECK for: nothing except for completion of the task. FOR SPECTRAL LINE DATA: you may decide not to run this stage since spectral lines will be smoothed to a degraded spectral resolution.
QA: N/A

Stage 3. hifv_flagdata: VLA Deterministic flagging

This stage applies flags that were generated by the VLA online system during the observations. The flags include antennas not on source (ANOS), shadowed antennas, scans with intents that are of no use for the pipeline (such as pointing and setup scans), autocorrelations, the first and last 5% edge channels of each spectral window (with a minimum of 1 channel), clipping absolute zero values that the correlator occasionally produces, quacking (i.e. flagging start or end integrations of scans; the pipeline will flag the first integration after a field change), and flagging the end 20MHz of the top and bottom spw of each baseband (when the baseband is <1GHz, the baseband flagging will be disabled). "Agent Commands" is the actual list of flagging commands that is sent to the CASA task flagdata. The flags are reported as a fraction of the total data for the full dataset as well as broken up into the individual calibrator scans and target data (according to their intents). A plot is provided that displays the online antenna flags as a function of time.

A flagging template can also be provided to the pipeline which applies known flags to the data (see The VLA Pipeline Webpage). These templates are created by a user before starting the pipeline. They are also prepared by NRAO staff for Science Ready Data products when needed.

In our example (Fig. 12), the target sources start with 3.125% flagged data that are due to Hanning smoothing, which flags the first and last channel of each spw (2 out of 64 channels in our case). The deterministic flagging stage adds various ANOS, baseband, and other flags (e.g. subreflector rotation, like the error in ea05 as plotted in the graph) for a total 4.4%. No flagging template was applied.

Fig. 12: The hifv_flagdata task page.
CHECK for: the percentage of the flags. If a very large portion (or even all) of the visibilities of the calibrators are flagged, try to find out the reason. Also have a quick look at the graph of the online flags to understand whether the system behaved normally or if there was an unusually high failure of some kind.
QA: Determined by the percentage of incremental flagging where 0 < score < 1 is the score range for 60% < fraction flagged data < 5%.

Stage 4. hifv_vlasetjy: Set calibrator model visibilities

Stage number 4 calculates and sets the calibrator spectral and spatial model for the standard VLA flux density calibrators (3C48, 3C138, 3C147, or 3C286 with a CALIBRATE_FLUX scan intent). The task page (Fig. 13) lists the calculated flux densities for each spectral window (spw). It also contains plots of the amplitude versus uv-distance for the models per spw that are calculated and used to specify the flux density calibrator characteristics. Our example uses 3C48, and for this array configuration and band the source appears largely as a point source given the flat uv-distance amplitudes. The spectral index, however is visible in the colored spws that are at different flux density levels.

If the scan intent CALIBRATE_FLUX is absent the pipeline will not run. If the calibrator is not a standard VLA flux density calibrator, the absolute flux density scale calibration will be on an arbitrary level.

Fig. 13: The hifv_setjy task page.
CHECK for: any unexpected flux densities or model shapes.
QA: If the flux calibrator is not one of the VLA flux standards (3C48, 3C138, 3C147, 3C286), the score will be 0.5. 

Stage 5. hifv_priorcals: Priorcals (gaincurves, opacities, antenna positions corrections and rq gains)

Next, the prior calibration tables are being derived. They include gain-elevation dependencies, atmospheric opacity corrections, antenna offset corrections, and requantizer (rq) gains. They are independent of the calibrator observations themselves and can be derived from ancillary data such as antenna offset tables, weather data, and antenna elevation. Switched power measurements are provided but currently not used in the pipeline. They can be manually inspected, e.g. for gain compression in the presence of strong RFI.

Opacities are calculated per spw and plotted together with additional information on the weather conditions during the observation (Fig. 14a). For S-band they are very low, as expected for frequencies that are largely unaffected by water vapor.

Fig. 14a: The hifv_priorcals task page.
Fig. 14b: The hifv_priorcals task page, continued.

The antenna positions are usually updated within a few days after an antenna was repositioned during the cycle (Fig. 14b). For our case, however, 7 antennas have updated positional corrections (on the order of a few millimeters) that will be applied during calibration.

CHECK for: extreme or unrealistic opacities. Also check that the antenna offsets are within are reasonable range (reasonable values are usually less than +/- 0.0200 meters). There should only be updates for a few antennas.
QA: N/A; but a warning will be issued when more than 50% of antennas need position corrections, or when the weather station data are absent for observations at K-band frequencies and above.

Stage 6. hifv_testBPdcals: Initial test calibrations

Now it is time to determine the delays and the bandpass solutions (gain and phase) for the first time. Applying the initial solution will make it easier to identify RFI that needs to be flagged. There will be a couple of similar iterations for the calibration tables in the following pipeline stages to eventually obtain the final set of calibration tables.

The plot on the main page (Fig. 15) shows the bandpass calibrator with the initial bandpass solutions applied. There are links to other plots showing delay, gain amplitude, gain phase, bandpass amplitude, and bandpass phase solutions for each antenna. Note that the pipeline will typically switch reference antennas, and therefore phase solutions of reference antennas may not be perfectly zero and may show some steps. When delays are more than +/-10ns it will be worth examining the data more closely. Some additional flagging may be needed.

Fig. 15: The hifv_testBPdcals task page.

The gain amplitude and phase solutions are derived per integration and they are used to correct for decorrelation before any spectral bandpass solutions are calculated (note that later stages do not show this plot anymore). The latter are determined over a full solution interval, usually for all bandpass scans together. Bandpasses should be smooth although they can vary substantially over wide frequency bands. The bandpass (BP) phase solutions are derived after systematic slopes were accounted for by the delay solutions.

Example delays are shown in Fig. 16a-c: The delays for ea13 vary but are within a narrow range of only a few ns (and small offsets between spws)(Fig. 16a). These are good solutions. The delays for ea13 and ea06 are fine given that they are only a few ns. Ea06 furthermore shows a systematic offset of the delays between the polarizations (Fig. 16b). This is nothing to worry about. Delays for ea28 are all zero (Fig. 16c). This is expected as ea28 is the reference antenna. Very large delays of hundreds of ns, very different delays between spws, random scatter or systematic problems (antenna, correlator, RFI, etc), should be flagged.

Fig. 16a: Delays for ea13.
Fig. 16b: Delays for ea06.
Fig. 16c: Delays for ea28.


The gain as a function of time for ea13 is shown in Fig. 17. It is flat and well behaved per spw. Offsets between the colored spws will be taken out as part of the calibration.

Fig. 17: Gain Amplitude for ea13.


Since the gain amp/phase steps per integration are only performed to reduce decorrelation, the phase plots are the most important diagnostics in this context. In Fig. 18 we show the solutions for ea13. They are flat and well behaved again, little decorrelation is visible that this table would correct for.

Fig. 18: Gain Phase for ea13.


Now let's have a look at the bandpasses themselves (Fig. 19). Antenna ea13 is again a good representative for all antennas. The colored spws are clearly distinguishable (2 polarizations plotted on top of each other). Edge channels show lower gain, in particular at the edge of the baseband, below ~2.6GHz.

Fig. 19: BP Gain for ea13.

The bandpass (BP) phases as a function of frequency/channel are shown in Fig. 20a-b. Spw edges have large phase changes, but they are still only a few degrees (Fig. 20a). Ea28 phases are zero, as expected for the reference antenna (Fig. 20b).


Fig. 20a: BP Phase for ea13.
Fig. 20b: BP Phase for ea28.

Flagging bad deformatter data

Included in this stage is the detection and removal of data transmission problems (aka 'bad deformatter' issue). A description of the effect is provided on the Pipeline: Frequent VLA problems page.

CHECK for: strong RFI and whether it was eliminated in later flagging stages or not (especially via a comparison with the output plots of stage 12). Also check for jumps in phase and/or amplitude away from spectral window edges. If there are phase jumps for all but the reference antenna, maybe a different choice for the reference antenna should be considered. Also watch out for extreme delays of tens of ns and for very noisy data. 
QA: checks are performed for the presence of delay and bandpass solutions for all science spws and antennas. The fraction of failed bandpass solutions changes the score to 0 < score < 1 for 60% < failed solutions < 5%. The score is furthermore reduced by 0.1 for every antenna where delays exceed >200ns. 

Stage 7. hifv_checkflag: Flag possible RFI on BP calibrator using rflag

Rflag as part of CASA's flagdata is a threshold-based automatic flagging algorithm in CASA. Tfcrop is a 2D (frequency/time) flagging algorithm that works on uncalibrated data. A combination of the two algorithms is run on the bandpass calibrator to remove relatively bright RFI and to obtain improved bandpass calibrations tables later on. The plots in Fig. 21 show the data before and after flagging. Note that sometimes the plots after flagging look worse, which is typically due to different averaging of the data.


Fig. 21: Checkflag on the bandpass calibrator.
CHECK for: RFI removal in the diagnostic plots and subsequent processing stages. Check if there are specific antenna/spw combinations that have high flagging percentages, and which may be better flagged entirely.
QA: determined by the percentage of incremental flagging where 0 < score < 1 is the score range for 60% < fraction flagged data < 5%.

Stage 8. hifv_semiFinalBPdcals: Semi-final delay and bandpass calibrations

Now that some RFI was flagged, stage 6 is repeated here at stage 8, which results in better bandpass and delay solutions. The warning is the same as in stage 6.

CHECK for: strong RFI and whether it was eliminated in later flagging stages or not (especially via a comparison with the output plots of stage 12). Also check for jumps in phase and/or amplitude away from spectral window edges. If there are phase jumps for all but the reference antenna, maybe a different choice for the reference antenna should be considered. Also watch out for extreme delays of tens of ns and for very noisy data. 
QA: checks are performed for the presence of delay and bandpass solutions for all science spws and antennas. The fraction of failed bandpass solutions changes the score  to 0 < score < 1 for 60% < failed solutions < 5%. The score is furthermore reduced by 0.1 for every antenna where delays exceed >200ns. 

Stage 9. hifv_checkflag: Flag possible RFI on all calibrators using rflag

Once more, tfcrop and rflag are executed, this time on all calibrator scans (Fig. 22). For the bandpass, after the bright RFI has been removed in stage 7 and a new bandpass solution has been applied in stage 8, a new flagging threshold will account for weaker RFI, which will be removed here in stage 9. The RFI is somewhat reduced but not fully removed. The complex gain calibrator (all calibrators are in common plots) shows an amplitude drop in a small frequency range around 2.7GHz, likely one spw. The calibration will take that into account.

Fig. 22: Checkflag on all calibrators.


CHECK for: RFI removal in the diagnostic plots and subsequent processing stages. Check if there are specific antenna/spw combinations that have high flagging percentages, and which may be better flagged entirely.
QA: determined by the percentage of incremental flagging where 0 < score < 1 is the score range for 60% < fraction flagged data < 5%.

Stage 10. hifv_solint: Determine solint and Test gain calibrations

For the final calibration, the pipeline determines the shortest and longest applicable solution intervals (solint). Typically the short solint is a visibility integration (dump) time interval; the longest of those are used when they differ during the observations. The long solint is derived from the length of the longest gain calibration scan.

In our case (Fig. 23) the longest solution interval, capturing the length of gain calibrator scans after flagging, is 207s. The short solution interval is 'int', which corresponds to one integration length, or 5s (cf. the overview page).


Fig. 23: The hifv_solint task page.

Initial temporal gain and phase solutions are calculated for each antenna, spectral window, and polarization using these time intervals. In Fig. 24a-d we show some examples for the gains. At this stage, the solutions are already quite good. The variations are very small, as can be seen for the representative antenna ea13 (the amplitude offsets between the scans are the different calibrator sources that are observed) (Fig. 24a). Antenna ea12, however, has some anomaly at around 7:28UT that the pipeline may try to flag (Fig. 24b). It should be flagged by hand, if the pipeline will not address it for the final calibration tables (stage 12). Also ea03 shows lower gain solutions in the second half of the run. That may need to be flagged, but could also reflect a true lower gain of that antenna in some spw/polarization (Fig. 24c).

Given the plotting algorithm, lines only connect the exact same setup (antenna spw, pol, etc). Flagged data will not be connected. The plots therefore sometimes look different in their visual appearance with connected lines sometimes even criss-crossing. E.g. ea28 has little flagging and most connectors are present whereas for other antennas the connectors are broken at flag boundaries (Fig. 24d).


Fig. 24a: Gain versus Time for ea13.
Fig. 24b: Gain versus Time for ea12.
Fig. 24c: Gain versus Time for ea03.
Fig. 24d: Gain versus Time for ea28.


Phase solutions are provided in Fig. 25a-d for antennas ea13, ea28, and ea18. Ea13 shows reasonably flat phases with little variations, except for phase jumps between different calibrators (Fig. 25a). The almost vertical lines seen for ea18 are irrelevant as they are connectors for -180 to 180 degree phase wraps (Fig. 25b). Ea28 is again the reference antenna with zero phases (Fig. 25c). For the calibrator around 5:55 UT, J2355+4950, however, the phases for ea28 spread out, indicating that a different antenna was the reference at that point. Indeed, ea19 shows zero phases for that scan and was used as the reference antenna at that time (Fig. 25d).

Fig. 25a: Phase versus Time for ea13.
Fig. 25b: Phase versus Time for ea18.
Fig. 25c: Phase versus Time for ea28.
Fig. 25d: Phase versus Time for ea19.
CHECK for: consistency with the data. The shortest solution interval should be close to the (longest) visibility integration time and the longest gain calibration scan. Gains should be smooth with little variations in time (where larger gain variations are more likely to occur for higher frequencies), phases should not show any jumps and should be relatively smooth in time (where larger phase variations are likely to occur for higher frequencies and longer baselines).
QA: N/A; but a warning will be issued when the long and short solint values are the same +/- one integration.

Stage 11. hifv_fluxboot: Gain table for flux density bootstrapping

Now, the flux densities are bootstrapped from the flux density calibrator to all other calibrators, including the complex gain (amplitude and phase) calibrator. To do so, polynominal functions are fitted for the secondary calibrators and the absolute flux densities are determined for each spw. They are then inserted in the MODEL column via setjy and reported for each spectral window.

For our example, the pipeline derives frequency-dependent flux densities between 0.94 and 0.99 Jy for 'J0259+0747' and 1.94 to 1.62 Jy for 'J2355+4950', the two calibrators that are observed with a PHASE intent. This is reflected in the polynomial fit results, where one source has a positive and the other a negative spectral index, also shown by the fits in the fourth panel in Fig. 26. The third panel shows the (very small) residual errors of the fits. A gaintable ('fluxgaincal.g') is generated based on these numbers and shown in the first plot, based on the source model that is shown in the second plot. If the plots show RFI or badly calibrated data, it is possible to edit the 'fluxgaincal.g' file using e.g. plotms. The VLA pipeline webpage has instructions on how to insert an edited table into the calibration run.

Fig. 26: The hifv_fluxboot task page.
CHECK for: that the flux density values are close to the known values for the calibrator. Check the VLA calibrator manual at https://science.nrao.edu/facilities/vla/observing/callist for consistency. Since most calibrator sources are time variable AGN, some differences to the VLA catalog are expected. In particular, at higher frequencies they could be different by up to tens of percent.
QA: based on the S/N and maximum residual of the fit. A fraction of 0.01 is deducted from a max score of 1.0 for each residual that is more than 1 sigma away from the mean. This value is calculated per source and normalized over all sources. 

Stage 12. hifv_finalcals: Final Calibration Tables

The final calibration tables are now derived. Those are the most important ones given that they are actually applied to the data in stage 13. The tables, which contain antenna based solutions, are: Final delay, bandpass (BP) initial gain phase, BP Amp solution, BP Phase solution, Phase (short) gain solution, Final amp time cal, Final amp freq cal, and Final phase gain cal. In Fig. 27a-h, we show an example of each of these for ea18. For this antenna all of the data look good. Bandpasses are smooth (although steep at the lower frequency end), phase solutions are within a few degree and gains (temporal and spectral) are close to unity with little deviation. The short phase solution is also pretty flat, indicating that decorrelation is very low.


Fig. 27a: Final delay calibration table for ea18.
Fig. 27b: Final, initial gain phase for bandpass for ea18.
Fig. 27ac: Final bandpass gain amplitude for ea18.
Fig. 27d: Final bandpass phase for ea18.
Fig. 27e: Short phase solution for ea18.
Fig. 27f: Temporal Gains for ea18.
Fig. 27g: Gains as a function of frequency for ea18.
Fig. 27h: Temporal phases for ea18.

Some antennas, however, show some problems (Fig. 28a-d). The gains for ea12 and ea03 start deviating from their ideal value for a few spws at about half of the observing run (Fig. 28a-b). This could be flagged. Also one spw for ea12 shows a spread around 2.67 GHz (Fig. 28c). That could be flagged, too. Ea28 is only displayed to show that this one is the phase reference (Fig. 28d).

Fig. 28a: Temporal gain for ea12.
Fig. 28b: Temporal gain for ea03.
Fig. 28c: Gains as a function of frequency for ea12.
Fig. 28d: Temporal phases for ea28.


CHECK for: strong RFI as well as jumps in phase and/or amplitude away from spectral window edges. If there are phase jumps for all but the reference antenna, maybe a different choice for the reference antenna should be considered. Also watch out for extreme delays of tens of ns and for very noisy data. 

Note that carefully checking calibrator tables in this stage is of particular importance as they are the final tables that are applied to the target source. Phase (and gain) calibration solutions should be inspected in their temporal variations to be smooth and consistent for each calibrator.
QA: checks are performed for the presence of delay and bandpass solutions for all science spws and antennas. The fraction of failed bandpass solutions changes the score to 0 < score < 1 for 60% < failed solutions < 5%. The score is furthermore reduced by 0.1 for every antenna where delays exceed >200ns. 

Stage 13. hifv_applycals: Apply calibrations from context

The calibration itself now concludes with the application of the derived calibration tables to the entire dataset. That includes all calibrators as well as the target sources. Note that there is no system temperature weighting of the calibration tables for the VLA (and the pipeline sets calwt=False in the CASA task applycal) since the switched power/Tsys calibration is currently not used.

In Fig. 29, we show the results of this step. The first table lists the calibration tables that are applied, and the fields, spectral windows, and antennas that are calibrated. The table also shows the field and spw mappings that were used as well as the interpolation mode (see applycal for the interpretation). For convenience, the final, actually applied calibration table names are available through the links in the last column. The second table provides information on the flagging statistics. Failed calibration solutions result in flagged calibrator table entries and eventually the data will also be flagged as no calibration can be derived for such data.

Fig. 29: The hifv_applycals task page.

Note that this stage also shows the final MS file size after the creation of the additional MODEL and CORRECTED_DATA columns.

CHECK for: reasonable flagging statistics. If the flagging increased dramatically, some calibration tables should be examined for proper solutions.
QA: determined by the percentage of incremental flagging where 0 < score < 1 is the score range for 60% < fraction flagged data < 5%.

Stage 14. hifv_checkflag: Flag RFI on target using rflag

The rflag and tfcrop heuristics are now applied to the target to prepare it for imaging (Fig. 30).

Fig. 30: Checkflag on the target.


CHECK FOR: RFI removal in the target data through the diagnostic plots and data statistics. FOR SPECTRAL LINE DATA: do not run this step unless a cont.dat file is provided (c.f. the VLA Pipeline Webpage at http://go.nrao.edu/vla-pipe). Otherwise the spectral lines may be flagged, too.
QA: determined by the percentage of incremental flagging where 0 < score < 1 is the score range for 60% < fraction flagged data < 5%.

Stage 15. hifv_targetflag: Targetflag

The flagdata automated flagging routine rflag is run one more time with slightly different heuristics on all sources to remove additional RFI and other outliers from the data.

CHECK for: RFI removal in the target data (use plotms). Although flagging is performed for all fields, any additional flags have no more influence on the calibration tables because the calibration was applied in a previous stage. Flagging may, however, improve all images that are made in the following stages. In particular, the target fields are flagged here for the first time which will benefit their image quality. FOR SPECTRAL LINE DATA: do not run this step unless a cont.dat file is provided (c.f. the VLA Pipeline Webpage at http://go.nrao.edu/vla-pipe). Otherwise the spectral lines may be flagged, too.
QA: determined by the percentage of incremental flagging where 0 < score < 1 is the score range for 60% < fraction flagged data < 5%.

Stage 16. hifv_statwt: Reweighting visibilities

Since the VLA pipeline is currently not using the switched power calibration, there can be some sensitivity variations of the data over time due to changes in opacity, elevation, temperature (gradients) of the antennas, etc. It is usually advisable to weigh the data according to the inverse of the square of their noise. This is done via the CASA task statwt and will increase the signal-to-noise ratio of images. It might be worth going to the casa log that is linked on this page and check the variance and mean of the weights. If the variance is more than 100 times larger than the mean, then something is likely wrong and the data should be inspected further.

Note that features such as RFI spikes and spectral lines will influence RMS calculations and usually result in down-weighting data that includes such features.

CHECK for: mean and variance of the weights. Also: images that are created later should improve in their signal-to-noise. FOR SPECTRAL LINE DATA: do not run this step as spectral lines may be weighted down unless a cont.dat file is provided (cf the VLA Pipeline Webpage at http://go.nrao.edu/vla-pipe).
QA: N/A

Stage 17. hifv_plotsummary: VLA Plot Summary

This task produces diagnostic plots of the final, calibrated data. These include: calibrated phase as a function of time for all calibrators, and amplitudes as a function of UVwave (UVdistance) for all science fields (incl. calibrators; Fig 31a); the amplitudes and phases as a function of frequency for the bandpass and phase calibrator(s) colored by antenna (Fig. 31b); amplitude against frequency for all science targets, colorized by spw (Fig. 31c); and phases as a function of time for all cross-hands (RL, LR) of the polarization calibrators (Fig. 31d).

The phases for all calibrators should be around zero. A large scatter like at 5:50 UT (first plot in Fig. 31a) should be inspected and could indicate that more flagging is required. We have already identified scans at this time range to show some problems in some antennas (e.g. ea01 and ea02; cf. Fig. 28a). Point sources with a flat spectral index should show up in the UVwave plots as straight, horizontal lines. The offset between the colored spws shows the spectral index of the sources.

The phases and amplitudes as a function of frequency for the phase calibrator overall look fine. Some scatter could be flagged and calibrated again, but if the scatter is symmetric, then the calibration table may still have good solutions. The zig-zag pattern of the phases is due to a small mismatch in the delay measurement timing (also known as 'delay clunking'). This is an internally generated effect. Typically the effect is averaged out over time.


Fig. 31a: The hifv_plotsummary task page; amplitudes as a function of UVwave.
Fig. 31b: The hifv_plotsummary task page; amplitudes and phases as a function of frequency for calibrators.

The amplitudes as a function of frequency for all targets can be used to identify RFI or other problems with the data. Structure is only expected for very strong target sources.

The pipeline does not perform polarization calibration. The CASA guide Polarization Calibration based on CASA pipeline (3C75) explains how to do this, and is based on the results from this pipeline run.

Fig. 31c: The hifv_plotsummary task page; amplitudes as a function of frequency for all science targets.
Fig. 31d: The hifv_plotsummary task page; phases for the polarization calibrators in the RL and LR hands.
CHECK for: outliers, jumps, offsets, and excessive noise.
QA: N/A

Stage 18. hif_makeimlist (cals): Compile a list of cleaned images to be calculated

Finally, diagnostic images are made for each receiver frequency band by combining all covered spws for calibrators with a PHASE or BANDPASS intent (note that in our case the bandpass was derived from the FLUX calibrator as no BANDPASS intent was present). For each image, this stage calculates basic imaging parameters such as pixel resolution (cell size) and image sizes (cf. Fig. 32).

Fig. 32: The hifv_makeimlist task page.

This stage also issues warnings when spws are flagged entirely.

CHECK for: appropriate cell size for the images.
QA: N/A

Stage 19. hif_makeimages (cals): Calculate clean products

Based on the information from the previous hif_makeimlist stage, the images are now created by running the CASA task tclean and made available in the directory in which the pipeline was executed (usually where the SDM is located). Images are produced for each receiver frequency band using the multi-frequency synthesis algorithm, i.e. in continuum mode corrected for spectral dependencies using the stretched uv-coverage as sampled by the observed channel frequencies.

Image properties are provided for each image (Fig. 33). They contain beam characteristics as well as image statistics.

Fig. 33: The hifv_makeimages task page.

The full range of tclean products can be accessed by the link under the images: "View other QA images...". For the first field, an example is given in Fig. 34. The cleaning is performed in two stages, where the first stage is simply a dirty image, and the next iteration starts the actual deconvolution. For each iteration, the image and the residual are shown, together with a clean mask (here, the truncated primary beam). Other images on this page include the primary beam, the psf, and the final model.

Fig. 34: All QA images.


This step concludes the calibration pipeline.

CHECK for: degraded images, strong ripples, calibrators that do not resemble the point spread function (psf). Such images may indicate RFI or mis-calibrated sources. 
QA: a linear score between 0 to 1 is assigned for signal to noise ratios between 5 and 100. 

Stage 20. hif_exportdata: Create data products to be archived.

This stage is only shown for data that were run through the NRAO production pipeline and will usually not show up during manual execution of the pipeline. It provides information on the data products that will be available in the archive. Weblogs and calibration files are bundled and zipped in addition to the flags (Fig. 35). Images are converted to FITS format. More information on the files and the restoration process is provided on the VLA pipeline homepage.

Fig. 35: Exportdata screen.


CHECK for: N/A
QA: N/A

Stage 21. hif_mstransform: Create MS for imaging.

This stage is the first step of the target imaging pipeline. All 'TARGET' scans are extracted from the parent MS and written into a new MS.

Fig. 36: Extraction of all TARGET scans into a new MS.
CHECK for: N/A
QA: N/A

Stage 22. hif_checkproductsize: Derive the size of the image products.

Before the target imaging starts, hif_checkproductsize will attempt to determine the optimum for cell size (based on the longest baseline), field of view (based on the primary beam), and number of spectral channels (in our case this is a single continuum channel). The scientifically ideal size of the image, however, may not always be practical and sometimes be too large. Settable parameters can limit the size of the image (cube). If the calculations exceed this limit, the image size will be reduced by increasing the cell size, decreasing the image size, or creating somewhat wider spectral channels (Fig. 37). The current, maximum size for continuum imaging is 16384x16384 pixels.

Fig. 37: Check product size.


CHECK for: Plausibility of the parameters, in particular when the task tries to adjust the optimal imaging parameters to match a size limit. 
QA: N/A

Stage 23. hif_makeimlist (cont): Calculate and define the target imaging parameters.

If the previous stage had limitations in the imaging parameters, they will now be used here. Otherwise, this stage itself is setting the parameters for the list of targets that will be imaged (Fig. 38). The image size aims to cover the inner primary beam for Ku and higher frequency and intends to reach the second null for X-band and lower (to include potential, bright sources that may still throw sidelobes into the main image). For A-configuration, though, images may be restricted by the 16384x16384 limit. Note that VLA Pipeline imaging only uses the standard gridder and is currently not applying special gridders like widefield or (a)w-projection.

Fig. 38: Makeimlist for the target sources.
CHECK for: appropriate cell size for the images.
QA: N/A

Stage 24. hif_makeimages (cont): Create the target images.

The target images are now created by CASA's tclean based on the previously determined imaging parameters. Image statistics and properties are provided here (Fig. 39). Additional imaging products are also available, similar to those in stage 19. Since the images are more complex, there are three stages now. The 0th stage is the creation of the dirty image, and the two subsequent stages include automasking procedures at two different cleaning depths (Fig. 40).

Fig. 39: Images screen.
Fig. 40: Images clean screen.
CHECK for: Image artifacts, missing short spacings, not fully deconvolved sources etc. The science target may be faint and not well shown in the weblog images. Use an image viewer to properly inspect the target image. 
QA: N/A

Stage 25. hif_pbcor: Apply primary beam corrections.

The Primary beam correction is applied in this stage that is separate from the imaging itself. Corrected images and residuals and new image statistics are displayed here (Fig. 41).

Fig. 41: Application of the primary beam.
CHECK for: N/A
QA: N/A

Stage 26. hif_exportdata: Accumulate and prepare data to be archived.

For NRAO processing this step collects and packages the pipeline results for storage in the NRAO archive (Fig. 42). This is not required but could also be useful for users.

Fig. 42: Exportdata screen.
CHECK for: N/A
QA: N/A


Last checked on CASA Version 6.2.1