Source
//# --------------------------------------------------------------------
//# LineFinder.h: this defines utility functions of line finding
//# --------------------------------------------------------------------
//# Copyright (C) 2015
//# National Astronomical Observatory of Japan
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
//# License for more details.
//#
//# You should have received a copy of the GNU Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//# Internet email: aips2-request@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
//#
//# $Id$
namespace casa { //# NAMESPACE CASA - BEGIN
namespace linefinder {
/*
* Find spectral lines of a spectrum using a threshold based on median
* absolute deviation (MAD).
* The median of lower 80% of MAD values are used to define the
* threshold of line channels.
*
* @param[in] num_data : the number of elements in data and mask vector.
* @param[in] data : a float vector of data to detect lines. should be aligned.
* @param[in] mask : a boolean vector which indecates if the corresponding elements
* in data should be used in line detection.
* Note mask is modified in the function. Edge channels are masked.
* @param[in] threshold: a multiplication factor to define threshold.
* @param[in] max_iteration : the maximum number of iteration to detect line,
* and eliminate the line channels to redefine MAD array.
* @param[in] minwidth : minimum line width (in channel) to detect as lines
* @param[in] maxwidth : maximum line width (in channel) to detect as lines
* @param[in] avg_limit : maximum width of channel binning to run line detection.
* @param[in] edge : the number of elements at the begining and end of data array
* that should be ignored in line detection.
* @return a list of line channel ranges
*
* [overview of line detection algorithm]
* 1. Median absolute deviation of each data element is calculated and
* defined as MAD array.