NRAO Home > CASA > CASA Toolkit Reference Manual
imager.defineimage - Function

2.3.1 Set the image parameters for subsequent processing


Description

Define the default image parameters. If an image is to be made, then these parameters are used in the construction of the image. Thus, for example, the tool function make makes an (empty) image using these parameters.

Note that some parameters can be specified either in canonical units or via measures. To establish default values, the ids for the default spectral window and default field id must be given.

The parameter mode can be one of the following:

imager can perform multi-frequency synthesis over several spectral windows (mode=’mfs’). To achieve this, you should set spwid to an array of the required spectral windows (e.g. spwid=[0,1]).
WARNING: For multifrequency synthesis, ’mfs’, it is important that the spwid’s selected in selectvis be the SAME as the one selected in defineimage. Otherwise the frequency at which the image is made is not going to be the same as to the one as the one used in gridding the visibility and can lead to image artifacts. For mode=’velocity’ and mode=’frequency’ the step parameter has to be a measure/quantity of velocity or frequency, otherwise for mode=’channel’ step is the number of data channels to be averaged to make one image channel( see examples below).

The phase center of the image defaults to that of the specified phasecenter (the first fieldid in the ms is taken if none is specified), this parameter can be a fieldid or a measure string or the record output from the direction function of the measures tool( direction ). This is important if you have multiple pointings in the data. The user would have used selectvis to select which pointings would be used in imaging. If the conversion from the observed direction requires frame information then this is taken as follows:

If the specified number of facets is greater than unity then the image is split into facets (this number along the x and y axes) and processed. This is necessary when using wide-field algorithm for deconvolving the image, in cases of non-coplanar arrays (e.g the VLA at low frequencies but can be safely left at 1 for the ATCA or WSRT). This is now recommended only when memory or image size is of a problem, otherwise for widefield issues, wprojection (ftmachine parameter in setoptions) is recommended with a single facet.

For spectral imaging defineimage and selectvis defines the spectral channels that are imaged. Examples are given in the selectvis section. The parameter restfreq can be used to define what rest frequency to use in the resulting images. If none is specified imager will try to use the one that is defined in the ms. It will use the first one defined in the first spectral window selected.

For wide-field or 3D imaging see setoptions section for some examples.

If the telescope is observing moving source (e.g planet or moon) over a period of time. One may wish to image in a frame where the source is fixed. The parameter movingsource is for that. Setting it to a source that measures is aware of will force the imaging to realign (shift in SD imaging or phase rotation in interferometry imaging) the data so that the source appears fixed in the image. Obviously in doing so the background sources will be blurred. The coordinate system used to fix the source on is the one where the source is at the first time observed in the selected data.

Arguments





Inputs

nx

Total number of spatial pixels in x

allowed:

int

Default:

128

ny

Total number of spatial pixels in y

allowed:

int

Default:

-1

cellx

Cellsize in x (e.g. ’1arcsec’)

allowed:

any

Default:

variant 1.0

celly

Cellsize in y (e.g. ’1arcsec’)

allowed:

any

Default:

variant

stokes

Stokes parameters to image (e.g. ’IQUV’)

allowed:

string

Default:

IV

IQU

IQUV

I

phasecenter

Direction of phase center as a diretion measure or a field id

allowed:

any

Default:

variant 0

mode

Type of processing (velocity =radiovelocity)

allowed:

string

Default:

frequency

radiovelocity

opticalvelocity

truevelocity

mfs

nchan

Number of channels; a -1 (default) means all the channels as selected in selectvis and combined into one continuum channel

allowed:

int

Default:

-1

start

Start channel; A 0-relative channel number of the spwid or a frequency quantity or a velocity quantity or radial velocity measure

allowed:

any

Default:

variant 0

step

Step in channel; integer for number of channels or frequency quantity or velocity quantity or radial velocity measure

allowed:

any

Default:

variant 1

spw

Spectral Window Id (0 relative) that defines center of image

allowed:

intArray

Default:

0

restfreq

rest frequency to use; default =& use the one available in ms

allowed:

any

Default:

variant

outframe

frequency frame of output image (default LSRK, ”” => as input ms or LSRK in case of multiple ms’s), options are LSRK, LSRD, BARY, GALACTO, LGROUP, CMB

allowed:

string

Default:

LSRK

veltype

velocity definition (’radio’ or ’optical’ or ’relativistic’)

allowed:

string

Default:

optical

relativistic

radio

facets

Number of facets on each axis

allowed:

int

Default:

1

movingsource

Name of moving source, e.g planet or moon, to keep fixed in image

allowed:

any

Default:

variant

distance

Distance to object: usually ignore this! (m)

allowed:

any

Default:

variant 0.0

Returns
bool

Example

 
 
## Example 1  
im.defineimage(nx=1024,ny=1024, cellx=’30marcsec’,celly=’30marcsec’,  
nchan=1, stokes=’IV’, phasecenter=me.direction(’mars’));  
## Example 2  
im.defineimage(nx=1024,ny=1024, cellx=’30marcsec’,celly=’30marcsec’,  
nchan=1, stokes=’IV’, phasecenter=[’J2000’, ’19:00:30.5’, ’-45d00m25.6’]);  
## Example 3  
im.selectvis(nchan=10, start=3, spw=[0,1], field=[3, 4, 5, 6, 7, 9, 10])  
im.defineimage(nx=500, ny=500, mode=’mfs’, spwid=[0,1], fieldid=7)  
im.clean(algorithm=’mfclark’, niter=1000, model=’mosaic.model’, image=’mosaic.image’)  
 
## Example 4  
 
dir1=me.direction(’J2000’, ’20h00m00’, ’21d00m00’)  
dir2=me.direction(’J2000’, ’20h10m00’, ’21d00m00’)  
dir3=me.direction(’J2000’, ’20h00m00’, ’21d03m00’)  
im.defineimage(nx=100,  cellx=’0.1arcsec’, phasecenter=dir1)  
im.make(’box1’)  
im.defineimage(nx=100, cellx=’0.1arcsec’, phasecenter=dir2)  
im.make(’box2’)  
im.defineimage(nx=100, cellx=’0.1arcsec’, celly=’0.1arsec’, phasecenter=dir3)  
im.make(’box3’)  
im.clean(algorithm=’mfclark’, model=[’box1’, ’box2’, ’box3’],  
   image=[’box1.restored’, ’box2.restored’, ’box3.restored’],  
   residual=[’box1.residual’, ’box2.residual’, ’box3.residual’])  
 
 
 
In the first example, the image parameters are set for 1024 by 1024  
pixels of 30milli arcsec, 1 channel will be made, Stokes I and V will be  
imaged, and the phasecenter will be the direction of Mars as given by  
the JPL DE-200 emphemeris. In the second, the phase center is taken  
to be an absolute coordinate value.  
 
The third example shows the use of selectvis and defineimage to setup a mosaic. In  
the set data we have chosen 10 channels (for each spectral window) of data starting form  
channel 3. We also have selected spectral windows 0 and 1. We have selected data from  
fields 3 to 10. In the defineimage we decide to use the data to make a  
multifrequency synthesis image. We center the image on the field 7 pointing.  
 
The fourth example is use to clean regions where the user knows the  
sources are and ignore all the other regions. This is very efficient  
in large fields with few sources. Smaller outlier images are made and  
deconvolved around known sources rather than making a big image  
englobing all three fields.  
 
 
Now here are some examples about defining cubes using different {\tt mode}  
parameters.  
 
 
defining channels cubes use the channel as defined in the data  
 
im.defineimage(cellx=1000, mode=’channel’, nchan=100, start=10,  
step=1, spwid=range(0,10))  
 
 
now using frequency and overiding the rest frequency defined in  
the ms or if its not defined in the ms  
 
im.defineimage(cellx=1000, mode=’frequency’, nchan=100, start=’1GHz’,  
step=’10kHz’, restfrequency=’1.421GHz’)  
 
 
in case you have a frame with the frequency  
 
im.defineimage(cellx=1000, mode=’frequency’, nchan=100, start=[’LSRK’,  
’1GHz’], step=’10kHz’, restfrequency=’1.421GHz’)  
 
 
OR using measures  
 
freqstart=me.frequency(’LSRK’, ’1GHz’)  
im.defineimage(cellx=1000, mode=’frequency’, nchan=100,  
start=freqstart, step=’10kHz’, restfrequency=’1.421GHz’)  
 
 
similarly if you want to use  velocity to define your cube  
 
im.defineimage(cellx=1000, mode=’velocity’, nchan=100, start=[’LSRK’,  
’10km/s’], step=’1m/s’, restfrequency=’1.421GHz’)  
OR using measures  
velstart=me.radialvelocity(’LSRK’, ’10km/s’)  
im.defineimage(cellx=1000, mode=’velocity’, nchan=100, start=velstart,  
step=’1m/s’)  
 
 
Change mode to ’opticalvelocity’ if your velocity values are using  optical definition  
 

__________________________________________________________________


More information about CASA may be found at the CASA web page

Copyright © 2016 Associated Universities Inc., Washington, D.C.

This code is available under the terms of the GNU General Public Lincense


Home | Contact Us | Directories | Site Map | Help | Privacy Policy | Search