Line data Source code
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: casa-feedback@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 : using namespace casacore; 33 : namespace casa { //# NAMESPACE CASA - BEGIN 34 : 35 : //# Constructors 36 545856 : SpectralFit::SpectralFit() : 37 545856 : slist_p(0), iter_p(0) {} 38 : 39 0 : SpectralFit::SpectralFit(const SpectralList &in) : 40 0 : slist_p(in), iter_p(0) {} 41 : 42 0 : SpectralFit::SpectralFit(const SpectralFit &other) : 43 0 : slist_p(other.slist_p), iter_p(other.iter_p), chiSq_p(other.chiSq_p) {} 44 : 45 545856 : SpectralFit::~SpectralFit() {} 46 : 47 545770 : SpectralFit &SpectralFit::operator=(const SpectralFit &other) { 48 545770 : if (this != &other) { 49 545770 : slist_p = other.slist_p; 50 545770 : iter_p = other.iter_p; 51 545770 : chiSq_p = other.chiSq_p; 52 : }; 53 545770 : return *this; 54 : } 55 : 56 0 : void SpectralFit::setFitElement(uInt index, const SpectralElement &elem) { 57 0 : slist_p.set(elem, index); 58 0 : iter_p = 0; 59 0 : } 60 : 61 0 : void SpectralFit::addFitElement(const SpectralElement &elem) { 62 0 : slist_p.add(elem); 63 0 : iter_p = 0; 64 0 : } 65 : 66 545637 : void SpectralFit::addFitElement(const SpectralList &elem) { 67 545637 : slist_p.add(elem); 68 545637 : iter_p = 0; 69 545637 : } 70 : 71 545637 : void SpectralFit::clear() { 72 545637 : slist_p.clear(); 73 545637 : iter_p = 0; 74 545637 : } 75 : 76 : } //# NAMESPACE CASA - END 77 : 78 : 79 : 80 : //# Cater for Double and Float profiles 81 : #ifdef AIPS_NO_TEMPLATE_SRC 82 : #include <components/SpectralComponents/SpectralFit2.tcc> 83 : 84 : using namespace casacore; 85 : namespace casa { //# NAMESPACE CASA - BEGIN 86 : template Bool SpectralFit::fit<Double>(Vector<Double> const &, 87 : Vector<Double> const &, 88 : const Vector<Bool> *); 89 : template Bool SpectralFit::fit<Float>(Vector<Float> const &, 90 : Vector<Float> const &, 91 : const Vector<Bool> *); 92 : template Bool SpectralFit::fit<Float>(Vector<Float> const &, 93 : Vector<Float> const &, 94 : Vector<Bool> const &); 95 : template Bool SpectralFit::fit<Double>(Vector<Double> const &, 96 : Vector<Double> const &, 97 : Vector<Double> const &, 98 : const Vector<Bool> *); 99 : template Bool SpectralFit::fit<Float>(Vector<Float> const &, 100 : Vector<Float> const &, 101 : Vector<Float> const &, 102 : const Vector<Bool> *); 103 : template Bool SpectralFit::fit<Float>(Vector<Float> const &, 104 : Vector<Float> const &, 105 : Vector<Float> const &, 106 : Vector<Bool> const &); 107 : } //# NAMESPACE CASA - END 108 : #endif