[2980] | 1 | //# SpectralFit.cc: Least Squares fitting of spectral elements to spectrum |
---|
| 2 | //# Copyright (C) 2001,2002 |
---|
| 3 | //# Associated Universities, Inc. Washington DC, USA. |
---|
| 4 | //# |
---|
| 5 | //# This library is free software; you can redistribute it and/or modify it |
---|
| 6 | //# under the terms of the GNU Library General Public License as published by |
---|
| 7 | //# the Free Software Foundation; either version 2 of the License, or (at your |
---|
| 8 | //# option) any later version. |
---|
| 9 | //# |
---|
| 10 | //# This library is distributed in the hope that it will be useful, but WITHOUT |
---|
| 11 | //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
| 12 | //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public |
---|
| 13 | //# License for more details. |
---|
| 14 | //# |
---|
| 15 | //# You should have received a copy of the GNU Library General Public License |
---|
| 16 | //# along with this library; if not, write to the Free Software Foundation, |
---|
| 17 | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. |
---|
| 18 | //# |
---|
| 19 | //# Correspondence concerning AIPS++ should be addressed as follows: |
---|
| 20 | //# Internet email: aips2-request@nrao.edu. |
---|
| 21 | //# Postal address: AIPS++ Project Office |
---|
| 22 | //# National Radio Astronomy Observatory |
---|
| 23 | //# 520 Edgemont Road |
---|
| 24 | //# Charlottesville, VA 22903-2475 USA |
---|
| 25 | //# |
---|
| 26 | //# $Id: SpectralFit.cc 19933 2007-02-27 05:04:51Z Malte.Marquarding $ |
---|
| 27 | |
---|
| 28 | //# Includes |
---|
| 29 | #include <components/SpectralComponents/SpectralFit.h> |
---|
| 30 | #include <components/SpectralComponents/SpectralElement.h> |
---|
| 31 | |
---|
| 32 | namespace casa { //# NAMESPACE CASA - BEGIN |
---|
| 33 | |
---|
| 34 | //# Constructors |
---|
| 35 | SpectralFit::SpectralFit() : |
---|
| 36 | slist_p(0), iter_p(0) {} |
---|
| 37 | |
---|
| 38 | SpectralFit::SpectralFit(const SpectralList &in) : |
---|
| 39 | slist_p(in), iter_p(0) {} |
---|
| 40 | |
---|
| 41 | SpectralFit::SpectralFit(const SpectralFit &other) : |
---|
| 42 | slist_p(other.slist_p), iter_p(other.iter_p), chiSq_p(other.chiSq_p) {} |
---|
| 43 | |
---|
| 44 | SpectralFit::~SpectralFit() {} |
---|
| 45 | |
---|
| 46 | SpectralFit &SpectralFit::operator=(const SpectralFit &other) { |
---|
| 47 | if (this != &other) { |
---|
| 48 | slist_p = other.slist_p; |
---|
| 49 | iter_p = other.iter_p; |
---|
| 50 | chiSq_p = other.chiSq_p; |
---|
| 51 | }; |
---|
| 52 | return *this; |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | void SpectralFit::setFitElement(uInt index, const SpectralElement &elem) { |
---|
| 56 | slist_p.set(elem, index); |
---|
| 57 | iter_p = 0; |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | void SpectralFit::addFitElement(const SpectralElement &elem) { |
---|
| 61 | slist_p.add(elem); |
---|
| 62 | iter_p = 0; |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | void SpectralFit::addFitElement(const SpectralList &elem) { |
---|
| 66 | slist_p.add(elem); |
---|
| 67 | iter_p = 0; |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | void SpectralFit::clear() { |
---|
| 71 | slist_p.clear(); |
---|
| 72 | iter_p = 0; |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | } //# NAMESPACE CASA - END |
---|
| 76 | |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | //# Cater for Double and Float profiles |
---|
| 80 | #ifdef AIPS_NO_TEMPLATE_SRC |
---|
| 81 | #include <components/SpectralComponents/SpectralFit2.tcc> |
---|
| 82 | |
---|
| 83 | namespace casa { //# NAMESPACE CASA - BEGIN |
---|
| 84 | template Bool SpectralFit::fit<Double>(Vector<Double> const &, |
---|
| 85 | Vector<Double> const &, |
---|
| 86 | const Vector<Bool> *); |
---|
| 87 | template Bool SpectralFit::fit<Float>(Vector<Float> const &, |
---|
| 88 | Vector<Float> const &, |
---|
| 89 | const Vector<Bool> *); |
---|
| 90 | template Bool SpectralFit::fit<Float>(Vector<Float> const &, |
---|
| 91 | Vector<Float> const &, |
---|
| 92 | Vector<Bool> const &); |
---|
| 93 | template Bool SpectralFit::fit<Double>(Vector<Double> const &, |
---|
| 94 | Vector<Double> const &, |
---|
| 95 | Vector<Double> const &, |
---|
| 96 | const Vector<Bool> *); |
---|
| 97 | template Bool SpectralFit::fit<Float>(Vector<Float> const &, |
---|
| 98 | Vector<Float> const &, |
---|
| 99 | Vector<Float> const &, |
---|
| 100 | const Vector<Bool> *); |
---|
| 101 | template Bool SpectralFit::fit<Float>(Vector<Float> const &, |
---|
| 102 | Vector<Float> const &, |
---|
| 103 | Vector<Float> const &, |
---|
| 104 | Vector<Bool> const &); |
---|
| 105 | } //# NAMESPACE CASA - END |
---|
| 106 | #endif |
---|