imbaseline

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)[source]

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.

    maskmode = auto
    • 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

  • blfunc (string=’poly’) - baseline model function [“poly”, “chebyshev”, “cspline”, “sinusoid”, or “variable”(expert mode)]

    blfunc = poly
    • 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

    blfunc = chebyshev
    • 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

    blfunc = cspline
    • 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

    blfunc = sinusoid
    • 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

    blfunc = variable
    • blparam (string=’’) - text file that stores per spectrum fit parameters

  • 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.

    dirkernel = gaussian
    • 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.

    dirkernel = boxcar
    • 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”.

    dirkernel = image
    • 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”.

  • 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.

    spkernel = gaussian
    • kwidth (int=5) - smoothing kernel width in channel. Only used if spkernel=”gaussian” or “boxcar”.

    spkernel = boxcar
    • kwidth (int=5) - smoothing kernel width in channel. Only used if spkernel=”gaussian” or “boxcar”.

Description

imbaseline is a task to do image-based baseline subtraction for single-dish data. This task is based on sdbaseline. Input file format of sdbaseline is Measurement Set, while CASA Image format is used for the input of imbaseline. The computing processes of fitting and subtracting are common in both tasks, and the options of imbaseline consist of subset of sdbaseline.

If users need to reduce the noise in input data before baseline subtraction, imbaseline can make smoothing in the spatial plane and/or spectral axis setting parameters of dirkernel and spkernel, respectively. These features are based on imsmooth and sdsmooth, 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. Usage of parameters related dirkernel is same as those used in imsmooth.

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. Usage of parameters related spkernel is same as those used in sdsmooth.

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.

Note
  • The format of the file specified by bloutput should be CSV format when using imbaseline.

  • 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”.

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

No additional development details

Parameter Details

Detailed descriptions of each function parameter

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.
chans (string='') - Channels to be included in the fitting
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
blfunc (string='poly') - baseline model function [“poly”, “chebyshev”, “cspline”, “sinusoid”, or “variable”(expert mode)]
order (int=5) - order of baseline model function
npiece (int=3) - number of element polynomials for cubic spline curve
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
blparam (string='') - text file that stores per spectrum fit parameters
clipniter (int=0) - maximum iteration number for iterative fitting
clipthresh (double=3.0) - clipping threshold for iterative fitting
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 (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.
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”.
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 (int=5) - smoothing kernel width in channel. Only used if spkernel=”gaussian” or “boxcar”.