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

Last change on this file since 761 was 761, checked in by ansari, 26 years ago

Creation du module PMixer (programmes du SkyMixer) suite a la reorganisation

Reza 2/3/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 for (int i=0; i<maxVal; i++)
60 {
61 vecOfNu(i) = (double)i+230.;
62 vecOfFDeNu(i) = 1.; //*(double)i+1;
63 cout << "entry values " << vecOfNu(i) << " " << vecOfFDeNu(i) << endl;
64 }
65 freqmin = 200.;
66 freqmax = 259.;
67 RadSpectraVec myRSV(vecOfNu, vecOfFDeNu);
68 double RSV = myRSV.integratedFlux(freqmin,freqmax);
69
70 double logRSV = myRSV.logIntegratedFlux(freqmin,freqmax);
71 cout << "nolog int " << RSV << endl;
72 cout << "log int " << logRSV << endl;
73 cout << "min et max " << myRSV.minFreq() << " :: " << myRSV.maxFreq() << endl;
74 cout << "full integration no log " << myRSV.integratedFlux() << endl;
75 cout << "full integration log " << myRSV.logIntegratedFlux() << endl;
76
77 cout << "....Testing SpecRespVec..." << endl;
78 int SRVmaxVal = 100;
79 Vector vecOfNuRSV(SRVmaxVal);
80 Vector vecOfFDeNuRSV(SRVmaxVal);
81 for (int i=0; i<SRVmaxVal; i++)
82 {
83 vecOfNuRSV(i) = (double)i+130.;
84 vecOfFDeNuRSV(i) = 10*(double)i+1;
85 // cout << "entry values " << vecOfNuRSV(i) << " " << vecOfFDeNuRSV(i) << endl;
86 }
87 freqmin = vecOfNuRSV(0);
88 freqmax = vecOfNuRSV(SRVmaxVal-1);
89 SpecRespVec mySRV(vecOfNuRSV, vecOfFDeNuRSV);
90
91// Test ecriture en PPF
92 {
93 cout << " Writing mySRV (RadSpecVec to PPF " << endl;
94 POutPersist s("srvec.ppf");
95 s << mySRV;
96 }
97 {
98 cout << " Reading mySRV from PPF " << endl;
99 PInPersist s("srvec.ppf");
100 SpecRespVec srv;
101 s >> srv;
102 cout << srv;
103 }
104
105 double SRV = mySRV.IntegratedSpect(freqmin,freqmax);
106 double logSRV = mySRV.logIntegratedSpect(freqmin,freqmax);
107 cout << "nolog " << SRV << endl;
108 cout << "log " << logSRV << endl;
109 cout << "min et max " << mySRV.minFreq() << " :: " << mySRV.maxFreq() << endl;
110 cout << "full integration no log " << mySRV.IntegratedSpect() << endl;
111 cout << "full integration log " << mySRV.logIntegratedSpect() << endl;
112
113 cout << "----------------------------------------------------" << endl;
114 cout << "...Testing filter and integrate !" << endl;
115
116 cout << " BBSF nolog " << myBB.filteredIntegratedFlux(mySF,200.,400.) << endl;
117 cout << " BBSF log " << myBB.filteredLogIntFlux(mySF,200.,400.) << endl;
118 cout << "full integration no log " << myBB.integratedFlux(200.,400.) << endl;
119 cout << "full integration log " << myBB.logIntegratedFlux(200.,400.) << endl;
120 cout << "SF" << endl;
121 cout << "full integration no log " << mySF.IntegratedSpect(200.,400.) << endl;
122 cout << "full integration log " << mySF.logIntegratedSpect(200.,400.) << endl;
123
124 cout << " BBTF nolog " << myBB.filteredIntegratedFlux(myTF,200.,400.) << endl;
125 cout << " BBTF log " << myBB.filteredLogIntFlux(myTF,200.,400.) << endl;
126 cout << "TF" << endl;
127 cout << "full integration no log " << myTF.IntegratedSpect(200.,400.) << endl;
128 cout << "full integration log " << myTF.logIntegratedSpect(200.,400.) << endl;
129
130 /*
131 cout << " SZSF nolog " << mySZ.filteredIntegratedFlux(mySF,30.,100.) << endl;
132 cout << " SZSF log " << mySZ.filteredLogIntFlux(mySF,30.,100.) << endl;
133 cout << "full integration no log " << mySZ.integratedFlux(30.,100.) << endl;
134 cout << "full integration log " << mySZ.logIntegratedFlux(30.,100.) << endl;
135
136 cout << " SZTF nolog " << mySZ.filteredIntegratedFlux(myTF,30.,100.) << endl;
137 cout << " SZTF log " << mySZ.filteredLogIntFlux(myTF,30.,100.) << endl;
138 */
139 cout << "********" << endl;
140 double min, max;
141 min=232;
142 max=235;
143
144 cout << " RSVSF nolog " << myRSV.filteredIntegratedFlux(mySF,min,max) << endl;
145 cout << " RSVSF log " << myRSV.filteredLogIntFlux(mySF,min,max) << endl;
146 cout << "full integration no log " << myRSV.integratedFlux(230.,500.) << endl;
147 cout << "full integration log " << myRSV.logIntegratedFlux(230.,500.) << endl;
148 cout << "full integration no log min max " << myRSV.integratedFlux(min,max) << endl;
149 cout << "full integration log min max " << myRSV.logIntegratedFlux(min,max) << endl;
150
151 cout << " RSVTF nolog " << myRSV.filteredIntegratedFlux(myTF,230.,500.) << endl;
152 cout << " RSVTF log " << myRSV.filteredLogIntFlux(myTF,230.,500.) << endl;
153
154// cout << "New TESTS USING IOBJS!" << endl;
155// POutPersist out("out");
156// TriangleFilter* myTF2 = new TriangleFilter(10,200,20,40);
157// SR_WriteSelf(myTF2,out);
158
159// POutPersist outV("outV");
160// cout << "check before anything" << vecOfNu.NElts()<< endl;
161// SpecRespVec* mySRV2 = new SpecRespVec(vecOfNu, vecOfFDeNu);
162// SR_WriteSelf(mySRV2,outV);
163
164// Vector myVec(10);
165// myVec.ReSize(10);
166// cout << myVec.NElts();
167// return 1;
168
169 cout << "read and write things in file...ppersist!" << endl;
170 TriangleFilter myTF2(10,200,20,40);
171// PInPersist inTF("outTF");
172// myTF2.ReadSelf(inTF);
173
174 { // Test IO PPF GaussianFilter
175 cout << " Writing GaussianFilter gf(276., 39.6, 0.794, 27., 690.) to PPF " << endl;
176 GaussianFilter gf(276., 39.6, 0.794, 27., 690.);
177 POutPersist s("fgauss.ppf");
178 s << gf ;
179 }
180 {
181 cout << " Reading GaussianFilter from PPF " << endl;
182 PInPersist s("fgauss.ppf");
183 GaussianFilter gf2;
184 s >> gf2;
185 cout << gf2 << endl;
186 }
187
188}
Note: See TracBrowser for help on using the repository browser.