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

Last change on this file since 928 was 833, checked in by ansari, 25 years ago

Compil SGI-CC (Pb for(int i; i redeclare)) Reza 7/4/2000

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