casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
feather.py
Go to the documentation of this file.
00001 #
00002 # This file was generated using xslt from its XML file
00003 #
00004 # Copyright 2009, Associated Universities Inc., Washington DC
00005 #
00006 import sys
00007 import os
00008 from  casac import *
00009 import string
00010 from taskinit import casalog
00011 #from taskmanager import tm
00012 import task_feather
00013 def feather(imagename='', highres='', lowres='', sdfactor=1.0, effdishdiam=-1.0, showplot=False):
00014 
00015         """Combine two images using their Fourier transforms
00016 
00017         Feathering is a simple method for combining two images with different 
00018         spatial resolution.  The processing steps are:
00019 
00020                1. Regrid the low-resolution image to a temporary copy matching the
00021                    resolution of the high-resolution image,
00022                2. Transform each image to the spatial-frequency plane (gridded).
00023                3. Scale the low-resolution image (uv-grid) by the ratio of the
00024                    volumes of the two 'clean beams' (high-res/low-res). 
00025                4. Add to this, the uv-grid of the high-resolution image, scaled by
00026                    (1-wt) where 'wt' is the Fourier transform of the 'clean beam'
00027                    defined in the low-resolution image.
00028                5. Transform back to the image plane.
00029 
00030         Both input images must have a well-defined beam shape for this task to work. 
00031         This could be a 'clean beam' for interferometric images, and a 'primary-beam' 
00032         for a single-dish image. 
00033 
00034         The two images must also have the same flux density normalization scale.
00035 
00036         Keyword arguments:
00037         imagename -- Name of output feathered image
00038                 default: none; example: imagename='orion_combined.im'
00039         highres -- Name of high resolution (interferometer) image
00040                 default: none; example: highres='orion_vla.im'
00041              This image is often a clean image obtained from synthesis
00042                 observations.
00043         lowres -- Name of low resolution (single dish) image
00044                 default: none; example: lowres='orion_gbt.im'
00045              This image is often a image from a single-dish observations
00046                 or a clean image obtained from lower resolution synthesis
00047                 observations.
00048          sdfactor -- value by which to scale the Single Dish image. Default is 1.0
00049                          Basically modifying the flux scale of the SD image
00050          effdishdiam -- New effective SingleDish diameter to use in m. Obviously one can only reduce the dish effective dish diameter in feathering. Default -1.0 means leave as is.
00051          showplot -- If True will plot the cuts across the feathring function
00052 
00053 
00054         Comments:
00055 
00056         This task can be used as one method of combining single-dish and 
00057         interferometric images after they have been separately made.
00058         
00059         The clean task allows another method of combining single-dish and
00060         interferometric data. The single-dish image can be used as a starting 
00061         model for the interferometric image-reconstruction. If there is
00062         some overlap between the spatial-frequencies contained in the 
00063         single-dish image and the interferometer sampling function, then,
00064         such a starting model will help constrain the solutions on the 
00065         short-baselines of the interferometric data.
00066         
00067 
00068 
00069         """
00070 
00071 #
00072 #    The following is work around to avoid a bug with current python translation
00073 #
00074         mytmp = {}
00075 
00076         mytmp['imagename'] = imagename
00077         mytmp['highres'] = highres
00078         mytmp['lowres'] = lowres
00079         mytmp['sdfactor'] = sdfactor
00080         mytmp['effdishdiam'] = effdishdiam
00081         mytmp['showplot'] = showplot
00082         pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/'
00083         trec = casac.utils().torecord(pathname+'feather.xml')
00084 
00085         casalog.origin('feather')
00086         if trec.has_key('feather') and casac.utils().verify(mytmp, trec['feather']) :
00087             result = task_feather.feather(imagename, highres, lowres, sdfactor, effdishdiam, showplot)
00088 
00089         else :
00090           result = False
00091         return result