Initial data inspection and flagging - eakadams/ihow-hi GitHub Wiki
Inspection
After loading the data, the first step is to inspect and flag it. There are many ways to visualize and flag the data. plotms is the main visualization tool in CASA, and the data can be averaged and sliced in many different ways. This is covered in more detail in other tutorials with a few key examples below.

Plotting all data as a function of time (averaging all channels) and colorizing by field shows the two primary calibrator, phase, field, phase. Note the rising amplitudes for the source. Sextans B is a large source on the sky, and D-array has the shortes baselines, so this is likely field structure. Check this by plotting as a function of uvdistance:
The large amplitudes are on short baselines, consistent with what expect.
This source is relatively strong, so also check for the ability to see the HI line in the uv data
The line source is indeed clearly visible around channels ~130-140.
Note that there is one antenna with an odd bandpass behavior near where the source is:

Flagging
Before undertaking calibration, you want to first flag the data since "bad data is worse than no data". One of the first things to flag for is shadowing; this is when one antenna is (partially) blocked by another antenna as this impacts the flux calibration. In this case, we don't need to do this, as it happened during import (see the documentation for importvla):
Manual flagging
With a small dataset like this, manual flagging with visual inspection is possible. One nice way to do this is to use imview to view the visibilities are waterfall images and interactively flag them. Generally, it's best to look at all the fields separately for scaling purposes. And sorting by baseline length helps distinguish true sky response from bad data.
The flux calibrator looks fine, while the phase calibrator shows some emission near the center of the bandpass and around channel 185:
We don't expect emission at the location of the phase calibrator, and even if there were HI emission, we would want to flag it and interpolate over it so that it doesn't impact the calibration.
Then move on to looking at the source. The bad channels around 185 are sometimes present, so flag those as needed. At the end, look at phase and source together to find any missing flags. Note that you can see source emission spread over the center channels on short baselines (but you might not realize it):

You can find a dataset that the instructor manually flagged in the google drive; see the cross-calibration page for instructions.