Source code for casatasks.analysis.imbaseline

#
# stub function definition file for docstring parsing
#

[docs]def imbaseline(imagename, linefile='', output_cont=False, bloutput='', maskmode='list', chans='', thresh=5.0, avg_limit=4, minwidth=4, edge=[0, 0], blfunc='poly', order=5, npiece=3, applyfft=True, fftthresh=3.0, addwn=[0], rejwn='', blparam='', clipniter=0, clipthresh=3.0, dirkernel='none', major='', minor='', pa='', kimage='', scale=-1.0, spkernel='none', kwidth=5): r""" Image-based baseline subtraction for single-dish data [`Description`_] [`Examples`_] [`Development`_] [`Details`_] Parameters - imagename_ (path) - Name of the input spectral line image - linefile_ (path='') - output continuum subtracted image file name. If it is not specified, it will be imagename + "_bs". - output_cont_ (bool=False) - output continuum image. Name will be imagename + ".cont" - bloutput_ (path='') - name of file in which best-fit parameters are written. No output if "" (default). - maskmode_ (string='list') - mode of setting additional channel masks. "list" and "auto" are available now. .. raw:: html <details><summary><i> maskmode = auto </i></summary> - thresh_ (double=5.0) - S/N threshold for linefinder - avg_limit_ (int=4) - channel averaging for broad lines - minwidth_ (int=4) - the minimum channel width to detect as a line - edge_ (intVec=[0, 0]) - channels to drop at beginning and end of spectrum .. raw:: html </details> - blfunc_ (string='poly') - baseline model function ["poly", "chebyshev", "cspline", "sinusoid", or "variable"(expert mode)] .. raw:: html <details><summary><i> blfunc = poly </i></summary> - order_ (int=5) - order of baseline model function - clipthresh_ (double=3.0) - clipping threshold for iterative fitting - clipniter_ (int=0) - maximum iteration number for iterative fitting .. raw:: html </details> .. raw:: html <details><summary><i> blfunc = chebyshev </i></summary> - order_ (int=5) - order of baseline model function - clipthresh_ (double=3.0) - clipping threshold for iterative fitting - clipniter_ (int=0) - maximum iteration number for iterative fitting .. raw:: html </details> .. raw:: html <details><summary><i> blfunc = cspline </i></summary> - npiece_ (int=3) - number of element polynomials for cubic spline curve - clipthresh_ (double=3.0) - clipping threshold for iterative fitting - clipniter_ (int=0) - maximum iteration number for iterative fitting .. raw:: html </details> .. raw:: html <details><summary><i> blfunc = sinusoid </i></summary> - applyfft_ (bool=True) - automatically set wave numbers of sinusoids - fftthresh_ (double=3.0) - threshold to select wave numbers of sinusoids - addwn_ (intVec=[0]) - additional wave numbers to use - rejwn_ (intVec='') - wave numbers NOT to use - clipthresh_ (double=3.0) - clipping threshold for iterative fitting - clipniter_ (int=0) - maximum iteration number for iterative fitting .. raw:: html </details> .. raw:: html <details><summary><i> blfunc = variable </i></summary> - blparam_ (string='') - text file that stores per spectrum fit parameters .. raw:: html </details> - dirkernel_ (string='none') - Type of kernel to use to direction plane smoothing. Acceptable values are "none" to omit smoothing(default), "boxcar" for a boxcar kernel, "gaussian" for a gaussian kernel, "image" to use an image as the kernel. .. raw:: html <details><summary><i> dirkernel = gaussian </i></summary> - major_ (string='') - Major axis for the kernels. Standard quantity representation. Must be specified for dirkernel="boxcar" or "gaussian". - minor_ (string='') - Minor axis. Standard quantity representation. Must be specified for dirkernel="boxcar" or "gaussian". - pa_ (string='') - Position angle used only for gaussian kernel. Standard quantity representation. .. raw:: html </details> .. raw:: html <details><summary><i> dirkernel = boxcar </i></summary> - major_ (string='') - Major axis for the kernels. Standard quantity representation. Must be specified for dirkernel="boxcar" or "gaussian". - minor_ (string='') - Minor axis. Standard quantity representation. Must be specified for dirkernel="boxcar" or "gaussian". .. raw:: html </details> .. raw:: html <details><summary><i> dirkernel = image </i></summary> - kimage_ (path='') - Kernel image name. Only used if dirkernel="image". - scale_ (double=-1.0) - Scale factor. -1.0 means auto-scale. Only used if dirkernel="image". .. raw:: html </details> - spkernel_ (string='none') - Type of spectral smoothing kernel. Acceptable values are "none" to omit smoothing(default), "gaussian" for a gaussian kernel, "boxcar" for a boxcar kernel. .. raw:: html <details><summary><i> spkernel = gaussian </i></summary> - kwidth_ (int=5) - smoothing kernel width in channel. Only used if spkernel="gaussian" or "boxcar". .. raw:: html </details> .. raw:: html <details><summary><i> spkernel = boxcar </i></summary> - kwidth_ (int=5) - smoothing kernel width in channel. Only used if spkernel="gaussian" or "boxcar". .. raw:: html </details> .. _Description: Description `imbaseline <./casatasks.analysis.imbaseline.html>`__ is a task to do image-based baseline subtraction for single-dish data. This task is based on `sdbaseline <casatasks.single.sdbaseline.html>`__. Input file format of `sdbaseline <casatasks.single.sdbaseline.html>`__ is Measurement Set, while CASA Image format is used for the input of `imbaseline <./casatasks.analysis.imbaseline.html>`__. The computing processes of fitting and subtracting are common in both tasks, and the options of `imbaseline <./casatasks.analysis.imbaseline.html>`__ consist of subset of `sdbaseline <casatasks.single.sdbaseline.html>`__. If users need to reduce the noise in input data before baseline subtraction, `imbaseline <./casatasks.analysis.imbaseline.html>`__ can make smoothing in the spatial plane and/or spectral axis setting parameters of *dirkernel* and *spkernel*, respectively. These features are based on `imsmooth <./casatasks.analysis.imsmooth.html>`__ and `sdsmooth <./casatasks.single.sdsmooth.html>`__, respectively. **Spatial plane smoothing** performs a Fourier-based convolution to smooth the spatial plane of input data using a user-specified smoothing kernel. The parameter *dirkernel* can be specified as *gaussian*, *boxcar*, or *image*. They are same parameters *kernel* of the task `imsmooth <./casatasks.analysis.imsmooth.html>`__. Usage of parameters related *dirkernel* is same as those used in `imsmooth <./casatasks.analysis.imsmooth.html>`__. **Spectral axis smoothing** can be performed using a user-specified smoothing kernel. The parameter *spkernel* can be specified as *gaussian* or *boxcar*. They are same parameters *kernel* of the task `sdsmooth <./casatasks.single.sdsmooth.html>`__. Usage of parameters related *spkernel* is same as those used in `sdsmooth <./casatasks.single.sdsmooth.html>`__. **Baseline fitting and subtraction** can be performed with specifying a parameter *blfunc* either *poly*, *chebyshev*, *cspline*, *sinusoid*, or *variable*. The parameter *maskmode* can be specified as *list* or *auto*. Usage of parameters related *blfunc* and *maskmode* are same as those used in `sdbaseline <casatasks.single.sdbaseline.html>`__. Note * The format of the file specified by *bloutput* should be CSV format when using `imbaseline <./casatasks.analysis.imbaseline.html>`__. * If the parameter *output_cont* sets *True*, the output continuum image is saved by subtracting an output image from an input image. The file will be named as *imagename* + "*.cont*". .. _Examples: Example **Example 1** This is one of the simplest examples fitting baselines using the sinusoidal function and subtracting. No smoothing processes are applied. :: imbaseline(imagename='my_image.im', linefile='output.im', blfunc='sinusoid') **Example 2** Following example shows baseline fitting and subtracting smoothing with the spatial plane. Parameters such as *major*, *minor*, and *pa*, should be specified when *dirkernel='gaussian'*. :: imbaseline(imagename='my_image.im', linefile='output.im', blfunc='sinusoid', dirkernel='gaussian', major='20arcsec', minor='10arcsec', pa='0deg') **Example 3** Following examples shows baseline fitting and subtracting smoothing with the spectral axis. :: imbaseline(imagename='my_image.im', linefile='output.im', spkernel='boxcar', kwidth=5) .. _Development: Development No additional development details .. _Details: Parameter Details Detailed descriptions of each function parameter .. _imagename: | ``imagename (path)`` - Name of the input spectral line image .. _linefile: | ``linefile (path='')`` - output continuum subtracted image file name. If it is not specified, it will be imagename + "_bs". .. _output_cont: | ``output_cont (bool=False)`` - output continuum image. Name will be imagename + ".cont" .. _bloutput: | ``bloutput (path='')`` - name of file in which best-fit parameters are written. No output if "" (default). .. _maskmode: | ``maskmode (string='list')`` - mode of setting additional channel masks. "list" and "auto" are available now. .. _chans: | ``chans (string='')`` - Channels to be included in the fitting .. _thresh: | ``thresh (double=5.0)`` - S/N threshold for linefinder .. _avg_limit: | ``avg_limit (int=4)`` - channel averaging for broad lines .. _minwidth: | ``minwidth (int=4)`` - the minimum channel width to detect as a line .. _edge: | ``edge (intVec=[0, 0])`` - channels to drop at beginning and end of spectrum .. _blfunc: | ``blfunc (string='poly')`` - baseline model function ["poly", "chebyshev", "cspline", "sinusoid", or "variable"(expert mode)] .. _order: | ``order (int=5)`` - order of baseline model function .. _npiece: | ``npiece (int=3)`` - number of element polynomials for cubic spline curve .. _applyfft: | ``applyfft (bool=True)`` - automatically set wave numbers of sinusoids .. _fftthresh: | ``fftthresh (double=3.0)`` - threshold to select wave numbers of sinusoids .. _addwn: | ``addwn (intVec=[0])`` - additional wave numbers to use .. _rejwn: | ``rejwn (intVec='')`` - wave numbers NOT to use .. _blparam: | ``blparam (string='')`` - text file that stores per spectrum fit parameters .. _clipniter: | ``clipniter (int=0)`` - maximum iteration number for iterative fitting .. _clipthresh: | ``clipthresh (double=3.0)`` - clipping threshold for iterative fitting .. _dirkernel: | ``dirkernel (string='none')`` - Type of kernel to use to direction plane smoothing. Acceptable values are "none" to omit image smoothing(default), "boxcar" for a boxcar kernel, "gaussian" for a gaussian kernel, "image" to use an image as the kernel. .. _major: | ``major (string='')`` - Major axis for the kernels. Standard quantity representation. Must be specified for dirkernel="boxcar" or "gaussian". .. _minor: | ``minor (string='')`` - Minor axis. Standard quantity representation. Must be specified for dirkernel="boxcar" or "gaussian". .. _pa: | ``pa (string='')`` - Position angle used only for gaussian kernel. Standard quantity representation. .. _kimage: | ``kimage (path='')`` - Kernel image name. Only used if dirkernel="image". .. _scale: | ``scale (double=-1.0)`` - Scale factor. -1.0 means auto-scale. Only used if dirkernel="image". .. _spkernel: | ``spkernel (string='none')`` - Type of spectral smoothing kernel. Acceptable values are "none" to omit smoothing(default), "gaussian" for a gaussian kernel, "boxcar" for a boxcar kernel. .. _kwidth: | ``kwidth (int=5)`` - smoothing kernel width in channel. Only used if spkernel="gaussian" or "boxcar". """ pass