Changeset 668 in Sophya
- Timestamp:
- Nov 29, 1999, 3:16:10 PM (26 years ago)
- Location:
- trunk/SophyaLib/SkyT
- Files:
-
- 2 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SkyT/blackbody.cc
r607 r668 1 1 //-------------------------------------------------------------------------- 2 2 // File and Version Information: 3 // $Id: blackbody.cc,v 1. 2 1999-11-20 21:00:47ansari Exp $3 // $Id: blackbody.cc,v 1.3 1999-11-29 14:16:03 ansari Exp $ 4 4 // 5 5 // Description: … … 24 24 //---------------- 25 25 BlackBody::BlackBody(double temperature) 26 : RadSpectra( 0., 10000.)26 : RadSpectra(10., 10000.) 27 27 { 28 28 _temperature = temperature; … … 57 57 } 58 58 59 void 60 BlackBody::WriteSelf(POutPersist& s) 61 { 62 s.PutR8(this->getTemperature()); 63 s.PutR8(this->minFreq()); 64 s.PutR8(this->maxFreq()); 65 } 66 67 void 68 BlackBody::ReadSelf(PInPersist& s) 69 { 70 s.GetR8(_temperature); 71 s.GetR8(_numin); 72 s.GetR8(_numax); 73 cout << " Temperature - minFreq - maxFreq " << endl; 74 cout << _temperature << "-" << _numin << "-" << _numax << endl; 75 } 76 77 59 78 void 60 79 BlackBody::Print(ostream& os) const -
trunk/SophyaLib/SkyT/blackbody.h
r607 r668 2 2 //-------------------------------------------------------------------------- 3 3 // File and Version Information: 4 // $Id: blackbody.h,v 1. 2 1999-11-20 21:00:47ansari Exp $4 // $Id: blackbody.h,v 1.3 1999-11-29 14:16:03 ansari Exp $ 5 5 // 6 6 // Description: … … 33 33 inline void setTemperature(double newtemp) { _temperature = newtemp; } 34 34 35 virtual void ReadSelf(PInPersist& s); 36 virtual void WriteSelf(POutPersist& s); 35 37 // Redefintion of the Print function 36 38 virtual void Print(ostream& os) const; -
trunk/SophyaLib/SkyT/easyTest.cc
r601 r668 4 4 #include "specrespvector.h" 5 5 #include "tvector.h" 6 // #include "szsource.h"7 6 #include "squarefilt.h" 8 7 #include "trianglefilt.h" 8 9 #include "iobjspecresp.cc" 10 9 11 int 10 12 main() 11 13 { 14 // PInPersist in("out"); 15 // SR_ReadSelf(in); 16 // cout << " " << endl; 17 18 PInPersist in2("outTF"); 19 SR_ReadSelf(in2); 20 cout << " " << endl; 21 12 22 cout << "BlackBody!" << endl; 13 BlackBody myBB ;14 double freqmin = 10.;15 double freqmax = 100;23 BlackBody myBB(2.73); 24 double freqmin = 230.; 25 double freqmax = 500; 16 26 double logIF = myBB.logIntegratedFlux(freqmin,freqmax); 17 27 double IF = myBB.integratedFlux(freqmin,freqmax); … … 19 29 cout << "nolog " << IF << endl; 20 30 cout << "min et max " << myBB.minFreq() << " :: " << myBB.maxFreq() << endl; 21 cout << "full integration no log " << myBB.integratedFlux() << endl; 22 cout << "full integration log " << myBB.logIntegratedFlux() << endl; 31 cout << "full integration no log " << myBB.integratedFlux(freqmin,freqmax) << endl; 32 cout << "full integration log " << myBB.logIntegratedFlux(freqmin,freqmax) << endl; 33 cout << "full integration no log nolimit " << myBB.integratedFlux() << endl; 34 cout << "full integration log nolimit " << myBB.logIntegratedFlux() << endl; 23 35 24 /*25 cout << "SZSource " << endl;26 SzSource mySZ(1);27 double logSZ = mySZ.logIntegratedFlux(freqmin,freqmax);28 double SZ = mySZ.integratedFlux(freqmin,freqmax);29 cout << "log " << logSZ << endl;30 cout << "nolog " << SZ << endl;31 cout << "min et max " << mySZ.minFreq() << " :: " << mySZ.maxFreq() << endl;32 cout << "full integration no log " << mySZ.integratedFlux() << endl;33 cout << "full integration log " << mySZ.logIntegratedFlux() << endl;34 */35 36 cout << "squareFilter " << endl; 36 SquareFilter mySF( 0,200);37 SquareFilter mySF(200,600); 37 38 double logSF = mySF.logIntegratedSpect(freqmin,freqmax); 38 39 double SF = mySF.IntegratedSpect(freqmin,freqmax); … … 40 41 cout << "nolog " << SF << endl; 41 42 cout << "min et max " << mySF.minFreq() << " :: " << mySF.maxFreq() << endl; 42 cout << "full integration no log " << mySF.IntegratedSpect() << endl; 43 cout << "full integration log " << mySF.logIntegratedSpect() << endl; 43 cout << "full integration no log " << mySF.IntegratedSpect(200,700) << endl; 44 cout << "full integration log " << mySF.logIntegratedSpect(200,700) << endl; 45 cout << "full integration no log nolimit " << mySF.IntegratedSpect() << endl; 46 cout << "full integration log nolimit " << mySF.logIntegratedSpect() << endl; 47 44 48 45 49 cout << "triangleFilter" << endl; 46 TriangleFilter myTF( 10,200,20,40);50 TriangleFilter myTF(200,500,120,40); 47 51 double logTF = myTF.logIntegratedSpect(10.,freqmax); 48 52 double TF = myTF.IntegratedSpect(10.,freqmax); … … 59 63 for (int i=0; i<maxVal; i++) 60 64 { 61 vecOfNu(i) = (double)i+ 30.;65 vecOfNu(i) = (double)i+230.; 62 66 vecOfFDeNu(i) = 1.; //*(double)i+1; 63 67 cout << "entry values " << vecOfNu(i) << " " << vecOfFDeNu(i) << endl; 64 68 } 65 freqmin = 10.;66 freqmax = 19.;69 freqmin = 200.; 70 freqmax = 259.; 67 71 RadSpectraVec myRSV(vecOfNu, vecOfFDeNu); 68 72 double RSV = myRSV.integratedFlux(freqmin,freqmax); … … 81 85 for (int i=0; i<SRVmaxVal; i++) 82 86 { 83 vecOfNuRSV(i) = (double)i+ 30.;87 vecOfNuRSV(i) = (double)i+130.; 84 88 vecOfFDeNuRSV(i) = 10*(double)i+1; 85 89 // cout << "entry values " << vecOfNuRSV(i) << " " << vecOfFDeNuRSV(i) << endl; … … 99 103 cout << "...Testing filter and integrate !" << endl; 100 104 101 cout << " BBSF nolog " << myBB.filteredIntegratedFlux(mySF, 30.,100.) << endl;102 cout << " BBSF log " << myBB.filteredLogIntFlux(mySF, 30.,100.) << endl;103 cout << "full integration no log " << myBB.integratedFlux( 30.,100.) << endl;104 cout << "full integration log " << myBB.logIntegratedFlux( 30.,100.) << endl;105 cout << " BBSF nolog " << myBB.filteredIntegratedFlux(mySF,200.,400.) << endl; 106 cout << " BBSF log " << myBB.filteredLogIntFlux(mySF,200.,400.) << endl; 107 cout << "full integration no log " << myBB.integratedFlux(200.,400.) << endl; 108 cout << "full integration log " << myBB.logIntegratedFlux(200.,400.) << endl; 105 109 cout << "SF" << endl; 106 cout << "full integration no log " << mySF.IntegratedSpect( 30.,100.) << endl;107 cout << "full integration log " << mySF.logIntegratedSpect( 30.,100.) << endl;110 cout << "full integration no log " << mySF.IntegratedSpect(200.,400.) << endl; 111 cout << "full integration log " << mySF.logIntegratedSpect(200.,400.) << endl; 108 112 109 cout << " BBTF nolog " << myBB.filteredIntegratedFlux(myTF, 30.,100.) << endl;110 cout << " BBTF log " << myBB.filteredLogIntFlux(myTF, 30.,100.) << endl;113 cout << " BBTF nolog " << myBB.filteredIntegratedFlux(myTF,200.,400.) << endl; 114 cout << " BBTF log " << myBB.filteredLogIntFlux(myTF,200.,400.) << endl; 111 115 cout << "TF" << endl; 112 cout << "full integration no log " << myTF.IntegratedSpect( 30.,100.) << endl;113 cout << "full integration log " << myTF.logIntegratedSpect( 30.,100.) << endl;116 cout << "full integration no log " << myTF.IntegratedSpect(200.,400.) << endl; 117 cout << "full integration log " << myTF.logIntegratedSpect(200.,400.) << endl; 114 118 115 119 /* … … 123 127 */ 124 128 cout << "********" << endl; 125 cout << " RSVSF nolog " << myRSV.filteredIntegratedFlux(mySF,30.,100.) << endl; 126 cout << " RSVSF log " << myRSV.filteredLogIntFlux(mySF,30.,100.) << endl; 127 cout << "full integration no log " << myRSV.integratedFlux(30.,100.) << endl; 128 cout << "full integration log " << myRSV.logIntegratedFlux(30.,100.) << endl; 129 double min, max; 130 min=232; 131 max=235; 129 132 130 cout << " RSVTF nolog " << myRSV.filteredIntegratedFlux(myTF,30.,100.) << endl; 131 cout << " RSVTF log " << myRSV.filteredLogIntFlux(myTF,30.,100.) << endl; 133 cout << " RSVSF nolog " << myRSV.filteredIntegratedFlux(mySF,min,max) << endl; 134 cout << " RSVSF log " << myRSV.filteredLogIntFlux(mySF,min,max) << endl; 135 cout << "full integration no log " << myRSV.integratedFlux(230.,500.) << endl; 136 cout << "full integration log " << myRSV.logIntegratedFlux(230.,500.) << endl; 137 cout << "full integration no log min max " << myRSV.integratedFlux(min,max) << endl; 138 cout << "full integration log min max " << myRSV.logIntegratedFlux(min,max) << endl; 139 140 cout << " RSVTF nolog " << myRSV.filteredIntegratedFlux(myTF,230.,500.) << endl; 141 cout << " RSVTF log " << myRSV.filteredLogIntFlux(myTF,230.,500.) << endl; 142 143 // cout << "New TESTS USING IOBJS!" << endl; 144 // POutPersist out("out"); 145 // TriangleFilter* myTF2 = new TriangleFilter(10,200,20,40); 146 // SR_WriteSelf(myTF2,out); 147 148 // POutPersist outV("outV"); 149 // cout << "check before anything" << vecOfNu.NElts()<< endl; 150 // SpecRespVec* mySRV2 = new SpecRespVec(vecOfNu, vecOfFDeNu); 151 // SR_WriteSelf(mySRV2,outV); 152 153 // Vector myVec(10); 154 // myVec.ReSize(10); 155 // cout << myVec.NElts(); 156 // return 1; 157 158 cout << "read and write things in file...ppersist!" << endl; 159 TriangleFilter myTF2(10,200,20,40); 160 POutPersist outTF("outTF"); 161 myTF2.WriteSelf(outTF); 162 // PInPersist inTF("outTF"); 163 // myTF2.ReadSelf(inTF); 132 164 133 165 134 return 1;135 166 } -
trunk/SophyaLib/SkyT/gaussfilt.cc
r610 r668 1 1 //-------------------------------------------------------------------------- 2 2 // File and Version Information: 3 // $Id: gaussfilt.cc,v 1. 3 1999-11-21 23:25:45ansari Exp $3 // $Id: gaussfilt.cc,v 1.4 1999-11-29 14:16:04 ansari Exp $ 4 4 // 5 5 // Description: … … 22 22 // Constructor -- 23 23 //---------------- 24 GaussianFilter::GaussianFilter() 25 : SpectralResponse() 26 { 27 setParams(100, 10., 1.); 28 } 29 24 30 GaussianFilter::GaussianFilter(double nu0, double s, double a, double numin, double numax) 25 31 : SpectralResponse(numin, numax) 26 32 { 27 if (s < 1.e-19) s = 1.e-19; 28 _s = s; 29 _nu0 = nu0; 30 _a = a; 33 setParams(nu0, s, a); 31 34 } 32 35 … … 66 69 } 67 70 71 72 73 void 74 GaussianFilter::setParams(double nu0, double s, double a) 75 { 76 if (s < 1.e-19) s = 1.e-19; 77 _s = s; 78 _nu0 = nu0; 79 _a = a; 80 } 81 82 83 68 84 void 69 85 GaussianFilter::Print(ostream& os) const … … 76 92 77 93 } 94 95 void 96 ObjFileIO<GaussianFilter>::WriteSelf(POutPersist& s) const 97 { 98 if(dobj == NULL) 99 { 100 cout << " ObjFileIO<GaussianFilter>::WriteSelf:: dobj= null " << endl; 101 return; 102 } 103 int_4 version, nothing; 104 version = 1; 105 nothing = 0; // Reserved for future use 106 s.PutI4(version); 107 s.PutI4(nothing); 108 109 s.PutR8(dobj->minFreq()); 110 s.PutR8(dobj->maxFreq()); 111 s.PutR8(dobj->giveNorm()); 112 s.PutR8(dobj->giveNu0()); 113 s.PutR8(dobj->giveDNu()); 114 } 115 116 void 117 ObjFileIO<GaussianFilter>::ReadSelf(PInPersist& s) 118 { 119 int_4 version, nothing; 120 version = 1; 121 nothing = 0; // Reserved for future use 122 s.GetI4(version); 123 s.GetI4(nothing); 124 125 if(dobj == NULL) 126 { 127 dobj= new GaussianFilter(); 128 ownobj= true; 129 } 130 131 r_8 a, nu0, dnu, numin, numax; 132 s.GetR8(numin); 133 s.GetR8(numax); 134 s.GetR8(a); 135 s.GetR8(nu0); 136 s.GetR8(dnu); 137 dobj->setMinMaxFreq(numin, numax); 138 dobj->setParams(nu0, dnu, a); 139 // cout << " Norm - Nu0 - DNu - minFreq - maxFreq " << endl; 140 // cout << _a << "-" << _nu0 << "-" << _s << "-" << _numin << "-" << _numax << endl; 141 } 142 143 144 #ifdef __CXX_PRAGMA_TEMPLATES__ 145 #pragma define_template ObjFileIO<GaussianFilter> 146 #endif 147 148 #if defined(ANSI_TEMPLATES) || defined(GNU_TEMPLATES) 149 template class ObjFileIO<GaussianFilter>; 150 #endif -
trunk/SophyaLib/SkyT/gaussfilt.h
r610 r668 2 2 //-------------------------------------------------------------------------- 3 3 // File and Version Information: 4 // $Id: gaussfilt.h,v 1. 3 1999-11-21 23:25:45 ansari Exp $4 // $Id: gaussfilt.h,v 1.4 1999-11-29 14:16:05 ansari Exp $ 5 5 // 6 6 // Description: … … 18 18 //---------------------- 19 19 #include "specresp.h" 20 #include "objfio.h" 20 21 21 22 //------------------------------------ … … 29 30 // Spectral response in the form A Exp(-((nu-nu0)/s)^2) 30 31 32 namespace SOPHYA { 33 31 34 class GaussianFilter:public SpectralResponse 32 35 { 33 36 public: 34 37 //Constructors 38 GaussianFilter (); 35 39 GaussianFilter (double nu0, double s, double a=1., double numin=0., double numax= 9.e49); 36 40 … … 49 53 virtual void Print(ostream& os) const; 50 54 55 virtual inline double giveNorm() const {return _a;}; 56 virtual inline double giveNu0() const {return _nu0;}; 57 virtual inline double giveDNu() const {return _s;}; 58 virtual void setParams(double nu0, double s, double a=1.); 59 51 60 protected: 52 61 double _a, _s, _nu0; … … 54 63 55 64 65 // ObjFileIO<SpecRespVec> pour les PPersist 66 inline POutPersist& operator << (POutPersist& os, GaussianFilter & obj) 67 { ObjFileIO<GaussianFilter> fio(&obj); fio.Write(os); return(os);} 68 69 inline PInPersist& operator >> (PInPersist& os, GaussianFilter & obj) 70 { ObjFileIO<GaussianFilter> fio(&obj); fio.Read(os); return(os);} 71 72 }; // End of namespace 73 56 74 #endif -
trunk/SophyaLib/SkyT/nupower.cc
r610 r668 1 1 //-------------------------------------------------------------------------- 2 2 // File and Version Information: 3 // $Id: nupower.cc,v 1. 3 1999-11-21 23:25:45 ansari Exp $3 // $Id: nupower.cc,v 1.4 1999-11-29 14:16:05 ansari Exp $ 4 4 // 5 5 // Description: … … 24 24 // Constructor -- 25 25 //---------------- 26 PowerLawSpectra::PowerLawSpectra() 27 { 28 } 29 26 30 PowerLawSpectra::PowerLawSpectra(double a, double b, double nu0, double dnu, double numin, double numax) 27 31 : RadSpectra(numin, numax) … … 47 51 } 48 52 53 54 void 55 PowerLawSpectra::WriteSelf(POutPersist& s) 56 { 57 s.PutR8(this->giveNorm()); 58 s.PutR8(this->giveNu0()); 59 s.PutR8(this->giveDNu()); 60 s.PutR8(this->giveExp()); 61 s.PutR8(this->minFreq()); 62 s.PutR8(this->maxFreq()); 63 } 64 65 void 66 PowerLawSpectra::ReadSelf(PInPersist& s) 67 { 68 s.GetR8(_a); 69 s.GetR8(_nu0); 70 s.GetR8(_dnu); 71 s.GetR8(_b); 72 s.GetR8(_numin); 73 s.GetR8(_numax); 74 cout << " Norm - Nu0 - DNu - Exp - minFreq - maxFreq " << endl; 75 cout << _a << "-" << _nu0 << "-" << _dnu << "-" << _b << "-" << _numin << "-" << _numax << endl; 76 } 77 78 49 79 void 50 80 PowerLawSpectra::Print(ostream& os) const -
trunk/SophyaLib/SkyT/nupower.h
r610 r668 2 2 //-------------------------------------------------------------------------- 3 3 // File and Version Information: 4 // $Id: nupower.h,v 1. 3 1999-11-21 23:25:46ansari Exp $4 // $Id: nupower.h,v 1.4 1999-11-29 14:16:05 ansari Exp $ 5 5 // 6 6 // Description: … … 22 22 public: //Constructor 23 23 24 PowerLawSpectra(); 24 25 PowerLawSpectra(double a, double b, double nu0, double dnu, double numin=0., double numax=9.e49); 25 26 … … 30 31 // Redefintion of the Print function 31 32 virtual void Print(ostream& os) const; 33 34 virtual inline double giveNorm() const {return _a;}; 35 virtual inline double giveNu0() const {return _nu0;}; 36 virtual inline double giveDNu() const {return _dnu;}; 37 virtual inline double giveExp() const {return _b;}; 38 39 virtual void WriteSelf(POutPersist& s) ; 40 virtual void ReadSelf(PInPersist& s) ; 41 32 42 33 43 protected: -
trunk/SophyaLib/SkyT/radspec.cc
r607 r668 1 1 //-------------------------------------------------------------------------- 2 2 // File and Version Information: 3 // $Id: radspec.cc,v 1. 2 1999-11-20 21:00:50ansari Exp $3 // $Id: radspec.cc,v 1.3 1999-11-29 14:16:06 ansari Exp $ 4 4 // 5 5 // Description: … … 104 104 RadSpectra::integratedFlux(double f1, double f2) const 105 105 { 106 _raypourfinteg = const_cast<RadSpectra *>(this); 107 TrpzInteg I(RadSpectra_fluxFunction , f1, f2); 108 double val = (double)I; 109 _raypourfinteg = NULL; // On ne peut pas faire ca avant la destruction de I 110 return(val); 106 // cout << endl; 107 // cout << this->minFreq() << " = " << this->maxFreq() << endl; 108 // cout << f1 << " = " << f2 << endl; 109 if(f1 < this->minFreq()) f1 = this->minFreq(); 110 if(f2 > this->maxFreq()) f2 = this->maxFreq(); 111 _raypourfinteg = const_cast<RadSpectra *>(this); 112 TrpzInteg I(RadSpectra_fluxFunction , f1, f2); 113 double val = (double)I; 114 _raypourfinteg = NULL; // On ne peut pas faire ca avant la destruction de I 115 return(val); 111 116 } 112 117 double 113 118 RadSpectra::integratedFlux() const 114 119 { 115 return integratedFlux( _numin, _numax);120 return integratedFlux(this->minFreq(),this->maxFreq()); 116 121 } 117 122 … … 129 134 RadSpectra::logIntegratedFlux(double f1, double f2) const 130 135 { 136 if(f1 < this->minFreq()) f1 = this->minFreq(); 137 if(f2 > this->maxFreq()) f2 = this->maxFreq(); 138 131 139 double f1Log = log10(f1); 132 140 double f2Log = log10(f2); … … 161 169 _raypourfinteg = const_cast<RadSpectra *>(this); 162 170 _filter = const_cast<SpectralResponse *>(&filter); 171 if(f1 < this->minFreq()) f1 = this->minFreq(); 172 if(f2 > this->maxFreq()) f2 = this->maxFreq(); 173 163 174 TrpzInteg I(RadSpectra_filteredFlux,f1,f2); 164 175 double val = (double)I; … … 185 196 double nu = pow(10,tau); 186 197 double flux = _raypourfinteg->flux(nu)*nu; 187 return(flux * _filter->transmission(nu)); 198 double result = flux * _filter->transmission(nu); 199 return(result); 188 200 } 189 201 … … 192 204 RadSpectra::filteredLogIntFlux(SpectralResponse const& filter, double f1, double f2) const 193 205 { 194 195 // double f1Log = log10(f1);196 // double f2Log = log10(f2);197 // if(f1Log < -1.e99) f1Log = -1.e99;198 // if(f2Log > 1.e99) f2Log = 1.e99;199 // _rayIntLog = const_cast<RadSpectra *>(this);200 // TrpzInteg I(RadSpectra_logFluxFunction,f1Log,f2Log);201 // double value = (double)I * log(10.);202 // return(value);203 // _rayIntLog = NULL;204 206 205 207 _raypourfinteg = NULL; 206 208 _filter = NULL; 209 if(f1 < this->minFreq()) f1 = this->minFreq(); 210 if(f2 > this->maxFreq()) f2 = this->maxFreq(); 211 207 212 double f1Log = log10(f1); 208 213 double f2Log = log10(f2); … … 226 231 227 232 233 228 234 void 229 235 RadSpectra::Print(ostream& os) const -
trunk/SophyaLib/SkyT/radspec.h
r607 r668 2 2 //-------------------------------------------------------------------------- 3 3 // File and Version Information: 4 // $Id: radspec.h,v 1. 2 1999-11-20 21:00:50ansari Exp $4 // $Id: radspec.h,v 1.3 1999-11-29 14:16:06 ansari Exp $ 5 5 // 6 6 // Description: … … 18 18 19 19 #include "specresp.h" 20 20 #include "objfio.h" 21 21 // --------------------- 22 22 // -- Class Interface -- … … 76 76 77 77 virtual void Print(ostream& os) const; 78 virtual void ReadSelf(PInPersist& s) = 0; 79 virtual void WriteSelf(POutPersist& s) = 0; 78 80 79 81 protected: -
trunk/SophyaLib/SkyT/radspecvector.cc
r610 r668 1 1 //-------------------------------------------------------------------------- 2 2 // File and Version Information: 3 // $Id: radspecvector.cc,v 1. 3 1999-11-21 23:25:46 ansari Exp $3 // $Id: radspecvector.cc,v 1.4 1999-11-29 14:16:06 ansari Exp $ 4 4 // 5 5 // Description: … … 26 26 // Constructor -- 27 27 //---------------- 28 RadSpectraVec::RadSpectraVec() 29 { 30 } 31 28 32 RadSpectraVec::RadSpectraVec(Vector const & nu, Vector const & fdenu, double numin, double numax) 29 33 : RadSpectra(numin, numax) … … 35 39 _numin = nu(0); 36 40 _numax = nu(nu.NElts()-1); 41 _size = nu.NElts(); 37 42 if(_vecOfNu.NElts() != _vecOfFDeNu.NElts()) cout << "vectors are not compatible" << exit; 38 43 } … … 78 83 } 79 84 85 void 86 RadSpectraVec::WriteSelf(POutPersist& s) 87 { 88 s.PutI4(this->NbElts()); 89 for (int i=0; i< this->NbElts(); i++) 90 { 91 s.PutR8(this->getNuVec(i)); 92 s.PutR8(this->getFNuVec(i)); 93 } 94 s.PutR8(this->minFreq()); 95 s.PutR8(this->maxFreq()); 96 97 } 98 99 void 100 RadSpectraVec::ReadSelf(PInPersist& s) 101 { 102 s.GetI4(_size); 103 104 _vecOfNu.ReSize(_size); 105 _vecOfFDeNu.ReSize(_size); 106 for (int i=0; i< _size; i++) 107 { 108 s.GetR8(_vecOfNu(i)); 109 s.GetR8(_vecOfFDeNu(i)); 110 } 111 s.GetR8(_numin); 112 s.GetR8(_numax); 113 cout << "minFreq - maxFreq"<< endl; 114 cout << _numin<< "-" << _numax << endl; 115 } 116 117 80 118 81 119 void -
trunk/SophyaLib/SkyT/radspecvector.h
r607 r668 30 30 public: 31 31 //Constructor 32 RadSpectraVec (); 32 33 RadSpectraVec (Vector const & nu, Vector const & fdenu, double numin=0., double numax=9.e49); 33 34 … … 47 48 inline Vector& getNuVec() { return _vecOfNu; } 48 49 inline Vector& getFNuVec() { return _vecOfFDeNu; } 50 inline double getNuVec(int i) const { return _vecOfNu(i); } 51 inline double getFNuVec(int i) const { return _vecOfFDeNu(i); } 52 inline int NbElts() const { return _size;} 53 virtual void ReadSelf(PInPersist& s); 54 virtual void WriteSelf(POutPersist& s); 49 55 50 56 virtual void Print(ostream& os) const; … … 53 59 Vector _vecOfNu; 54 60 Vector _vecOfFDeNu; 55 61 int _size; 56 62 }; 57 63 -
trunk/SophyaLib/SkyT/specresp.cc
r607 r668 1 1 //-------------------------------------------------------------------------- 2 2 // File and Version Information: 3 // $Id: specresp.cc,v 1. 2 1999-11-20 21:00:52ansari Exp $3 // $Id: specresp.cc,v 1.3 1999-11-29 14:16:08 ansari Exp $ 4 4 // 5 5 // Description: … … 19 19 #include "specresp.h" 20 20 #include "integ.h" 21 #include "tvector.h" 21 22 22 23 //---------------- … … 60 61 } 61 62 63 64 // To change min-max frequency 65 void 66 SpectralResponse::setMinMaxFreq(double numin, double numax) 67 { 68 _numin = numin; 69 _numax = numax; 70 } 62 71 63 72 … … 108 117 SpectralResponse::IntegratedSpect(double numin, double numax) const 109 118 { 119 if(numin < this->minFreq()) numin = this->minFreq(); 120 if(numax > this->maxFreq()) numax = this->maxFreq(); 121 122 110 123 _mySpecResp = const_cast<SpectralResponse *>(this); 111 if(numin <= _numin) numin = _numin;112 if(numax >= _numax) numax = _numax;113 124 TrpzInteg I(SpectralResponse_transmission , numin, numax); 114 125 double val = (double)I; … … 129 140 SpectralResponse::logIntegratedSpect(double numin, double numax) const 130 141 { 131 if(numin <= _numin) numin = _numin;132 if(numax >= _numax) numax = _numax;142 if(numin <= this->minFreq()) numin = this->minFreq(); 143 if(numax >= this->maxFreq()) numax = this->maxFreq(); 133 144 if(numin == 0) numin = 1.e-99; 134 145 double f1Log = log10(numin); -
trunk/SophyaLib/SkyT/specresp.h
r607 r668 2 2 //-------------------------------------------------------------------------- 3 3 // File and Version Information: 4 // $Id: specresp.h,v 1. 2 1999-11-20 21:00:52ansari Exp $4 // $Id: specresp.h,v 1.3 1999-11-29 14:16:08 ansari Exp $ 5 5 // 6 6 // Description: … … 14 14 15 15 #include "machdefs.h" 16 #include "anydataobj.h" 16 17 #include <iostream.h> 17 18 18 //------------------------------------ 19 19 // Collaborating Class Declarations -- … … 25 25 26 26 // ***IMPORTANT*** All frequencies are expressed in GHz (10^9 Hz) 27 namespace SOPHYA { 28 29 class SpectralResponse : public AnyDataObj 30 { 31 32 public: 33 //Constructor 34 SpectralResponse(double numin=0., double numax=1.); 35 36 // destructor 37 virtual ~SpectralResponse(); 38 39 // 40 // Member Functions 41 // 42 43 // The transmission() function is virtual: 44 virtual double transmission(double nu) const =0 ; 45 46 inline double operator() (double nu) const { return(transmission(nu)); } 47 48 virtual void Print(ostream& os) const; 49 50 virtual double minFreq() const; 51 virtual double maxFreq() const; 52 virtual double meanFreq() const; 53 virtual double peakFreq() const; 54 virtual double peakTransmission() const; 27 55 28 class SpectralResponse 29 { 56 // For changing the min/max frequency 57 virtual void setMinMaxFreq(double numin, double numax); 30 58 31 public: 32 //Constructor 33 SpectralResponse(double numin=0., double numax=1.); 34 35 // destructor 36 virtual ~SpectralResponse(); 37 38 // 39 // Member Functions 40 // 41 42 // The transmission() function is virtual: 43 virtual double transmission(double nu) const =0 ; 44 45 inline double operator() (double nu) const { return(transmission(nu)); } 46 47 virtual void Print(ostream& os) const; 48 49 virtual double minFreq() const; 50 virtual double maxFreq() const; 51 virtual double meanFreq() const; 52 virtual double peakFreq() const; 53 virtual double peakTransmission() const; 54 virtual double IntegratedSpect(double numin, double numax) const ; 55 virtual double logIntegratedSpect(double numin, double numax) const ; 56 virtual double IntegratedSpect() const ; 57 virtual double logIntegratedSpect() const ; 58 59 protected: 60 double _numin; 61 double _numax; 59 virtual double IntegratedSpect(double numin, double numax) const ; 60 virtual double logIntegratedSpect(double numin, double numax) const ; 61 virtual double IntegratedSpect() const ; 62 virtual double logIntegratedSpect() const ; 63 64 protected: 65 double _numin; 66 double _numax; 67 }; 68 69 70 // definition of the << operator 71 inline ostream& operator << (ostream& s, SpectralResponse const & sr) 72 { sr.Print(s); return(s); } 73 74 75 62 76 }; 63 77 64 65 // definition of the << operator 66 inline ostream& operator << (ostream& s, SpectralResponse const & sr) 67 { sr.Print(s); return(s); } 78 #endif 68 79 69 80 70 #endif 81 82 -
trunk/SophyaLib/SkyT/specrespvector.cc
r610 r668 1 1 //-------------------------------------------------------------------------- 2 2 // File and Version Information: 3 // $Id: specrespvector.cc,v 1. 3 1999-11-21 23:25:47ansari Exp $3 // $Id: specrespvector.cc,v 1.4 1999-11-29 14:16:09 ansari Exp $ 4 4 // 5 5 // Description: … … 22 22 #include "specrespvector.h" 23 23 #include "pexceptions.h" 24 25 24 //---------------- 26 25 // Constructor -- 27 26 //---------------- 27 SpecRespVec::SpecRespVec() 28 : SpectralResponse() 29 { 30 } 31 28 32 SpecRespVec::SpecRespVec(Vector const & nu, Vector const & fdenu, double numin, double numax) 29 33 : SpectralResponse(numin, numax) … … 35 39 _numin = nu(0); 36 40 _numax = nu(nu.NElts()-1); 41 _size = nu.NElts(); 37 42 if(_vecOfNu.NElts() != _vecOfFDeNu.NElts()) cout << "vectors are not compatible" << exit; 38 43 } … … 91 96 92 97 } 98 99 100 void 101 ObjFileIO<SpecRespVec>::WriteSelf(POutPersist& s) const 102 { 103 if(dobj == NULL) 104 { 105 cout << " ObjFileIO<SpecRespVec>::WriteSelf:: dobj= null " << endl; 106 return; 107 } 108 109 int_4 version, nothing; 110 version = 1; 111 nothing = 0; // Reserved for future use 112 s.PutI4(version); 113 s.PutI4(nothing); 114 115 s.PutR8(dobj->minFreq()); 116 s.PutR8(dobj->maxFreq()); 117 118 // TVector<T> has Persistence Manager 119 s << dobj->getNuVec(); 120 s << dobj->getTNuVec(); 121 } 122 123 void 124 ObjFileIO<SpecRespVec>::ReadSelf(PInPersist& s) 125 { 126 int_4 version, nothing; 127 version = 1; 128 nothing = 0; // Reserved for future use 129 s.GetI4(version); 130 s.GetI4(nothing); 131 132 if(dobj == NULL) 133 { 134 Vector v1(10); 135 Vector v2(10); 136 dobj= new SpecRespVec(); 137 ownobj= true; 138 } 139 140 r_8 minf, maxf; 141 s.GetR8(minf); 142 s.GetR8(maxf); 143 dobj->setMinMaxFreq(minf, maxf); 144 // TVector<T> has Persistence Manager 145 s >> dobj->getNuVec(); 146 s >> dobj->getTNuVec(); 147 } 148 149 150 #ifdef __CXX_PRAGMA_TEMPLATES__ 151 #pragma define_template ObjFileIO<SpecRespVec> 152 #endif 153 154 #if defined(ANSI_TEMPLATES) || defined(GNU_TEMPLATES) 155 template class ObjFileIO<SpecRespVec>; 156 #endif -
trunk/SophyaLib/SkyT/specrespvector.h
r607 r668 2 2 //-------------------------------------------------------------------------- 3 3 // File and Version Information: 4 // $Id: specrespvector.h,v 1. 2 1999-11-20 21:00:53ansari Exp $4 // $Id: specrespvector.h,v 1.3 1999-11-29 14:16:09 ansari Exp $ 5 5 // 6 6 // Description: … … 18 18 #include "specresp.h" 19 19 #include "tvector.h" 20 #include "objfio.h" 20 21 21 22 //------------------------------------ … … 29 30 // ***IMPORTANT*** All frequencies are expressed in GHz (10^9 Hz) 30 31 31 class SpecRespVec : public SpectralResponse 32 { 32 namespace SOPHYA { 33 34 class SpecRespVec : public SpectralResponse 35 { 33 36 34 37 public: 35 38 //Constructor 39 SpecRespVec(); 36 40 SpecRespVec(Vector const & nu, Vector const & fdenu, double numin=0., double numax=1.); 37 41 … … 47 51 48 52 // Acces to Nu and T(nu) vectors 49 inline Vector& getNuVec() { return _vecOfNu; } 50 inline Vector& getTNuVec() { return _vecOfFDeNu; } 51 53 inline Vector& getNuVec() { return _vecOfNu; } ; 54 inline Vector& getTNuVec() { return _vecOfFDeNu; } 55 inline double getNuVec(int i) const { return _vecOfNu(i); } 56 inline double getTNuVec(int i) const { return _vecOfFDeNu(i); } 57 inline int NbElts() const { return _size;} 58 52 59 virtual void Print(ostream& os) const; 53 54 60 55 61 protected: 56 62 Vector _vecOfNu; 57 63 Vector _vecOfFDeNu; 64 int _size; 58 65 }; 59 66 67 // ObjFileIO<SpecRespVec> pour les PPersist 68 inline POutPersist& operator << (POutPersist& os, SpecRespVec & obj) 69 { ObjFileIO<SpecRespVec> fio(&obj); fio.Write(os); return(os);} 70 71 inline PInPersist& operator >> (PInPersist& os, SpecRespVec & obj) 72 { ObjFileIO<SpecRespVec> fio(&obj); fio.Read(os); return(os);} 60 73 74 }; // End of namespace 61 75 #endif -
trunk/SophyaLib/SkyT/squarefilt.cc
r607 r668 1 1 //-------------------------------------------------------------------------- 2 2 // File and Version Information: 3 // $Id: squarefilt.cc,v 1. 2 1999-11-20 21:00:53ansari Exp $3 // $Id: squarefilt.cc,v 1.3 1999-11-29 14:16:09 ansari Exp $ 4 4 // 5 5 // Description: … … 21 21 // Constructor -- 22 22 //---------------- 23 SquareFilter::SquareFilter() 24 : SpectralResponse() 25 { 26 } 27 23 28 SquareFilter::SquareFilter(double numin, double numax) 24 29 : SpectralResponse(numin, numax) … … 60 65 SquareFilter::peakTransmission() const 61 66 { 62 return _peakTransmission;67 return _peakTransmission; 63 68 } 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 } -
trunk/SophyaLib/SkyT/squarefilt.h
r607 r668 2 2 //-------------------------------------------------------------------------- 3 3 // File and Version Information: 4 // $Id: squarefilt.h,v 1. 2 1999-11-20 21:00:54ansari Exp $4 // $Id: squarefilt.h,v 1.3 1999-11-29 14:16:09 ansari Exp $ 5 5 // 6 6 // Description: … … 29 29 class SquareFilter:public SpectralResponse 30 30 { 31 31 32 public: 32 33 //Constructors 34 SquareFilter (); 33 35 SquareFilter (double numin, double numax); 34 36 … … 45 47 virtual double peakTransmission() const; 46 48 49 virtual void WriteSelf(POutPersist& s) ; 50 virtual void ReadSelf(PInPersist& s) ; 51 52 53 47 54 protected: 48 55 double _peakTransmission; -
trunk/SophyaLib/SkyT/tgrsr.cc
r611 r668 1 1 #include "machdefs.h" 2 2 #include <iostream.h> 3 #include <typeinfo> 3 4 #include <math.h> 4 5 -
trunk/SophyaLib/SkyT/trianglefilt.cc
r607 r668 1 1 //-------------------------------------------------------------------------- 2 2 // File and Version Information: 3 // $Id: trianglefilt.cc,v 1. 2 1999-11-20 21:00:54ansari Exp $3 // $Id: trianglefilt.cc,v 1.3 1999-11-29 14:16:10 ansari Exp $ 4 4 // 5 5 // Description: … … 21 21 // Constructor -- 22 22 //---------------- 23 24 TriangleFilter::TriangleFilter() 25 : SpectralResponse() 26 { 27 } 23 28 TriangleFilter::TriangleFilter(double numin, double numax,double nupeak, double valueatpeak) 24 29 : SpectralResponse(numin, numax) … … 61 66 return _peakTransmission; 62 67 } 68 69 void 70 TriangleFilter::WriteSelf(POutPersist& s) 71 { 72 s.PutR8(this->peakFreq()); 73 s.PutR8(this->peakTransmission()); 74 s.PutR8(this->minFreq()); 75 s.PutR8(this->maxFreq()); 76 77 } 78 79 void 80 TriangleFilter::ReadSelf(PInPersist& s) 81 { 82 // double peakFreq, peakTransmission, minFreq, maxFreq; 83 s.GetR8(_nuPeak); 84 s.GetR8(_peakTransmission); 85 s.GetR8(_numin); 86 s.GetR8(_numax); 87 cout << "peakFreq - peakTransmission - minFreq - maxFreq " << endl; 88 cout << _nuPeak << "-" << _peakTransmission<< "-" << _numin << "-" << _numax << endl; 89 90 } -
trunk/SophyaLib/SkyT/trianglefilt.h
r607 r668 2 2 //-------------------------------------------------------------------------- 3 3 // File and Version Information: 4 // $Id: trianglefilt.h,v 1. 2 1999-11-20 21:00:54ansari Exp $4 // $Id: trianglefilt.h,v 1.3 1999-11-29 14:16:10 ansari Exp $ 5 5 // 6 6 // Description: … … 31 31 //Constructors 32 32 TriangleFilter (double numin, double numax,double nupeak, double valueatpeak); 33 33 TriangleFilter (); 34 34 35 35 // destructor … … 43 43 virtual double peakFreq() const; 44 44 virtual double peakTransmission() const; 45 virtual void WriteSelf(POutPersist& s) ; 46 virtual void ReadSelf(PInPersist& s) ; 45 47 46 48 protected:
Note:
See TracChangeset
for help on using the changeset viewer.