source: Sophya/trunk/SophyaLib/SkyT/easyTest.cc@ 668

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

Ajout de classes deleguees PPersist et correction integration - Sophie 29/11/99

File size: 6.7 KB
RevLine 
[601]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 "trianglefilt.h"
[668]8
9#include "iobjspecresp.cc"
10
[601]11int
12main()
13{
[668]14// PInPersist in("out");
15// SR_ReadSelf(in);
16// cout << " " << endl;
17
18 PInPersist in2("outTF");
19 SR_ReadSelf(in2);
20 cout << " " << endl;
21
[601]22 cout << "BlackBody!" << endl;
[668]23 BlackBody myBB(2.73);
24 double freqmin = 230.;
25 double freqmax = 500;
[601]26 double logIF = myBB.logIntegratedFlux(freqmin,freqmax);
27 double IF = myBB.integratedFlux(freqmin,freqmax);
28 cout << "log " << logIF << endl;
29 cout << "nolog " << IF << endl;
30 cout << "min et max " << myBB.minFreq() << " :: " << myBB.maxFreq() << endl;
[668]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;
[601]35
36 cout << "squareFilter " << endl;
[668]37 SquareFilter mySF(200,600);
[601]38 double logSF = mySF.logIntegratedSpect(freqmin,freqmax);
39 double SF = mySF.IntegratedSpect(freqmin,freqmax);
40 cout << "log " << logSF << endl;
41 cout << "nolog " << SF << endl;
42 cout << "min et max " << mySF.minFreq() << " :: " << mySF.maxFreq() << endl;
[668]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;
[601]47
[668]48
[601]49 cout << "triangleFilter" << endl;
[668]50 TriangleFilter myTF(200,500,120,40);
[601]51 double logTF = myTF.logIntegratedSpect(10.,freqmax);
52 double TF = myTF.IntegratedSpect(10.,freqmax);
53 cout << "log " << logTF << endl;
54 cout << "nolog " << TF << endl;
55 cout << "min et max " << myTF.minFreq() << " :: " << myTF.maxFreq() << endl;
56 cout << "full integration no log " << myTF.IntegratedSpect() << endl;
57 cout << "full integration log " << myTF.logIntegratedSpect() << endl;
58
59 cout << "....Testing RadSpectraVec..." << endl;
60 int maxVal = 10;
61 Vector vecOfNu(maxVal);
62 Vector vecOfFDeNu(maxVal);
63 for (int i=0; i<maxVal; i++)
64 {
[668]65 vecOfNu(i) = (double)i+230.;
[601]66 vecOfFDeNu(i) = 1.; //*(double)i+1;
67 cout << "entry values " << vecOfNu(i) << " " << vecOfFDeNu(i) << endl;
68 }
[668]69 freqmin = 200.;
70 freqmax = 259.;
[601]71 RadSpectraVec myRSV(vecOfNu, vecOfFDeNu);
72 double RSV = myRSV.integratedFlux(freqmin,freqmax);
73
74 double logRSV = myRSV.logIntegratedFlux(freqmin,freqmax);
75 cout << "nolog int " << RSV << endl;
76 cout << "log int " << logRSV << endl;
77 cout << "min et max " << myRSV.minFreq() << " :: " << myRSV.maxFreq() << endl;
78 cout << "full integration no log " << myRSV.integratedFlux() << endl;
79 cout << "full integration log " << myRSV.logIntegratedFlux() << endl;
80
81 cout << "....Testing SpecRespVec..." << endl;
82 int SRVmaxVal = 100;
83 Vector vecOfNuRSV(SRVmaxVal);
84 Vector vecOfFDeNuRSV(SRVmaxVal);
85 for (int i=0; i<SRVmaxVal; i++)
86 {
[668]87 vecOfNuRSV(i) = (double)i+130.;
[601]88 vecOfFDeNuRSV(i) = 10*(double)i+1;
89 // cout << "entry values " << vecOfNuRSV(i) << " " << vecOfFDeNuRSV(i) << endl;
90 }
91 freqmin = vecOfNuRSV(0);
92 freqmax = vecOfNuRSV(SRVmaxVal-1);
93 SpecRespVec mySRV(vecOfNuRSV, vecOfFDeNuRSV);
94 double SRV = mySRV.IntegratedSpect(freqmin,freqmax);
95 double logSRV = mySRV.logIntegratedSpect(freqmin,freqmax);
96 cout << "nolog " << SRV << endl;
97 cout << "log " << logSRV << endl;
98 cout << "min et max " << mySRV.minFreq() << " :: " << mySRV.maxFreq() << endl;
99 cout << "full integration no log " << mySRV.IntegratedSpect() << endl;
100 cout << "full integration log " << mySRV.logIntegratedSpect() << endl;
101
102 cout << "----------------------------------------------------" << endl;
103 cout << "...Testing filter and integrate !" << endl;
104
[668]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;
[601]109 cout << "SF" << endl;
[668]110 cout << "full integration no log " << mySF.IntegratedSpect(200.,400.) << endl;
111 cout << "full integration log " << mySF.logIntegratedSpect(200.,400.) << endl;
[601]112
[668]113 cout << " BBTF nolog " << myBB.filteredIntegratedFlux(myTF,200.,400.) << endl;
114 cout << " BBTF log " << myBB.filteredLogIntFlux(myTF,200.,400.) << endl;
[601]115 cout << "TF" << endl;
[668]116 cout << "full integration no log " << myTF.IntegratedSpect(200.,400.) << endl;
117 cout << "full integration log " << myTF.logIntegratedSpect(200.,400.) << endl;
[601]118
119 /*
120 cout << " SZSF nolog " << mySZ.filteredIntegratedFlux(mySF,30.,100.) << endl;
121 cout << " SZSF log " << mySZ.filteredLogIntFlux(mySF,30.,100.) << endl;
122 cout << "full integration no log " << mySZ.integratedFlux(30.,100.) << endl;
123 cout << "full integration log " << mySZ.logIntegratedFlux(30.,100.) << endl;
124
125 cout << " SZTF nolog " << mySZ.filteredIntegratedFlux(myTF,30.,100.) << endl;
126 cout << " SZTF log " << mySZ.filteredLogIntFlux(myTF,30.,100.) << endl;
127 */
128 cout << "********" << endl;
[668]129 double min, max;
130 min=232;
131 max=235;
[601]132
[668]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;
[601]142
[668]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);
[601]147
[668]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);
164
165
[601]166}
Note: See TracBrowser for help on using the repository browser.