[601] | 1 | //--------------------------------------------------------------------------
|
---|
| 2 | // File and Version Information:
|
---|
[668] | 3 | // $Id: squarefilt.cc,v 1.3 1999-11-29 14:16:09 ansari Exp $
|
---|
[601] | 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.h>
|
---|
| 17 |
|
---|
| 18 | #include "squarefilt.h"
|
---|
| 19 |
|
---|
| 20 | //----------------
|
---|
| 21 | // Constructor --
|
---|
| 22 | //----------------
|
---|
[668] | 23 | SquareFilter::SquareFilter()
|
---|
| 24 | : SpectralResponse()
|
---|
| 25 | {
|
---|
| 26 | }
|
---|
| 27 |
|
---|
[601] | 28 | SquareFilter::SquareFilter(double numin, double numax)
|
---|
| 29 | : SpectralResponse(numin, numax)
|
---|
| 30 | {
|
---|
| 31 | _nuPeak = (numin+numax)/2.;
|
---|
| 32 | _peakTransmission = transmission(_nuPeak);
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 |
|
---|
| 36 | //--------------
|
---|
| 37 | // Destructor --
|
---|
| 38 | //--------------
|
---|
| 39 | SquareFilter::~SquareFilter()
|
---|
| 40 | {
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | // ---------------------------
|
---|
| 44 | // -- Function Definitions --
|
---|
| 45 | // ---------------------------
|
---|
| 46 |
|
---|
| 47 |
|
---|
| 48 | double
|
---|
| 49 | SquareFilter::transmission(double nu) const
|
---|
| 50 | {
|
---|
| 51 | if(nu < -1.e99) nu = -1.e99;
|
---|
| 52 | if(nu > 1.e99) nu = 1.e99;
|
---|
| 53 |
|
---|
| 54 | if(nu>=_numin && nu<=_numax) return 1.;
|
---|
| 55 | return 0.;
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | double
|
---|
| 59 | SquareFilter::peakFreq() const
|
---|
| 60 | {
|
---|
| 61 | return _nuPeak;
|
---|
| 62 | }
|
---|
| 63 |
|
---|
| 64 | double
|
---|
| 65 | SquareFilter::peakTransmission() const
|
---|
| 66 | {
|
---|
[668] | 67 | return _peakTransmission;
|
---|
[601] | 68 | }
|
---|
[668] | 69 |
|
---|
| 70 | void
|
---|
| 71 | SquareFilter::WriteSelf(POutPersist& s)
|
---|
| 72 | {
|
---|
| 73 | s.PutR8(this->minFreq());
|
---|
| 74 | s.PutR8(this->maxFreq());
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | void
|
---|
| 78 | SquareFilter::ReadSelf(PInPersist& s)
|
---|
| 79 | {
|
---|
| 80 | double minFreq, maxFreq;
|
---|
| 81 | s.GetR8(_numin);
|
---|
| 82 | s.GetR8(_numax);
|
---|
| 83 | cout << "minFreq - maxFreq " << _numin << "-" << _numax << endl;
|
---|
| 84 | }
|
---|