source: trunk/src/Lorentzian1DParam.tcc@ 2067

Last change on this file since 2067 was 1819, checked in by Kana Sugimoto, 14 years ago

New Development: No

JIRA Issue: No (merge alma branch to trunk)

Ready for Test: Yes

Interface Changes: No

Test Programs: regressions may work

Module(s): all single dish modules

Description:

Merged all changes in alma (r1386:1818) and newfiller (r1774:1818) branch.


File size: 3.2 KB
Line 
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
33namespace 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
40template<class T>
41Lorentzian1DParam<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
49template<class T>
50Lorentzian1DParam<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
58template<class T>
59Lorentzian1DParam<T>::Lorentzian1DParam(const T &height, const T &center) :
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
67template<class T>
68Lorentzian1DParam<T>::Lorentzian1DParam(const T &height, const T &center,
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
77template<class T>
78Lorentzian1DParam<T>::Lorentzian1DParam(const Lorentzian1DParam<T> &other) :
79 Function1D<T>(other),
80 fwhm2int(T(1.0)/T(2.0)) {}
81
82template<class T>
83Lorentzian1DParam<T>::~Lorentzian1DParam() {}
84
85//# Operators
86template<class T>
87Lorentzian1DParam<T> &
88Lorentzian1DParam<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
97template<class T>
98T Lorentzian1DParam<T>::flux() const {
99 return param_p[HEIGHT]*abs(param_p[WIDTH])*fwhm2int*T(C::pi);
100}
101
102template<class T>
103void 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
Note: See TracBrowser for help on using the repository browser.