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

Last change on this file since 2479 was 2322, checked in by cmv, 23 years ago
  • passage xxstream.h en xxstream
  • compile avec gcc_3.2, gcc_2.96 et cxx En 3.2 le seek from ::end semble marcher (voir Eval/COS/pbseekios.cc)

rz+cmv 11/2/2003

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