source: branches/alma/src/Lorentzian1DParam.tcc@ 2689

Last change on this file since 2689 was 1700, checked in by WataruKawasaki, 15 years ago

New Development: Yes

JIRA Issue: Yes (CAS-1800 + CAS-1807)

Ready to Release: Yes

Interface Changes: Yes

What Interface Changed: added parameters fitfunc for sdfit and clip, clipmaxmin, clipoutside for sdflag

Test Programs:

Put in Release Notes: No

Module(s): sdfit, sdflag

Description: Added a parameter for enabling Lorentzian line fitting with sdfit, and parameters for y-axis clipping with sdflag. Also 4 files for Lorentzian function class are (Lorentzian1D*) added.


File size: 3.2 KB
RevLine 
[1700]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.