source: Sophya/trunk/SophyaProg/PMixer/easyTest.cc@ 3569

Last change on this file since 3569 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: 7.2 KB
RevLine 
[2322]1#include <iostream>
[2615]2#include "sopnamsp.h"
[761]3#include "blackbody.h"
4#include "radspecvector.h"
5#include "specrespvector.h"
6#include "tvector.h"
7#include "squarefilt.h"
8#include "gaussfilt.h"
9#include "trianglefilt.h"
10
11
12int
13main()
14{
15// PInPersist in("out");
16// SR_ReadSelf(in);
17// cout << " " << endl;
18
19 cout << "BlackBody!" << endl;
20 BlackBody myBB(2.73);
21 double freqmin = 230.;
22 double freqmax = 500;
23 double logIF = myBB.logIntegratedFlux(freqmin,freqmax);
24 double IF = myBB.integratedFlux(freqmin,freqmax);
25 cout << "log " << logIF << endl;
26 cout << "nolog " << IF << endl;
27 cout << "min et max " << myBB.minFreq() << " :: " << myBB.maxFreq() << endl;
28 cout << "full integration no log " << myBB.integratedFlux(freqmin,freqmax) << endl;
29 cout << "full integration log " << myBB.logIntegratedFlux(freqmin,freqmax) << endl;
30 cout << "full integration no log nolimit " << myBB.integratedFlux() << endl;
31 cout << "full integration log nolimit " << myBB.logIntegratedFlux() << endl;
32
33 cout << "squareFilter " << endl;
34 SquareFilter mySF(200,600);
35 double logSF = mySF.logIntegratedSpect(freqmin,freqmax);
36 double SF = mySF.IntegratedSpect(freqmin,freqmax);
37 cout << "log " << logSF << endl;
38 cout << "nolog " << SF << endl;
39 cout << "min et max " << mySF.minFreq() << " :: " << mySF.maxFreq() << endl;
40 cout << "full integration no log " << mySF.IntegratedSpect(200,700) << endl;
41 cout << "full integration log " << mySF.logIntegratedSpect(200,700) << endl;
42 cout << "full integration no log nolimit " << mySF.IntegratedSpect() << endl;
43 cout << "full integration log nolimit " << mySF.logIntegratedSpect() << endl;
44
45
46 cout << "triangleFilter" << endl;
47 TriangleFilter myTF(200,500,120,40);
48 double logTF = myTF.logIntegratedSpect(10.,freqmax);
49 double TF = myTF.IntegratedSpect(10.,freqmax);
50 cout << "log " << logTF << endl;
51 cout << "nolog " << TF << endl;
52 cout << "min et max " << myTF.minFreq() << " :: " << myTF.maxFreq() << endl;
53 cout << "full integration no log " << myTF.IntegratedSpect() << endl;
54 cout << "full integration log " << myTF.logIntegratedSpect() << endl;
55
56 cout << "....Testing RadSpectraVec..." << endl;
57 int maxVal = 10;
58 Vector vecOfNu(maxVal);
59 Vector vecOfFDeNu(maxVal);
[833]60 int i;
61 for (i=0; i<maxVal; i++)
[761]62 {
63 vecOfNu(i) = (double)i+230.;
64 vecOfFDeNu(i) = 1.; //*(double)i+1;
65 cout << "entry values " << vecOfNu(i) << " " << vecOfFDeNu(i) << endl;
66 }
67 freqmin = 200.;
68 freqmax = 259.;
69 RadSpectraVec myRSV(vecOfNu, vecOfFDeNu);
70 double RSV = myRSV.integratedFlux(freqmin,freqmax);
71
72 double logRSV = myRSV.logIntegratedFlux(freqmin,freqmax);
73 cout << "nolog int " << RSV << endl;
74 cout << "log int " << logRSV << endl;
75 cout << "min et max " << myRSV.minFreq() << " :: " << myRSV.maxFreq() << endl;
76 cout << "full integration no log " << myRSV.integratedFlux() << endl;
77 cout << "full integration log " << myRSV.logIntegratedFlux() << endl;
78
79 cout << "....Testing SpecRespVec..." << endl;
80 int SRVmaxVal = 100;
81 Vector vecOfNuRSV(SRVmaxVal);
82 Vector vecOfFDeNuRSV(SRVmaxVal);
[833]83 for (i=0; i<SRVmaxVal; i++)
[761]84 {
85 vecOfNuRSV(i) = (double)i+130.;
86 vecOfFDeNuRSV(i) = 10*(double)i+1;
87 // cout << "entry values " << vecOfNuRSV(i) << " " << vecOfFDeNuRSV(i) << endl;
88 }
89 freqmin = vecOfNuRSV(0);
90 freqmax = vecOfNuRSV(SRVmaxVal-1);
91 SpecRespVec mySRV(vecOfNuRSV, vecOfFDeNuRSV);
92
93// Test ecriture en PPF
94 {
95 cout << " Writing mySRV (RadSpecVec to PPF " << endl;
96 POutPersist s("srvec.ppf");
97 s << mySRV;
98 }
99 {
100 cout << " Reading mySRV from PPF " << endl;
101 PInPersist s("srvec.ppf");
102 SpecRespVec srv;
103 s >> srv;
104 cout << srv;
105 }
106
107 double SRV = mySRV.IntegratedSpect(freqmin,freqmax);
108 double logSRV = mySRV.logIntegratedSpect(freqmin,freqmax);
109 cout << "nolog " << SRV << endl;
110 cout << "log " << logSRV << endl;
111 cout << "min et max " << mySRV.minFreq() << " :: " << mySRV.maxFreq() << endl;
112 cout << "full integration no log " << mySRV.IntegratedSpect() << endl;
113 cout << "full integration log " << mySRV.logIntegratedSpect() << endl;
114
115 cout << "----------------------------------------------------" << endl;
116 cout << "...Testing filter and integrate !" << endl;
117
118 cout << " BBSF nolog " << myBB.filteredIntegratedFlux(mySF,200.,400.) << endl;
119 cout << " BBSF log " << myBB.filteredLogIntFlux(mySF,200.,400.) << endl;
120 cout << "full integration no log " << myBB.integratedFlux(200.,400.) << endl;
121 cout << "full integration log " << myBB.logIntegratedFlux(200.,400.) << endl;
122 cout << "SF" << endl;
123 cout << "full integration no log " << mySF.IntegratedSpect(200.,400.) << endl;
124 cout << "full integration log " << mySF.logIntegratedSpect(200.,400.) << endl;
125
126 cout << " BBTF nolog " << myBB.filteredIntegratedFlux(myTF,200.,400.) << endl;
127 cout << " BBTF log " << myBB.filteredLogIntFlux(myTF,200.,400.) << endl;
128 cout << "TF" << endl;
129 cout << "full integration no log " << myTF.IntegratedSpect(200.,400.) << endl;
130 cout << "full integration log " << myTF.logIntegratedSpect(200.,400.) << endl;
131
132 /*
133 cout << " SZSF nolog " << mySZ.filteredIntegratedFlux(mySF,30.,100.) << endl;
134 cout << " SZSF log " << mySZ.filteredLogIntFlux(mySF,30.,100.) << endl;
135 cout << "full integration no log " << mySZ.integratedFlux(30.,100.) << endl;
136 cout << "full integration log " << mySZ.logIntegratedFlux(30.,100.) << endl;
137
138 cout << " SZTF nolog " << mySZ.filteredIntegratedFlux(myTF,30.,100.) << endl;
139 cout << " SZTF log " << mySZ.filteredLogIntFlux(myTF,30.,100.) << endl;
140 */
141 cout << "********" << endl;
142 double min, max;
143 min=232;
144 max=235;
145
146 cout << " RSVSF nolog " << myRSV.filteredIntegratedFlux(mySF,min,max) << endl;
147 cout << " RSVSF log " << myRSV.filteredLogIntFlux(mySF,min,max) << endl;
148 cout << "full integration no log " << myRSV.integratedFlux(230.,500.) << endl;
149 cout << "full integration log " << myRSV.logIntegratedFlux(230.,500.) << endl;
150 cout << "full integration no log min max " << myRSV.integratedFlux(min,max) << endl;
151 cout << "full integration log min max " << myRSV.logIntegratedFlux(min,max) << endl;
152
153 cout << " RSVTF nolog " << myRSV.filteredIntegratedFlux(myTF,230.,500.) << endl;
154 cout << " RSVTF log " << myRSV.filteredLogIntFlux(myTF,230.,500.) << endl;
155
156// cout << "New TESTS USING IOBJS!" << endl;
157// POutPersist out("out");
158// TriangleFilter* myTF2 = new TriangleFilter(10,200,20,40);
159// SR_WriteSelf(myTF2,out);
160
161// POutPersist outV("outV");
162// cout << "check before anything" << vecOfNu.NElts()<< endl;
163// SpecRespVec* mySRV2 = new SpecRespVec(vecOfNu, vecOfFDeNu);
164// SR_WriteSelf(mySRV2,outV);
165
166// Vector myVec(10);
167// myVec.ReSize(10);
168// cout << myVec.NElts();
169// return 1;
170
171 cout << "read and write things in file...ppersist!" << endl;
172 TriangleFilter myTF2(10,200,20,40);
173// PInPersist inTF("outTF");
174// myTF2.ReadSelf(inTF);
175
176 { // Test IO PPF GaussianFilter
177 cout << " Writing GaussianFilter gf(276., 39.6, 0.794, 27., 690.) to PPF " << endl;
178 GaussianFilter gf(276., 39.6, 0.794, 27., 690.);
179 POutPersist s("fgauss.ppf");
180 s << gf ;
181 }
182 {
183 cout << " Reading GaussianFilter from PPF " << endl;
184 PInPersist s("fgauss.ppf");
185 GaussianFilter gf2;
186 s >> gf2;
187 cout << gf2 << endl;
188 }
189
190}
Note: See TracBrowser for help on using the repository browser.