singledishms

class singledishms[source]

New single dish tool interface to process an MS

Methods Summary

apply_baseline_table

For each row of given baseline table, read baseline parameters, construct baseline, then subtract it from the corresponding spectrum in the MS.

atmcor

Offline atmospheric correction of calibrated data

close

This is used to close sdms tools.

done

This is used to close and sdms tools.

fit_line

Fit line profile to selected spectra and obtain the best-fit parameter values

importasap

Import ASAP Scantable data to MeasurementSet.

importnro

Import NOSTAR data to MeasurementSet.

name

Returns the name of the attached MeasurementSet.

open

Close the current MeasurementSet and open a new MeasurementSet instead.

set_selection

Select Measurementset to process

singledishms

This is used to construct a singledishms tool instance.

smooth

NOTE: currently only Gaussian kernel is supported.

subtract_baseline

Fit baseline and subtract it from selected spectra

subtract_baseline_cspline

Fit baseline and subtract it from selected spectra

subtract_baseline_sinusoid

Fit baseline and subtract it from selected spectra

subtract_baseline_variable

Fit baseline and subtract it from selected spectra.

apply_baseline_table(bltable='', datacolumn='data', spw='', updateweight=False, sigmavalue='stddev', outfile='')[source]

For each row of given baseline table, read baseline parameters, construct baseline, then subtract it from the corresponding spectrum in the MS.

Parameters

  • bltable (string='') - The name of input Baseline Table

  • datacolumn (string='data') - The name of data column to process (‘data’, ‘float_data’, or ‘corrected’)

  • spw (variant='') - Spectral Window Ids (0 relative) to select; -1 interpreted as all

  • updateweight (bool=False) - Update weight based on sigmavalue of residual data

  • sigmavalue (string='stddev') - sigma value for computing weight

  • outfile (string='') - The name of output MeasurementSet

Returns

bool

Examples

sdms.open('m100_sd.ms')
sdms.set_selection(field='M100')
sdms.apply_baseline_table('m100_sd.bltable')
atmcor(config='', datacolumn='data', outfile='')[source]

Offline atmospheric correction of calibrated data

Parameters

  • config (record='') - Configuration for atmospheric correction

  • datacolumn (string='data') - The name of data column to process (‘data’, ‘float_data’, or ‘corrected’)

  • outfile (string='') - The name of output MeasurementSet

Returns

bool

close()[source]

This is used to close sdms tools. Note that the data is written to disk and detached from sdms tool. This is a synonym for done.

done()[source]

This is used to close and sdms tools. Note that the data is written to disk and detached from sdms tool. This is a synonym for close.

fit_line(datacolumn='data', spw='', pol='', timebin='', timespan='', polaverage='', fitfunc='gaussian', nfit='0', linefinding=False, threshold=5.0, avg_limit=4, minwidth=4, edge=[0, 0], tempfile='', tempoutfile='')[source]

Fit line profile to selected spectra and obtain the best-fit parameter values

Parameters

  • datacolumn (string='data') - The name of data column to process (‘data’, ‘float_data’, or ‘corrected’)

  • spw (variant='') - Spectral Window Ids (0 relative) to select; -1 interpreted as all

  • pol (variant='') - Select data by polarization(s)

  • timebin (string='') - Bin width for time averaging

  • timespan (string='') - Span the timebin across ‘scan’, ‘state’, ‘field’, or a combination of them (e.g., ‘scan,state’)

  • polaverage (string='') - polarization averaging mode (‘’, ‘stokes’, or ‘geometric’)

  • fitfunc (string='gaussian') - Function of line profile

  • nfit (string='0') - Comma-separated numbers of gaussian/lorentzian lines to fit in maskline region. ignored when linefinding=True.

  • linefinding (bool=False) - do line finding

  • threshold (float=5.0) - S/N threshold for line finder

  • avg_limit (int=4) - channel averaging for broad lines in line finding

  • minwidth (int=4) - the minimum channel width to detect as a line by line finder

  • edge (intVec=[0, 0]) - channels to drop at beginning and end of spectrum in line finding

  • tempfile (string='') - The name of temporary file to keep fitting results

  • tempoutfile (string='') - The name of temporary ms file

Returns

bool

Examples

sdms.open('m100_sd.ms')
sdms.set_selection(field='M100')
sdms.fit_line(fitfunc='gauss',spw='0:1000~2000;4000~5000',nfit=[1,1])
importasap(infile='', outfile='', parallel=False)[source]

Import ASAP Scantable data to MeasurementSet.

Parameters

  • infile (string='') - The name of input ASAP Scantable

  • outfile (string='') - The name of output MeasurementSet

  • parallel (bool=False) - Turn on parallel execution

Returns

bool

importnro(infile='', outfile='', parallel=False)[source]

Import NOSTAR data to MeasurementSet.

Parameters

  • infile (string='') - The name of input NOSTAR data

  • outfile (string='') - The name of output MeasurementSet

  • parallel (bool=False) - Turn on parallel execution

Returns

bool

name()[source]

Returns the name of the attached MeasurementSet.

open()[source]

Close the current MeasurementSet and open a new MeasurementSet instead. The current state of sdms is retained, except for the data selection.

Parameters

  • ms_name (path='') - New MeasurementSet to be processed

Returns

bool

Examples

sdms.open('m100_sd.ms')
set_selection(spw='', field='', antenna='', timerange='', scan='', observation='', polarization='', beam='', intent='', feed='', taql='', reindex=True)[source]

Select Measurementset to process

Parameters

  • spw (variant='') - Spectral Window Ids (0 relative) to select; -1 interpreted as all

  • field (variant='') - Field Ids (0 relative) or Field names (msselection syntax and wilcards are used) to select

  • antenna (variant='') - Antenna Ids (0 relative) or Antenna names (msselection syntax and wilcards are used) to select

  • timerange (variant='') - Limit data selected to be within a given time range. Syntax is defined in the msselection link

  • scan (variant='') - Limit data selected on scan numbers. Syntax is defined in the msselection link

  • observation (variant='') - Select data by observation ID(s). Syntax is the same as for scan numbers.

  • polarization (variant='') - Select data by polarization(s)

  • beam (variant='') - Beam Ids (0 relative) to select; CURRENTLY NOT AVAILABLE!!!

  • intent (any='') - Select data by intent(s)

  • feed (any='') - Select data by feed(s)

  • taql (string='') - For the TAQL experts, flexible data selection using the TAQL syntax

  • reindex (bool=True) - Re-index indices in subtables based on data selection

Returns

bool

Examples

sdms.set_selection(field='M100', spw='3,5')
singledishms()[source]

This is used to construct a singledishms tool instance. The created instance is just like the default one (’sdms’) but physically independent from it. This is useful when users want to create their own tool instance inside scripts/modules to avoid possible conflicts that may happen when using the default tool instance from various places.

smooth(type='gaussian', width=0.0, datacolumn='data', outfile='')[source]

NOTE: currently only Gaussian kernel is supported.

Parameters

  • type (string='gaussian') - Smoothing kernel type

  • width (float=0.0) - Smoothing kernel width

  • datacolumn (string='data') - The name of data column to process (‘data’, ‘float_data’, or ‘corrected’)

  • outfile (string='') - The name of output MeasurementSet

Returns

bool

subtract_baseline(datacolumn='data', outfile='', bloutput='', dosubtract=True, spw='', updateweight=False, sigmavalue='stddev', blfunc='poly', order=5, clip_threshold_sigma=3.0, num_fitting_max=1, linefinding=False, threshold=5.0, avg_limit=4, minwidth=4, edge=[0, 0])[source]

Fit baseline and subtract it from selected spectra

Parameters

  • datacolumn (string='data') - The name of data column to process (‘data’, ‘float_data’, or ‘corrected’)

  • outfile (string='') - The name of output MeasurementSet

  • bloutput (string='') - The name(s) of Baseline to be output

  • dosubtract (bool=True) - Execute baseline subtraction from the input data

  • spw (variant='') - Spectral Window Ids (0 relative) to select; -1 interpreted as all

  • updateweight (bool=False) - Update weight based on sigmavalue of residual data

  • sigmavalue (string='stddev') - sigma value for computing weight

  • blfunc (string='poly') - baseline function

  • order (int=5) - polynomial order

  • clip_threshold_sigma (float=3.0) - threshold for clipping in unit of sigma

  • num_fitting_max (int=1) - maximum number of recursive clipping

  • linefinding (bool=False) - do line finding

  • threshold (float=5.0) - S/N threshold for line finder

  • avg_limit (int=4) - channel averaging for broad lines in line finding

  • minwidth (int=4) - the minimum channel width to detect as a line by line finder

  • edge (intVec=[0, 0]) - channels to drop at beginning and end of spectrum in line finding

Returns

bool

Examples

sdms.open('m100_sd.ms')
sdms.set_selection(field='M100')
sdms.subtract_baseline(order=3,clip_threshold_sigma=5.0,num_fitting_max=6)
subtract_baseline_cspline(datacolumn='data', outfile='', bloutput='', dosubtract=True, spw='', updateweight=False, sigmavalue='stddev', npiece=5, clip_threshold_sigma=3.0, num_fitting_max=1, linefinding=False, threshold=5.0, avg_limit=4, minwidth=4, edge=[0, 0])[source]

Fit baseline and subtract it from selected spectra

Parameters

  • datacolumn (string='data') - The name of data column to process (‘data’, ‘float_data’, or ‘corrected’)

  • outfile (string='') - The name of output MeasurementSet

  • bloutput (string='') - The name(s) of Baseline to be output

  • dosubtract (bool=True) - Execute baseline subtraction from the input data

  • spw (variant='') - Spectral Window Ids (0 relative) to select; -1 interpreted as all

  • updateweight (bool=False) - Update weight based on sigmavalue of residual data

  • sigmavalue (string='stddev') - sigma value for computing weight

  • npiece (int=5) - cspline npiece

  • clip_threshold_sigma (float=3.0) - threshold for clipping in unit of sigma

  • num_fitting_max (int=1) - maximum number of recursive clipping

  • linefinding (bool=False) - do line finding

  • threshold (float=5.0) - S/N threshold for line finder

  • avg_limit (int=4) - channel averaging for broad lines in line finding

  • minwidth (int=4) - the minimum channel width to detect as a line by line finder

  • edge (intVec=[0, 0]) - channels to drop at beginning and end of spectrum in line finding

Returns

bool

Examples

sdms.open('m100_sd.ms')
sdms.set_selection(field='M100')
sdms.subtract_baseline_cspline(npiece=3,clip_threshold_sigma=5.0,num_fitting_max=6)
subtract_baseline_sinusoid(datacolumn='data', outfile='', bloutput='', dosubtract=True, spw='', updateweight=False, sigmavalue='stddev', addwn='0', rejwn='', applyfft=False, fftmethod='fft', fftthresh='3.0', clip_threshold_sigma=3.0, num_fitting_max=1, linefinding=False, threshold=5.0, avg_limit=4, minwidth=4, edge=[0, 0])[source]

Fit baseline and subtract it from selected spectra

Parameters

  • datacolumn (string='data') - The name of data column to process (‘data’, ‘float_data’, or ‘corrected’)

  • outfile (string='') - The name of output MeasurementSet

  • bloutput (string='') - The name(s) of Baseline to be output

  • dosubtract (bool=True) - Execute baseline subtraction from the input data

  • spw (variant='') - Spectral Window Ids (0 relative) to select; -1 interpreted as all

  • updateweight (bool=False) - Update weight based on sigmavalue of residual data

  • sigmavalue (string='stddev') - sigma value for computing weight

  • addwn (string='0') - additional wave numbers to use

  • rejwn (string='') - reject specified wave numbers

  • applyfft (bool=False) - automatically set wave numbers of sinusoids

  • fftmethod (string='fft') - method to automatically set wave numbers of sinusoids [‘fft’]

  • fftthresh (variant='3.0') - threshold to select wave numbers of sinusoids

  • clip_threshold_sigma (float=3.0) - threshold for clipping in unit of sigma

  • num_fitting_max (int=1) - maximum number of recursive clipping

  • linefinding (bool=False) - do line finding

  • threshold (float=5.0) - S/N threshold for line finder

  • avg_limit (int=4) - channel averaging for broad lines in line finding

  • minwidth (int=4) - the minimum channel width to detect as a line by line finder

  • edge (intVec=[0, 0]) - channels to drop at beginning and end of spectrum in line finding

Returns

bool

Examples

sdms.open('m100_sd.ms')
sdms.set_selection(field='M100')
sdms.subtract_baseline_sinusoid(applyfft=True,clip_threshold_sigma=5.0,num_fitting_max=6)
subtract_baseline_variable(datacolumn='data', outfile='', bloutput='', dosubtract=True, spw='', updateweight=False, sigmavalue='stddev', verbose=False)[source]

Fit baseline and subtract it from selected spectra. Fit parameters for each spectrum are obtained from a text file.

Parameters

  • datacolumn (string='data') - The name of data column to process (‘data’, ‘float_data’, or ‘corrected’)

  • outfile (string='') - The name of output MeasurementSet

  • bloutput (string='') - The name(s) of Baseline to be output

  • dosubtract (bool=True) - Execute baseline subtraction from the input data

  • spw (variant='') - Spectral Window Ids (0 relative) to select; -1 interpreted as all

  • updateweight (bool=False) - Update weight based on sigmavalue of residual data

  • sigmavalue (string='stddev') - sigma value for computing weight

  • blparam (path='') - The name of text file that stores fit parameters for each spectrum of selected MS

  • verbose (bool=False) - Print fitting parameters of each spectrum to logger

Returns

bool

Examples

sdms.open('m100_sd.ms')
sdms.set_selection(field='M100')
sdms.subtract_baseline_variable('m100_fitparam.txt')