| 1 | //# Lorentzian1DParam.cc: Parameter handling for one-dimensional Lorentzian class
|
|---|
| 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: Lorentzian1DParam.tcc 20253 2010-02-15 12:15:00Z Wataru.Kawasaki $
|
|---|
| 27 |
|
|---|
| 28 | //# Includes
|
|---|
| 29 | #include "Lorentzian1DParam.h"
|
|---|
| 30 | #include <casa/BasicSL/Constants.h>
|
|---|
| 31 | #include <casa/BasicMath/Math.h>
|
|---|
| 32 |
|
|---|
| 33 | namespace casa { //# NAMESPACE CASA - BEGIN
|
|---|
| 34 |
|
|---|
| 35 | //# Statics
|
|---|
| 36 | ///template<class T>
|
|---|
| 37 | ///const T Lorentzian1DParam<T>::fwhm2int = T(1.0)/sqrt(log(T(16.0)));
|
|---|
| 38 |
|
|---|
| 39 | //# Constructors
|
|---|
| 40 | template<class T>
|
|---|
| 41 | Lorentzian1DParam<T>::Lorentzian1DParam() :
|
|---|
| 42 | Function1D<T>(3),
|
|---|
| 43 | fwhm2int(T(1.0)/T(2.0)) {
|
|---|
| 44 | param_p[HEIGHT] = T(1.0);
|
|---|
| 45 | param_p[CENTER] = T(0.0);
|
|---|
| 46 | param_p[WIDTH] = T(1.0);
|
|---|
| 47 | }
|
|---|
| 48 |
|
|---|
| 49 | template<class T>
|
|---|
| 50 | Lorentzian1DParam<T>::Lorentzian1DParam(const T &height) :
|
|---|
| 51 | Function1D<T>(3),
|
|---|
| 52 | fwhm2int(T(1.0)/T(2.0)) {
|
|---|
| 53 | param_p[HEIGHT] = height;
|
|---|
| 54 | param_p[CENTER] = T(0.0);
|
|---|
| 55 | param_p[WIDTH] = T(1.0);
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | template<class T>
|
|---|
| 59 | Lorentzian1DParam<T>::Lorentzian1DParam(const T &height, const T ¢er) :
|
|---|
| 60 | Function1D<T>(3),
|
|---|
| 61 | fwhm2int(T(1.0)/T(2.0)) {
|
|---|
| 62 | param_p[HEIGHT] = height;
|
|---|
| 63 | param_p[CENTER] = center;
|
|---|
| 64 | param_p[WIDTH] = T(1.0);
|
|---|
| 65 | }
|
|---|
| 66 |
|
|---|
| 67 | template<class T>
|
|---|
| 68 | Lorentzian1DParam<T>::Lorentzian1DParam(const T &height, const T ¢er,
|
|---|
| 69 | const T &width) :
|
|---|
| 70 | Function1D<T>(3),
|
|---|
| 71 | fwhm2int(T(1.0)/T(2.0)) {
|
|---|
| 72 | param_p[HEIGHT] = height;
|
|---|
| 73 | param_p[CENTER] = center;
|
|---|
| 74 | param_p[WIDTH] = width;
|
|---|
| 75 | }
|
|---|
| 76 |
|
|---|
| 77 | template<class T>
|
|---|
| 78 | Lorentzian1DParam<T>::Lorentzian1DParam(const Lorentzian1DParam<T> &other) :
|
|---|
| 79 | Function1D<T>(other),
|
|---|
| 80 | fwhm2int(T(1.0)/T(2.0)) {}
|
|---|
| 81 |
|
|---|
| 82 | template<class T>
|
|---|
| 83 | Lorentzian1DParam<T>::~Lorentzian1DParam() {}
|
|---|
| 84 |
|
|---|
| 85 | //# Operators
|
|---|
| 86 | template<class T>
|
|---|
| 87 | Lorentzian1DParam<T> &
|
|---|
| 88 | Lorentzian1DParam<T>::operator=(const Lorentzian1DParam<T> &other) {
|
|---|
| 89 | if (this != &other) {
|
|---|
| 90 | fwhm2int = other.fwhm2int;
|
|---|
| 91 | Function1D<T>::operator=(other);
|
|---|
| 92 | }
|
|---|
| 93 | return *this;
|
|---|
| 94 | }
|
|---|
| 95 |
|
|---|
| 96 | //# Member functions
|
|---|
| 97 | template<class T>
|
|---|
| 98 | T Lorentzian1DParam<T>::flux() const {
|
|---|
| 99 | return param_p[HEIGHT]*abs(param_p[WIDTH])*fwhm2int*T(C::pi);
|
|---|
| 100 | }
|
|---|
| 101 |
|
|---|
| 102 | template<class T>
|
|---|
| 103 | void Lorentzian1DParam<T>::setFlux(const T &flux) {
|
|---|
| 104 | param_p[HEIGHT] = flux*T(C::_1_pi)/abs(param_p[WIDTH])/fwhm2int;
|
|---|
| 105 | }
|
|---|
| 106 |
|
|---|
| 107 | } //# NAMESPACE CASA - END
|
|---|
| 108 |
|
|---|