Wednesday, May 13, 2009

A Coarse Course on 3-D imaging

An anonymous reader requests:
can someone help me out by writing the detail process of 3d imaging/cleaning after split file is created? I am new to AIPS and any kind of help is welcomed. thanks in advance..

I would recommend that you look at Joe Lazio's write-up, starting right about here:

He discusses using SETFC and IMAGR to image with multiple facets.
Some supplementary personal opinions of mine below the break...

So, what I would do is run SETFC as he instructs-- SETFC parameters look like:

AIPS 2: SETFC: Task to make a BOXFILE for input to IMAGR
AIPS 2: Adverbs Values Comments
AIPS 2: ----------------------------------------------------------------
AIPS 2: INNAME 'NGC3631' UV dataset name (name)
AIPS 2: INCLASS 'AVSPC' UV dataset name (class)
AIPS 2: INSEQ 1 UV dataset name (seq. #)
AIPS 2: INDISK 5 Disk drive #
AIPS 2: SOURCES *all ' ' Source selected
AIPS 2: BCOUNT 1 First field number to use
AIPS 2: BOXFILE 'N3631_610.BOX'
AIPS 2: disk file to write to (the
AIPS 2: input BOXFILE for IMAGR)
AIPS 2: CELLSIZE 0.8 0.8 (X,Y) size of grid in asec
AIPS 2: IMSIZE 2048 2048 field size
AIPS 2: SHIFT 0 0 Position shift (RA,Dec) asec
AIPS 2: for all fields
AIPS 2: FLUX 0 Minimum component flux =
AIPS 2: (source * beam)
AIPS 2: BPARM 0.35 10 (1) Inner region radius (deg)
AIPS 2: 0 1.5 (2) Field overlap (pixels)
AIPS 2: 0.1 512 (3) Factor to scale NVSS
AIPS 2: 512 *rest 0 fluxes, 0 -> 1
AIPS 2: (4) Radius NVSS search (deg)
AIPS 2: (5) Flux limit in NVSS (Jy)
AIPS 2: (6) IMSIZE for NVSS fields
AIPS 2: (7) IMSIZE for Sun fields
AIPS 2: (8) Write Clean boxes for
AIPS 2: NVSS fields
AIPS 2: (9) Maximum allowed phase
AIPS 2: error in imaging
AIPS 2: (10) Points per beaam
AIPS 2: PBPARM *all 0 Beam parameters:
AIPS 2: (1) Cutoff; (2) Use (3)-(7)
AIPS 2: (3)-(7) Beam shape parms
AIPS 2: NVSS input file name
AIPS 2: ' ' => AIPS provided.

But I'd also make sure your CELLSIZE is small enough to thoroughly sample point sources. What i would do is run SETFC once with CELLSIZE= 0 and IMSIZE = 0, and then decrease the CELLSIZE by a factor of 2 or 3, add that to the SETFC parameters, and rerun SETFC. You can let it suggest an IMSIZE to you, given the new CELLSIZE. The max IMSIZE i like to use is 2048, because much bigger than that and IMAGR will average large number of pixels together to show you the field.

Oftentimes I will tile the central portion of the image (out to ~1 primary beam, or to where bandwidth smearing really bites you, depending on the data; set by BPARM(1)) with bigger fields (IMSIZE=2048) and then let SETFC search for NVSS sources out to a radius ~2 times that of the primary beam (Radius set by BPARM(4)). I put smaller fields on these NVSS sources-- say 512 pixels (Set by BPARM(6)).

So, then you will have a list of boxes saved in a file (labelled by BOXFILE). It's now time to image. My IMAGR parameters look like this:

AIPS 2: IMAGR: Wide field imaging/Clean task
AIPS 2: Adverbs Values Comments
AIPS 2: ----------------------------------------------------------------
AIPS 2: INNAME 'NGC3631' Input UV data (name)
AIPS 2: INCLASS 'UVCOP' Input UV data (class)
AIPS 2: INSEQ 2 Input UV data (seq. #)
AIPS 2: INDISK 5 Input UV data disk drive #
AIPS 2: SOURCES *all ' ' Source name
AIPS 2: QUAL -1 Calibrator qualifier -1=>all
AIPS 2: CALCODE ' ' Calibrator code ' '=>all
AIPS 2: TIMERANG *all 0 Time range to use
AIPS 2: SELBAND -1 Bandwidth to select (kHz)
AIPS 2: SELFREQ -1 Frequency to select (MHz)
AIPS 2: FREQID -1 Freq. ID to select.
AIPS 2: SUBARRAY 0 Sub-array, 0=>all
AIPS 2: ANTENNAS *all 0 Antennas to plot
AIPS 2: BASELINE *all 0 Baselines with ANTENNAS
AIPS 2: DOCALIB -1 > 0 calibrate data & weights
AIPS 2: > 99 do NOT calibrate weights
AIPS 2: GAINUSE 0 CL (or SN) table to apply
AIPS 2: DOPOL -1 If >0.5 correct polarization.
AIPS 2: BLVER -1 BL table to apply.
AIPS 2: FLAGVER 0 Flag table version
AIPS 2: DOBAND -1 If >0.5 apply bandpass cal.
AIPS 2: Method used depends on value
AIPS 2: of DOBAND (see HELP file).
AIPS 2: BPVER -1 Bandpass table version
AIPS 2: SMOOTH *all 0 Smoothing function. See
AIPS 2: HELP SMOOTH for details.
AIPS 2: STOKES ' ' Stokes parameters (see HELP)
AIPS 2: BCHAN 1 Low freq. channel 0 for cont.
AIPS 2: ECHAN 56 Highest freq channel
AIPS 2: CHANNEL 0 Restart channel number
AIPS 2: NCHAV 56 Number of chan. to average.
AIPS 2: CHINC 1 Channel incr. between maps.
AIPS 2: BIF 0 First IF in average.
AIPS 2: EIF 0 Last IF in average.
AIPS 2: OUTNAME 'N3631_6' Output image name (name)
AIPS 2: OUTDISK 5 Output image disk drive #
AIPS 2: OUTSEQ 0 Output seq. no.
AIPS 2: OUTVER 0 CC ver. no (Continuum only)
AIPS 2: IN2NAME ' ' UV work file name
AIPS 2: IN2CLASS ' ' UV work file class
AIPS 2: IN2SEQ 0 UV work file seq
AIPS 2: IN2DISK 0 UV work file disk
AIPS 2: CELLSIZE 0.8 0.8 (X,Y) size of grid in asec
AIPS 2: IMSIZE 512 512 Minimum image size
AIPS 2: NFIELD 21 Number of fields (max 4096)
AIPS 2: DO3DIMAG 1 > 0 => use different tangent
AIPS 2: points for each field
AIPS 2: FLDSIZE *all 0 Clean size of each field.
AIPS 2: RASHIFT *all 0 RA shift per field (asec)
AIPS 2: DECSHIFT *all 0 DEC shift per field (asec)
AIPS 2: UVTAPER 0 0 (U,V) Gaussian taper
AIPS 2: units are kilo-lambda
AIPS 2: UVRANGE 0 0 Min & max baseline (klambda)
AIPS 2: GUARD 0 0 x,y guard band fractional
AIPS 2: radius
AIPS 2: ROTATE 0 Rotate image CCW from N by
AIPS 2: ROTATE degrees
AIPS 2: ZEROSP *all 0 0-spacing fluxes and weights
AIPS 2: UVWTFN ' ' UV dist. weight function
AIPS 2: UVSIZE 0 0 Array size for doing uniform
AIPS 2: weights. 0 -> actual field
AIPS 2: size.
AIPS 2: ROBUST 0 Robustness power: -5 -> pure
AIPS 2: uniform weights, 5 => natural
AIPS 2: UVBOX 0 Additional rows and columns
AIPS 2: used in weighting.
AIPS 2: UVBXFN 1 Box function type when UVBOX
AIPS 2: > 0. 0 -> 1 round pill box.
AIPS 2: XTYPE 5 Conv. function type in x
AIPS 2: default spheroidal
AIPS 2: YTYPE 5 Conv. function type in y
AIPS 2: default spheroidal
AIPS 2: XPARM *all 0 Conv. function parms for x
AIPS 2: YPARM *all 0 Conv. function parms for y
AIPS 2: NITER 130000 Maximum # of Clean components
AIPS 2: BCOMP *all 0 Begin at BCOMP component
AIPS 2: Specify for each field.
AIPS 2: ALLOKAY 0 For restart: > 0 => beams
AIPS 2: okay, > 1 => work file too
AIPS 2: NBOXES 0 Number of boxes for Clean
AIPS 2: NB: field 1 only.
AIPS 2: CLBOX *all 0 Four coordinates for each box
AIPS 2: BOXFILE 'N3631_610.BOX' Input file of field params
AIPS 2: and Clean boxes; ' ' => use
AIPS 2: OBOXFILE 'N3631_610.BOX' Output file for final Clean
AIPS 2: boxes
AIPS 2: GAIN 0.1 Clean loop gain
AIPS 2: FLUX 0 Minimum Clean component (Jy)
AIPS 2: MINPATCH 121 Min. BEAM half-width in AP.
AIPS 2: BMAJ 0 FWHM(asec) major axis Clean
AIPS 2: restoring beam.
AIPS 2: BMIN 0 FWHM(asec) minor axis Clean
AIPS 2: restoring beam.
AIPS 2: BPA 0 Clean beam position angle
AIPS 2: OVERLAP 2 1 => restore components to
AIPS 2: overlapped fields, >=2=>
AIPS 2: expect overlaps in Cleaning
AIPS 2: PHAT 0 Prussian hat height.
AIPS 2: FACTOR 0 Speedup factor see HELP
AIPS 2: CMETHOD ' ' Modeling method:
AIPS 2: 'DFT','GRID',' '
AIPS 2: IMAGRPRM *all 0 Task enrichment parameters
AIPS 2: (1) Antenna diameter (m)
AIPS 2: (2) Source Spectral index
AIPS 2: (3) Frequency scaling factor
AIPS 2: (4) > 0 -> SDI Clean factor
AIPS 2: (5) >0 => scale residuals
AIPS 2: (6) Half-width in x of box
AIPS 2: (7) Half-width in y of box
AIPS 2: (8) Filter components whose
AIPS 2: neighborhood is weaker than
AIPS 2: IMAGRPRM(8) Jy. 0 -> don't
AIPS 2: (9) Radius in pixels for the
AIPS 2: IMAGRPRM(8) test.
AIPS 2: (10) multiplier of image size
AIPS 2: to get beam size: 0 => 2;
AIPS 2: 2, 1, 0.5 0.25 supported
AIPS 2: (11-16) Multi-resolution
AIPS 2: added controls
AIPS 2: (17) spectral index radius
AIPS 2: 0 -> no correction
AIPS 2: (19) Dynamic range limit
AIPS 2: (20) Retry factor (see help)
AIPS 2: NGAUSS 0 Number of resolutions to use
AIPS 2: WGAUSS *all 0 Resolutions in arc sec >= 0
AIPS 2: FGAUSS *all 0 Minimum flux for each resol.
AIPS 2: MAXPIXEL 0 Maximum pixels searched in
AIPS 2: each major cycle.
AIPS 2: IN3NAME ' ' Spectral index image name
AIPS 2: IN3CLASS ' ' Spectral index image class
AIPS 2: IN3SEQ 0 Spectral index image sequence
AIPS 2: number
AIPS 2: IN3DISK 0 Spectral index image disk
AIPS 2: IN4NAME ' ' Spectral curvature name
AIPS 2: IN4CLASS ' ' Spectral curvature class
AIPS 2: IN4SEQ 0 Spectral curvature sequence
AIPS 2: number
AIPS 2: IN4DISK 0 Spectral curvature disk
AIPS 2: FQTOL -1 Frequency tolerance in kHz
AIPS 2: (primary beam & spec index)
AIPS 2: DOTV 1 Display residuals on TV ?
AIPS 2: Start with field = DOTV
AIPS 2: GRCHAN 0 Graphics channel of boundary
AIPS 2: BADDISK *all 0 Disks to avoid for scratch.
You're going to want to set CELLSIZE to the same value you used with SETFC. IMSIZE should be the size of the smallest field you are using-- so in this case, 512. Don't worry, IMAGR is smart enough to know that some of the fields are bigger than this.  NFIELD should be set to the number of fields output by SETFC. Set DO3D = 1 whenever you use facets. Set BOXFILE and OBOXFILE to the name of the file outputted from SETFC. Finally, set OVERLAP=2 and DOTV=1. See Joe Lazio's write-up for more detail on other parameters. 

Don't be surprised that imaging with multiple facets can be realllly slooow...especially if you also have multiple channels. You're going to want to watch IMAGR run on the TV and set clean boxes around your sources, which can sometimes swallow up an entire afternoon or more. On the bright side, now that you have set OBOXFILE, all the clean boxes will be saved to it, so you might not have to watch IMAGR run on the TV next time (unless you say, have self-caled and a bunch of new sources have popped up which now need to be boxed).

The rough general idea is that IMAGR is going to try to find the facet with the brightest flux peak in it, and it will present this facet to you for cleaning. Put boxes around the sources in the facet with TVBOX/REBOX, and then click on CONTINUE CLEAN. IMAGR will now clean some flux out of these boxes, and search again for the facet with the brightest peak. Just keep boxing and continuing to clean until it seems like you've cleaned pretty deeply. There's a good chance some of the facets don't have any sources in them, in which case you can just not box anything at all and then tell IMAGR to CONTINUE CLEAN. If there are no boxes, it will not clean anything.

When you finally STOP CLEANING, IMAGR will restore all the clean components and present you with NFIELD images. You can then use these images to self calibrate, if you like.

If I am planning on doing several self cal iterations, I will often go through the facets and eliminate those with no sources. I just edit the BOX file to remove the facets with no sources, and then decrease the NFIELD parameter in IMAGR appropriately.

When you're happy with your imaging, you can use FLATN to turn the many facets into one single big image. See the Lazio instructions here:


Sanch said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.
Unknown said...

During selfcal, after running imagr, I usually run task 'ccedt' to filter clean components and retain those defined by boxes. Running ccedt creates a cc file. So, some field maps end up having more than one cc file. when I run task 'calib', I get the following error message:

Why do I get this error? Any suggestion?