source: Sophya/trunk/SophyaLib/SkyT/trianglefilt.cc@ 3856

Last change on this file since 3856 was 2615, checked in by cmv, 21 years ago

using namespace sophya enleve de machdefs.h, nouveau sopnamsp.h cmv 10/09/2004

File size: 2.5 KB
Line 
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: trianglefilt.cc,v 1.8 2004-09-10 09:54:40 cmv Exp $
4//
5// Description:
6//
7// History (add to end):
8// Sophie Oct, 1999 - creation
9//
10//------------------------------------------------------------------------
11
12//---------------
13// C++ Headers --
14//---------------
15#include "sopnamsp.h"
16#include "machdefs.h"
17#include <iostream>
18
19#include "trianglefilt.h"
20
21//----------------
22// Constructor --
23//----------------
24/*!
25 * \class SOPHYA::TriangleFilter
26 \ingroup SkyT
27 * triangle detector response
28 */
29TriangleFilter::TriangleFilter()
30 : SpectralResponse()
31{
32}
33/*! Constructor: nupeak is the frequency value at the hat of the triangle and
34 valueatpeak is the corresponding transmission value. */
35TriangleFilter::TriangleFilter(double numin, double numax,double nupeak, double valueatpeak)
36 : SpectralResponse(numin, numax)
37{
38 _nuPeak = nupeak ;
39 _peakTransmission = valueatpeak;
40}
41
42//--------------
43// Destructor --
44//--------------
45TriangleFilter::~TriangleFilter()
46{
47}
48
49// ---------------------------
50// -- Function Definitions --
51// ---------------------------
52
53/*! The transmission function is a triangle defined in the constructor
54by numin and numax (for which the transmission goes to 0.) and
55the hat of the triangle (defined by a peak frequency and the corresponding
56transmission value. */
57double
58TriangleFilter::transmission(double nu) const
59{
60 if(nu < -1.e99) nu = -1.e99;
61 if(nu > 1.e99) nu = 1.e99;
62
63 if(nu>_numin && nu<_nuPeak) return (_peakTransmission*nu/_nuPeak);
64 if(nu>=_nuPeak && nu<_numax) return (_peakTransmission*nu/(_nuPeak-_numax)+_peakTransmission-_peakTransmission*_nuPeak/(_nuPeak-_numax));
65 return 0.;
66}
67
68double
69TriangleFilter::peakFreq() const
70{
71return _nuPeak;
72}
73
74double
75TriangleFilter::peakTransmission() const
76{
77 return _peakTransmission;
78}
79
80/*
81void
82TriangleFilter::WriteSelf(POutPersist& s)
83{
84 s.PutR8(this->peakFreq());
85 s.PutR8(this->peakTransmission());
86 s.PutR8(this->minFreq());
87 s.PutR8(this->maxFreq());
88
89}
90
91void
92TriangleFilter::ReadSelf(PInPersist& s)
93{
94 // double peakFreq, peakTransmission, minFreq, maxFreq;
95 s.GetR8(_nuPeak);
96 s.GetR8(_peakTransmission);
97 s.GetR8(_numin);
98 s.GetR8(_numax);
99 cout << "peakFreq - peakTransmission - minFreq - maxFreq " << endl;
100 cout << _nuPeak << "-" << _peakTransmission<< "-" << _numin << "-" << _numax << endl;
101
102}
103
104*/
Note: See TracBrowser for help on using the repository browser.