# linearmosaic¶

class linearmosaic[source]

combining images in a weighted fashion

The linearmosaic tool (lm) provides a toolkit for stitching images in a weighted fashion.

The default linear mosaic equation is defined by Equation (6) in Cornwell, Holdaway et al (Astronomy and Astrophysics, Vol. 271, p. 697 (1993)).

$I^{lm}(\theta)={{\sum_p A\_p(\theta)(I_p(\theta)A_p(\theta))w_p}\over{\sum_p A\_p^2(\theta)w_p}}$

where $$A_p(\theta)$$ is the primary beam (PB) of a given pointing $$p$$, $$w_p$$ is a sensitivity weight and the image of that pointing is $$I_p(\theta)$$; the linear mosaic being $$I^{lm}(\theta)$$

Methods Summary

 defineoutputimage Define the direction axes output image parameters. linearmosaic Create a linearmosaic tool. makemosaic Put the list of images onto the mosaic image using the weight images saultweightimage “Sault weighted” image is one which is more pleasant to view (without high noise at the edges of mosaic images), it is flux correct upto a where the beam coverage becomes low and is tapered off onwards just to keep the noise from rising in the overall image(see Eq[2] from Sault, Staveley-Smith and Brouw (1996), Astron. setlinmostype Use this function if the mosaicing is to be done using a non optimal weighting mode. setoutputimage Use this function if the mosaicing is to be done onto a previous mosaic or image.
defineoutputimage(nx=128, ny=- 1, cellx='1.0', celly='', imagecenter='0', outputimage='', outputweight='')[source]

Define the direction axes output image parameters. The output image will get the same number of spectral and polarization planes as the input images. This function create a fresh new output image. If an image of the same name exist on disk it will be erased. The spectral and polarization part of the image will be identical to the images that are being mosaiced.

The output image will by default be flux correct and the weight image will be $${\sum_p A\_p^2(\theta)}$$ where the primary beam is $$A\_p(\theta)$$

Parameters

• nx (int=128) - Total number of spatial pixels in x

• ny (int=-1) - Total number of spatial pixels in y

• cellx (variant='1.0') - Cellsize in x (e.g. ‘1arcsec’)

• celly (variant='') - Cellsize in y (e.g. ‘1arcsec’)

• imagecenter (variant='0') - Direction of phase center as a diretion measure

• outputimage (string='') - output image name

• outputweight (string='') - output weight image name

Returns

bool

Examples

lm.defineoutputimage(nx=3000, cellx='3arcsec', imagecenter='19h13m13.469 4d50m09.649', outputimage='test.linmos', outputweight='test.weightlinmos')

linearmosaic()[source]

Create a linearmosaic tool.

makemosaic(images='', weightimages='', imageweighttype=1, weighttype=1)[source]

Put the list of images onto the mosaic image using the weight images

Parameters

• images (variant='') - Name of images to mosaic

• weightimages (variant='') - Name of images to mosaic

• imageweighttype (int=1) - what kind of weight is already applied to image n 0: flux correct n 1: Primary beam equivalent weight n 2: PB^2 equivalent n

• weighttype (int=1) - what kind of weight image it is n 1: Primary beam equivalent weight n 2: PB^2 equivalent n

Returns

bool

Examples

 lm.defineoutputimage(nx=3000, cellx='3arcsec', imagecenter='19h13m13.469 4d50m09.649', outputimage='test.linmos')

###make a mosaic of two fields
lm.makemosaic(images=['FIELD_31/img.image', 'FIELD_33/img.image'], weightimages=['FIELD_31/img.pb', 'FIELD_33/img.pb'])

####now we have another submosaic (which is flux corrected) we want to add to this mosaic

lm.makemosaic(images='submosaic.image', weightimages='submosaic.flux',  imageweighttype=0, weighttype=1)

saultweightimage(outputimage='', fracpeak=0.1)[source]

“Sault weighted” image is one which is more pleasant to view (without high noise at the edges of mosaic images), it is flux correct upto a where the beam coverage becomes low and is tapered off onwards just to keep the noise from rising in the overall image(see Eq[2] from Sault, Staveley-Smith and Brouw (1996), Astron. Astrophys. Suppl, 120, 375)

Parameters

• outputimage (string='') - Name of image to create the Sault-Weighted image

• fracpeak (double=0.1) - Upto what fraction of peak of coverage should the image be flux correct

Returns

bool

Examples

 lm.defineoutputimage(nx=3000, cellx='3arcsec', imagecenter='19h13m13.469 4d50m09.649', outputimage='test.linmos')
lm.makemosaic(images=['FIELD_31/img.image', 'FIELD_33/img.image'], weightimages=['FIELD_31/img.pb', 'FIELD_33/img.pb'])
###the above will make a flux correct mosaic of the 2 images in a flux correct fashion in test.linmos
#Now make a Sault weighted image to use in the viewer
lm.saultweightimage('test_sault.linmos')

setlinmostype(linmostype='optimal')[source]

Use this function if the mosaicing is to be done using a non optimal weighting mode.

For now optimal (which is the default) follows this equation

$I^{lm}(\theta)={{\sum_p A\_p(\theta)(I_p(\theta)A_p(\theta))w_p}\over{\sum_p A\_p^2(\theta)w_p}}$

And pbweight follows this one

$I^{lm}(\theta)={{\sum_p (I_p(\theta)A_p(\theta))w_p}\over{\sum_p A\_p(\theta)w_p}}$

where $$A_p(\theta)$$ is the primary beam (PB) of a given pointing $$p$$, $$w_p$$ is a sensitivity weight and the image of that pointing is $$I_p(\theta)$$; the linear mosaic being $$I^{lm}(\theta)$$ For now $$w_p=1$$

Parameters

• linmostype (string='optimal') - Type of weighting for linear mosaic

Returns

bool

setoutputimage(outputimage='', outputweight='', imageweighttype=1, weighttype=1)[source]

Use this function if the mosaicing is to be done onto a previous mosaic or image. For now the stokes and spectral characteristic of the images to be mosaic and the output image has to be similar (i.e the user has to regrid them prior to linearmosaic if necessary). The weightimage represents the sensitivity image of the image (for example the weighted primary beam coverage of a mosaic)

imageweighttype parameter:

If the image is of the type that has been normalized to be flux correct then the imageweighttype should 0. If the image has been apodized by a primary beam then imageweighttype should be 1 and if the image is multiplied by $$PB^2$$ then it should be 2.

weighttype parameter: This should be 1 if the weight image is the sum of Primary beams or equivalent and it should be 2 if it is the sum of of $$PB^2$$

Parameters

• outputimage (string='') - Existing mosaic imagename

• outputweight (string='') - Existing weight image for mosaic

• imageweighttype (int=1) - what kind of weight was already applied to image n 0: flux correct n 1: Primary beam equivalent weight n 2: $PB^2$ equivalent weight n

• weighttype (int=1) - what kind of weight is weight image n 1: Primary beam equivalent weight n 2: $PB^2$ equivalent n

Returns

bool

Examples

lm.setoutputimage(outputimage='testoo.linmos', outputweight='testoo.linmos.weight', imageweightype=0, weighttype=2)