Sunday, April 15, 2007

Self Cal according to Claudia (as inspired by Crystal Brogan)

I'm pasting Claudia's notes below, about how she self calibrated her SMA data. I always like to see how people do their self cals! I'll probably post later some more details about how I personally do it.



CLEANING/SELF-CAL
Clean in IMAGR
To get a circle (as opposed to a square):
tvbox
"a"
"c"
to get another one, keep hitting c until you get a circle (may take a few times)
When cleaning interactively, in order not to have to redraw the boxes every time:

to create a boxfile, set a filename in oboxfile parameter in imagr (with the logical name ahead of it, same as when you're reading in a fits file)

Then, to use it once you've created in, set boxfile=oboxfile. This will read in the file, allow you to modify it, then spit it out again (with any modifications). Can leave this set in imagr through all the steps that follow

REBOX _not_ TVBOX to add boxes when you're working with a file--otherwise it will delete everything you already have

Stop cleaning when the image looks about uniform. A good way to decide when to stop is when the min and max (see pasted in example below) are about equal.

IMAGR2: I Polarization model processed
IMAGR2: Field 1 min = -15.4 MilliJy,max = 16.1 MilliJy

In a self-cal cycle, can tell that your image is improving if it includes more visibilities than the last iteration.

NB: The best self-cal model (the model is the image you're making of the UV dataset that comes out of a calib run) is the one that contains the most flux--but beware of boxing dubious sources, since anything you put into the model will create a source around it. If a dubious source gets weaker when you box another, more probably real source, that's a good indication
that it's not real.

Herringbone pattern can be due to amplitude errors, poor UV coverage, the beam shape being poorly defined.

HOW TO DO A PROPER SELF-CAL:
i) To get started, make an image of your original UV database (say BASFIT from UVLSF)and clean it as described above--probably only with on box.

ii) Task 'calib'
Do phase-only first: CALIB SOLMODE ='P '/Solution mode
Feed in as your model (get2n) the map made in (i)
Pick a short solution interval for phase, since phase varies quickly as a function of the atmosphere (say 2
minutes)
CALIB SOLINT = 2.00 /Soln. inter. (min)
CALIB APARM(1) = 4 /Min. no antennas
CALIB APARM(7) = 3.0 /SNR cutoff

Can use a lower S/N cutoff than the default b/c phase is constrained by phase closure.
set OUTCLASS for calib to 'calib' to distinguish the UV files that will come outalso add a _P to the filename to
mark it as phase-cal only

WHAT COMES OUT OF CALIB IS UV DATA WITH THE SN TABLE ALREADY APPLIED

iii) image your _P.CALIB UV file that 'calib' has produced, using imagr

iv) Run calib again. Input is your ORIGINAL UV data. The map (in2name) is the map you made in (iii). see
examples below.
112 CALIB INNAME='S255N_USB ' INCLASS='BASFIT'
113 CALIB INSEQ= 1 INDISK= 1
114 CALIB OUTNAME='S255N_USB_P1' OUTCLASS='CALIB '
115 CALIB OUTSEQ= 2 OUTDISK= 1
116 CALIB /TIMERANG = beginning to end
117 CALIB IN2NAME='S255N_USB ' IN2CLASS='ICL001'
118 CALIB IN2SEQ= 2 IN2DISK= 1
**this is very important. This makes the self-calibration insensitive to errors early on--eg boxing sources that it later becomes apparent you shouldn't have boxed. and it retains flexibility. And means that your original UV data file will accumulate SN tables, and you can correctly copy the last version over to the line data and apply it there. DON'T do iterative self-cal. This is most important with low S/N and poor UV coverage data--certainly the case for SMA.

Repeat steps (iii) and (iv) until the phase is as good as it can get.

Once it is:

v) do an amplitude calibration
NB: amplitude calibration is inherently much less constrained than phase calibration. Never do an amplitude calibration until the phases are fixed as best they can be.
This time, use your last, most correct, .CALIB UV file as an input to task CALIB
set CALIB APARM(7) = /SNR cutoff parameter back to =5 (since amplitude is much less constrained)

Unlike phase, which varies quickly as a function of atmosphere, amplitude should vary slowly, and the variation should be primarily due to instrumental effects
Want to solve for amplitude only once per scan (scan=length of time on source)
(for s255n data, 20 minutes)
set SOLINT=scan length

CALIB SOLMODE ='A&P '/Solution mode

vi) After amplitude calibration, do uvplt as a reality check. If you have crazy amplitude errors, specific baselines may jump way up. (Remember that you're actually changing the amplitudes with the amplitude calibration)

vii) SMA weights are based on tsys. Will (particularly with low S/N, poor UV coverage) get a better image if you apply the weights, rather than pretending all antennas have same tsys (which at SMA they emphatically don't).

So, make an image by running imagr, with your last calib phase file as an input, and applying the SN table (which will be the SN table from the amplitude calibration)
To do this:
142 IMAGR INNAME ='S255N_USB_P1'
143 IMAGR INCLASS ='CALIB'
144 IMAGR INSEQ = 4
(for example, if this is your most last phase cal iteration)
149 IMAGR DOCALIB = 2.00000E+00
150 IMAGR GAINUSE = 1

No comments: