Sunday, May 27, 2007

WBR Step 5C. Flag Your Calibrators

Ok, 'C' stands for continuum. There are slightly different calibration steps for deep continuum data; I'm going to follow the tips for L-Band data reduction given at this VLA website. That means we won't be using the CH 0 data, we'll be making our own Channel 0 after we bandpass-calibrate the line data. But I'm getting ahead of myself. What we have to do first is flag our calibrators. I like to only flag the calibrators very lightly, then calibrate them, and then flag more heavily on the calibrated data.


First, you should know that flagging is really a matter of personal taste. This is the way I like to do it, but you might find something that you like a whole lot more.

Secondly, don't be surprised when flagging is by far the most time consuming aspect of interferometric data reduction. Especially if you're screwing around with data from the VLA as it is transitioning to the EVLA.

Thirdly, at least at this stage, only flag on amplitude. After some calibration, you might consider flagging on phase, but not yet.

Fourthly, before you calibrate, I recommend you only flag on dramatically bad looking amplitudes. Don't get too selective yet.

So, as I mentioned above, let's run all of the below commands on the line data. This is more work for you, as you have to look at each channel, but it seems to be the more meticulous way of doing it. If you prefer, I guess you could flag on your CH 0 data, then just copy over the flag (FG) table (using TACOP) to the LINE data set. That might be faster. But you still should probable do a brief run through each channel to make sure there's nothing really glaring that you missed, when you averaged all the channels together.

A good place to start flagging is QUACK. QUACK flags the beginning of each scan of data, because often times the first little bit of time on an object is bad. QUACK from the 31Dec05 release of AIPS was really quite transparent, with parameters looking like this:


AIPS 1: QUACK Flags specified portion of scans of UV data
AIPS 1: Adverbs Values Comments
AIPS 1: ----------------------------------------------------------------
AIPS 1: INNAME 'AC825_FQ1' Input UV file name (name)
AIPS 1: INCLASS 'LINE' Input UV file name (class)
AIPS 1: INSEQ 1 Input UV file name (seq. #)
AIPS 1: INDISK 1 Input UV file disk unit #
AIPS 1: SOURCES *all ' ' Sources selected/deselected
AIPS 1: SUBARRAY 0 Subarray number 0=>all.
AIPS 1: SELBAND -1 Bandwidth to flag (kHz)
AIPS 1: SELFREQ -1 Frequency to flag (MHz)
AIPS 1: FREQID 1 Freq. ID to flag. -1=>all.
AIPS 1: 0=> first Freq. ID.
AIPS 1: TIMERANG *all 0 Time: start day,hr,min,sec
AIPS 1: stop day,hr,min,sec.
AIPS 1: ANTENNAS *all 0 Antennas to flag
AIPS 1: FLAGVER 0 Flag table version number
AIPS 1: OPCODE 'ENDB' 'END ', 'BEG ', 'ENDB'
AIPS 1: 'TAIL'; ' ' => 'BEG '
AIPS 1: REASON *all ' ' Reason (24 char.)
AIPS 1: APARM 0 .33 (1) => Cutting time (min)
AIPS 1: *rest 0 from end (ENDG) 0 => 2
AIPS 1: (2) => Cutting time (min)
AIPS 1: from beg/end (BEGB/ENDB)
AIPS 1: 0 => 0.1
AIPS 1: (3) Back start of flagging
AIPS 1: <0 => no padding (0 seconds)
AIPS 1: 0 => 5 seconds [default]
AIPS 1: >0 => APARM(3) seconds


In this case, I'm flagging the last third of a minute in each scan. If you wanted to flag the first part of a scan, you would set
OPCODE = 'BEG'. The Dec07 version of QUACK is really different and I don't understand it yet. Maybe someone can write in with pointers about it?

Good. Next, I like to look at my data in TVFLG and give it a quick flag. Here are some important parameters to consider before your run TVFLG.
SOURCES-- only look at one calibrator at a time in TVFLG. Otherwise your scale will be all messed up and you'll be confused.
TIMERANG-- You really really want all of your data to be able to fit with a smooth time of 10 seconds. What will happen is that if there is too much time spent on your source, AIPS will force you to average your data for multiples of 10s, and this is bad. Because you will flag your data, and think you got rid of the really bright points, but then you will look at all the visibilities in UVPLT and still see lots of bright points. You will be in for far fewer nasty surprises if you make sure smooth time is 10s (In the TVFLG window, it should say AVG 1). Therefore, if you're getting AVG > 1, you should probably break your data up and view it several times in TVFLG with different timeranges. You probably won't know if you need to set a timerange until you load up TVFLG once, and see how much data there is.
DOCAL = 2-- apply weights to your data before you view them in TVFLG.

AIPS 1: TVFLG: Task to edit UV data using the TV display and cursor
AIPS 1: Adverbs Values Comments
AIPS 1: ----------------------------------------------------------------
AIPS 1: USERID 0 User number.
AIPS 1: INNAME 'AC825_FQ1' UV data (name).
AIPS 1: INCLASS 'CH 0' UV data (class).
AIPS 1: INSEQ 1 UV data (seq. #). 0 => high
AIPS 1: INDISK 1 Disk unit #. 0 => any
AIPS 1: DOCAT 0 Catalog work file ?
AIPS 1: IN2SEQ 1 Sequence number of work file
AIPS 1: IN2DISK 1 Disk number of work file
AIPS 1: DOHIST -1 Record flags in history file
AIPS 1: SOURCES '1331+305' Source list
AIPS 1: *rest ' '
AIPS 1: CALCODE ' ' Calibrator code ' '=>all
AIPS 1: TIMERANG *all 0 Time range to include
AIPS 1: STOKES ' ' Stokes type to display
AIPS 1: SELBAND -1 Bandwidth to select (kHz)
AIPS 1: SELFREQ -1 Frequency to select (MHz)
AIPS 1: FREQID 0 Freq. ID to select.
AIPS 1: BIF 0 Lowest IF number 0=1
AIPS 1: EIF 0 Highest IF number
AIPS 1: BCHAN 0 Lowest channel number 0=>1
AIPS 1: ECHAN 0 Highest channel number
AIPS 1: ANTENNAS *all 0 Antennas to include
AIPS 1: BASELINE *all 0 Baselines with ANTENNAS
AIPS 1: UVRANGE 0 0 UV range in kilolambda
AIPS 1: SUBARRAY 0 Subarray, 0 => all, but the
AIPS 1: task is more efficient doing
AIPS 1: one at a time
AIPS 1: Cal. info for input:
AIPS 1: DOCALIB 2 If >0 calibrate data
AIPS 1: = 2 calibrate weights
AIPS 1: GAINUSE 1 CAL (CL or SN) table to apply
AIPS 1: DOPOL -1 If >0 correct polarization.
AIPS 1: BLVER -1 BL table to apply.
AIPS 1: FLAGVER 1 Flag table version 0 => high
AIPS 1: < 0 no flagging on input
AIPS 1: Used w single-source too
AIPS 1: DOBAND -1 If >0 apply bandpass cal.
AIPS 1: Method used depends on value
AIPS 1: of DOBAND (see HELP file).
AIPS 1: BPVER 0 Bandpass table version
AIPS 1: SMOOTH *all 0 Smoothing function. See
AIPS 1: HELP SMOOTH for details.
AIPS 1: DPARM 0 0 Control info:
AIPS 1: 0 0 (1) 0=amp, 1=phase, 2=rms,
AIPS 1: 10 10 3=rms/mean for initial
AIPS 1: *rest 0 display, can choose any
AIPS 1: interactively later
AIPS 1: (2) > 0 include autocorr data
AIPS 1: (3) >0 = baseline as ant pair
AIPS 1: for B as x-axis only
AIPS 1: (4) >0 => divide by source
AIPS 1: IPOL flux
AIPS 1: (5) Expand time ranges by
AIPS 1: DPARM(5) in sec
AIPS 1: (6) y-axis interval: give the
AIPS 1: sample time in seconds.
AIPS 1: default = 10 seconds.
AIPS 1: (7) initial IF displayed, 0
AIPS 1: => BIF, can choose BIF -
AIPS 1: EIF interactively
AIPS 1: (8) initial channel displayed
AIPS 1: 0 => BCHAN, can choose
AIPS 1: BCHAN - ECHAN later
AIPS 1: interactively
AIPS 1: (9,10) pixrange for initial
AIPS 1: TV load - can reset later
AIPS 1: interactively
AIPS 1: BADDISK *all 0 Disks to avoid for scratch
AIPS 1: and for master grid file.


Make sure that you look at all your channels, polarizations, and IFs. I like the 'clip interactively' command a lot for getting rid of high or low points.

I recently (finally!) figured out how to invert the scale in TVFLG, so that low points appear bright. Use the 'tvtransf' option, type an 'a' to get an option to change the contrast/brightness of the image. A little square will pop up. Type 'c' now to invert the image, and then move your mouse around with the button held down to get an image stretch you like. Tah Dah!

One useful note: You have to set the Stokes Flag in terms of 0's and 1's, and this is what the binary code means:
1000-- flag only right polarization
0100--flag only left polarization
1111--flag both polarizations

NOTE: TVFLG can take a long time to load if you have lots of channels or data. It's usually pretty fast for the calibrators, because you don't usually spend much time on them. But while TVFLG is loading up your target data (no, we're not there yet), you might want to go eat lunch. Depending on the data set.

Finally, double check everything in UVPLT. Beware, UVPLT likes to plot data in terms of Stokes I, which is quite confusing. Choose to plot STOKES = 'RR' or 'LL' for more clarity. BPARM is the important set of parameters which mostly determine what you're plotting. BPARM = 0 is a good place to start, as this plots amplitude against the length of your baselines.


2 comments:

Rodrigo said...
This comment has been removed by a blog administrator.
amanda said...

You probably also want to set docat = false in tvflg, so you don't get those annoying tvflg files in your catalog.