[1478] | 1 | /* Test de processeurs ds simtoipr.cc - Reza Avril 2001
|
---|
| 2 |
|
---|
| 3 | ---------------- Exemple d'appel ---------------------
|
---|
[1484] | 4 | csh> simtst -start 104385384 -end 104399964 -range -500,500 \
|
---|
| 5 | -intoi boloMuV_26 -wtoi 8192 -wdegli 1024 \
|
---|
| 6 | inputbolo.fits filt.fits xx.ppf
|
---|
| 7 | # Avec Filtre de Fourier
|
---|
| 8 | csh> simtst -start 104385384 -end 104399964 -range -500,500 \
|
---|
| 9 | -intoi boloMuV_26 -wtoi 8192 -wdegli 1024 \
|
---|
| 10 | -wfft 4096 -keepfft 5 -killfreq 15,4,2.5 \
|
---|
| 11 | inputbolo.fits filtfft.fits spectre.ppf
|
---|
| 12 | # Autre exemple b545k02
|
---|
| 13 | cool> ./simtst -start 104389122 -end 104649122 -range -1000.,1000. -intoi boloMu
|
---|
| 14 | V_23 -wtoi 8192 -wdegli 1024 -wfft 4096 -keepfft 5 -killfreq 15,4,2.5 Cmv/b545k02
|
---|
| 15 | 2_16.00_16.49.fits b545.fits b545.ppf
|
---|
| 16 |
|
---|
[1478] | 17 | */
|
---|
| 18 |
|
---|
| 19 |
|
---|
| 20 |
|
---|
[1462] | 21 | #include "machdefs.h"
|
---|
[1468] | 22 | #include <math.h>
|
---|
[1462] | 23 | #include "array.h"
|
---|
[1442] | 24 | #include <unistd.h>
|
---|
| 25 | #include <stdexcept>
|
---|
| 26 | #include "toi.h"
|
---|
| 27 | #include "toiprocessor.h"
|
---|
| 28 | #include "fitstoirdr.h"
|
---|
| 29 | #include "fitstoiwtr.h"
|
---|
| 30 | #include "toisqfilter.h"
|
---|
| 31 | #include "toimanager.h"
|
---|
| 32 | #include "simtoipr.h"
|
---|
[1500] | 33 | #include "nooppr.h"
|
---|
[1442] | 34 | #include "toiseqbuff.h"
|
---|
| 35 | #include "timing.h"
|
---|
| 36 | #include "sambainit.h"
|
---|
| 37 |
|
---|
| 38 | void Usage(bool fgerr)
|
---|
| 39 | {
|
---|
| 40 | cout << endl;
|
---|
| 41 | if (fgerr) {
|
---|
[1484] | 42 | cout << " simtst : Argument Error ! simtst -h for usage " << endl;
|
---|
[1442] | 43 | exit(1);
|
---|
| 44 | }
|
---|
| 45 | else {
|
---|
[1484] | 46 | cout << "\n Usage : simtst [-intoi toiname] [-start snb] [-end sne] \n"
|
---|
| 47 | << " [-dbg] [-wtoi sz] [-wdegli sz] [-range min,max] \n"
|
---|
[1500] | 48 | << " [-degli ns,ns2,mxpt,mnpt,wrec] [-gfilt wsz,sigma] \n"
|
---|
| 49 | << " [-wfft sz] [-keepfft n] [-killfreq bf,nharm,sigf] \n"
|
---|
| 50 | << " [-nooutflg] [-nowrtms] [-nowrticd] \n"
|
---|
[1483] | 51 | << " inFitsName outFitsName outPPFName \n"
|
---|
[1442] | 52 | << " -dbg : sets TOISeqBuffered debug level to 1 \n"
|
---|
| 53 | << " -start snb : sets the start sample num \n"
|
---|
| 54 | << " -end sne : sets the end sample num \n"
|
---|
[1454] | 55 | << " -range min,max : sets the acceptable range for intoi \n"
|
---|
| 56 | << " default= -16000,16000\n"
|
---|
[1467] | 57 | << " -intoi toiName : select input TOI name (def boloMuV_27)\n"
|
---|
| 58 | << " -wtoi sz : sets TOISeqBuff buffer size (def= 8192)\n"
|
---|
| 59 | << " -wdegli sz : sets deglitcher window size (def= 512) \n"
|
---|
[1500] | 60 | << " -degli ns,ns2,maxnpt,minnpt,wrec : sets deglitcher parameters\n"
|
---|
| 61 | << " -gfilt wsz,sigma : Gaussian filter window size and sigma\n"
|
---|
[1479] | 62 | << " -wfft sz : Activate Fourier filter and sets its width \n"
|
---|
| 63 | << " -keepfft n : Keeps n spectra (if Fourier filter activated) \n"
|
---|
[1484] | 64 | << " -killfreq bf,nharm,sigf : kills nharm frequency, basefreq=bf \n"
|
---|
[1500] | 65 | << " with a gaussian with width=sigf \n"
|
---|
| 66 | << " -nooutflg : Don't write flags to output FITS \n"
|
---|
| 67 | << " -nowrtms : Don't write mean/sigma TOI's \n"
|
---|
| 68 | << " -nowrticd : Don't write incopie,degli,deglioffset TOI's \n"
|
---|
[1442] | 69 | << endl;
|
---|
| 70 | }
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | int main(int narg, char** arg) {
|
---|
| 74 |
|
---|
| 75 | if ((narg > 1) && (strcmp(arg[1],"-h") == 0) ) Usage(false);
|
---|
| 76 |
|
---|
| 77 | cout << "simtst starting - Decoding arguments " << " narg=" << narg << endl;
|
---|
| 78 |
|
---|
| 79 | bool fgdbg = false;
|
---|
[1483] | 80 | bool fgsetstart = false;
|
---|
[1479] | 81 | int wtoi = 8192;
|
---|
| 82 | int wdegli = 512;
|
---|
[1500] | 83 |
|
---|
[1479] | 84 | int wfft = 4096;
|
---|
| 85 | int keepfft = 0;
|
---|
[1442] | 86 | int nmax = 10;
|
---|
[1483] | 87 | int istart = 0;
|
---|
[1442] | 88 | int iend = 0;
|
---|
[1501] | 89 | int_8 dns_print = 1000;
|
---|
| 90 | int dns_print_fac = 50;
|
---|
| 91 | int nbmax_dns_print = 2;
|
---|
| 92 |
|
---|
[1454] | 93 | double range_min = -16000;
|
---|
| 94 | double range_max = 16000.;
|
---|
[1500] | 95 |
|
---|
| 96 | // Deglitcher parameters
|
---|
| 97 | double degli_ns1 = 3.;
|
---|
| 98 | double degli_ns2 = 1.5;
|
---|
| 99 | int degli_minnpt = 2;
|
---|
| 100 | int degli_maxnpt = 4;
|
---|
| 101 | int degli_wrec = 10;
|
---|
| 102 |
|
---|
| 103 | // Gaussian filter parameters
|
---|
| 104 | int gfilt_wsz = 16;
|
---|
| 105 | double gfilt_sigma = 2.;
|
---|
| 106 |
|
---|
| 107 | // File names
|
---|
[1442] | 108 | string infile;
|
---|
| 109 | string outfile;
|
---|
[1483] | 110 | string outppfname;
|
---|
[1467] | 111 | string intoi = "boloMuV_27";
|
---|
[1500] | 112 |
|
---|
| 113 | bool fg_wrtflag = true;
|
---|
| 114 | bool fg_nowrtms = false;
|
---|
| 115 | bool fg_nowrticd = false;
|
---|
| 116 |
|
---|
| 117 |
|
---|
[1479] | 118 | bool fg_f_filt = false;
|
---|
[1484] | 119 | bool fg_killfreq = false;
|
---|
| 120 | int bf_killfreq = 1;
|
---|
| 121 | int nharm_killfreq = 1;
|
---|
| 122 | double sigf_killfreq = 1.;
|
---|
[1442] | 123 |
|
---|
| 124 | if (narg < 4) Usage(true);
|
---|
| 125 | int ko=1;
|
---|
| 126 | // decoding arguments
|
---|
| 127 | for(int ia=1; ia<narg; ia++) {
|
---|
| 128 | if (strcmp(arg[ia],"-start") == 0) {
|
---|
| 129 | if (ia == narg-1) Usage(true); // -start est suivi d'un argument
|
---|
| 130 | istart = atoi(arg[ia+1]); ia++;
|
---|
[1483] | 131 | fgsetstart = true;
|
---|
[1442] | 132 | }
|
---|
| 133 | else if (strcmp(arg[ia],"-end") == 0) {
|
---|
| 134 | if (ia == narg-1) Usage(true);
|
---|
| 135 | iend = atoi(arg[ia+1]); ia++;
|
---|
| 136 | }
|
---|
[1467] | 137 | else if (strcmp(arg[ia],"-wtoi") == 0) {
|
---|
[1442] | 138 | if (ia == narg-1) Usage(true);
|
---|
[1479] | 139 | wtoi = atoi(arg[ia+1]); ia++;
|
---|
[1442] | 140 | }
|
---|
[1467] | 141 | else if (strcmp(arg[ia],"-wdegli") == 0) {
|
---|
[1442] | 142 | if (ia == narg-1) Usage(true);
|
---|
[1479] | 143 | wdegli = atoi(arg[ia+1]); ia++;
|
---|
[1442] | 144 | }
|
---|
[1500] | 145 | else if (strcmp(arg[ia],"-degli") == 0) {
|
---|
| 146 | if (ia == narg-1) Usage(true);
|
---|
| 147 | sscanf(arg[ia+1],"%lf,%lf,%d,%d,%d", °li_ns1, °li_ns2,
|
---|
| 148 | °li_maxnpt, °li_minnpt, °li_wrec);
|
---|
| 149 | ia++;
|
---|
| 150 | }
|
---|
| 151 | else if (strcmp(arg[ia],"-gfilt") == 0) {
|
---|
| 152 | if (ia == narg-1) Usage(true);
|
---|
| 153 | sscanf(arg[ia+1],"%d,%lf", &gfilt_wsz, &gfilt_sigma);
|
---|
| 154 | ia++;
|
---|
| 155 | }
|
---|
[1479] | 156 | else if (strcmp(arg[ia],"-wfft") == 0) {
|
---|
| 157 | if (ia == narg-1) Usage(true);
|
---|
| 158 | wfft = atoi(arg[ia+1]); ia++;
|
---|
| 159 | fg_f_filt = true;
|
---|
| 160 | }
|
---|
| 161 | else if (strcmp(arg[ia],"-keepfft") == 0) {
|
---|
| 162 | if (ia == narg-1) Usage(true);
|
---|
| 163 | keepfft = atoi(arg[ia+1]); ia++;
|
---|
| 164 | }
|
---|
[1484] | 165 | else if (strcmp(arg[ia],"-killfreq") == 0) {
|
---|
| 166 | if (ia == narg-1) Usage(true);
|
---|
| 167 | sscanf(arg[ia+1],"%d,%d,%lf",&bf_killfreq, &nharm_killfreq, &sigf_killfreq);
|
---|
| 168 | fg_killfreq = true;
|
---|
| 169 | ia++;
|
---|
| 170 | }
|
---|
[1454] | 171 | else if (strcmp(arg[ia],"-range") == 0) {
|
---|
| 172 | if (ia == narg-1) Usage(true);
|
---|
| 173 | sscanf(arg[ia+1],"%lf,%lf",&range_min, &range_max);
|
---|
| 174 | ia++;
|
---|
| 175 | }
|
---|
| 176 | else if (strcmp(arg[ia],"-intoi") == 0) {
|
---|
| 177 | if (ia == narg-1) Usage(true);
|
---|
| 178 | intoi = arg[ia+1]; ia++;
|
---|
| 179 | }
|
---|
[1442] | 180 | else if (strcmp(arg[ia],"-dbg") == 0) fgdbg = true;
|
---|
[1500] | 181 | else if (strcmp(arg[ia],"-nooutflg") == 0) fg_wrtflag = false;
|
---|
| 182 | else if (strcmp(arg[ia],"-nowrtms") == 0) fg_nowrtms = true;
|
---|
| 183 | else if (strcmp(arg[ia],"-nowrticd") == 0) fg_nowrticd = true;
|
---|
[1442] | 184 |
|
---|
| 185 | else { ko = ia; break; } // Debut des noms
|
---|
| 186 | }
|
---|
| 187 |
|
---|
[1479] | 188 | if (iend < istart) iend = istart+wtoi*(nmax+5);
|
---|
[1483] | 189 | if ((narg-ko) < 3) Usage(true);
|
---|
[1442] | 190 | infile = arg[ko];
|
---|
| 191 | outfile = arg[ko+1];
|
---|
[1483] | 192 | outppfname = arg[ko+2];
|
---|
[1442] | 193 |
|
---|
| 194 | cout << " Initializing SOPHYA ... " << endl;
|
---|
| 195 | SophyaInit();
|
---|
| 196 | InitTim();
|
---|
| 197 |
|
---|
[1484] | 198 | cout << ">>>> simtst: Infile= " << infile << " outFile="
|
---|
[1479] | 199 | << outfile << endl;
|
---|
| 200 | cout << ">>>> Window Size WTOI= " << wtoi << " WDEGLI= " << wdegli
|
---|
[1442] | 201 | << " iStart= " << istart << " iEnd= " << iend << endl;
|
---|
[1454] | 202 | cout << ">>>> InTOIName= " << intoi << endl;
|
---|
[1479] | 203 |
|
---|
[1442] | 204 | try {
|
---|
| 205 | TOIManager* mgr = TOIManager::getManager();
|
---|
| 206 |
|
---|
| 207 | // mgr->setRequestedSample(11680920,11710584);
|
---|
| 208 | // mgr->setRequestedSample(104121000, 104946120);
|
---|
[1501] | 209 | if (fgsetstart) {
|
---|
[1483] | 210 | mgr->setRequestedSample(istart, iend);
|
---|
[1501] | 211 | dns_print = (iend-istart)/dns_print_fac;
|
---|
| 212 | if (dns_print < 1000) dns_print = 1000;
|
---|
| 213 | nbmax_dns_print = (iend-istart)/dns_print;
|
---|
| 214 | }
|
---|
[1442] | 215 | // FITSTOIReader r("/data/Archeops/bolo11.fits);
|
---|
| 216 | FITSTOIReader r(infile);
|
---|
| 217 | cout << "reader created" << endl;
|
---|
| 218 | // FITSTOIWriter w("/data/Archeops/rz.fits");
|
---|
| 219 | FITSTOIWriter w(outfile);
|
---|
| 220 | cout << "fits writer created" << endl;
|
---|
| 221 |
|
---|
| 222 |
|
---|
[1479] | 223 | int w1 = wtoi;
|
---|
[1491] | 224 | int w2 = (fg_f_filt) ? wfft+3*w1 : w1;
|
---|
[1479] | 225 |
|
---|
[1454] | 226 | // char * colname[5] = {"MJD", "UTC","boloMuV_11","magnFlux","pivot"};
|
---|
[1442] | 227 | TOISeqBuffered * toiin = new TOISeqBuffered("f2in", w1);
|
---|
| 228 | if (fgdbg) toiin->setDebugLevel(1);
|
---|
[1467] | 229 | TOISeqBuffered * toidegli = new TOISeqBuffered("degli", w1);
|
---|
| 230 | if (fgdbg) toidegli->setDebugLevel(1);
|
---|
[1442] | 231 | TOISeqBuffered * toimean = new TOISeqBuffered("mean", w1);
|
---|
| 232 | if (fgdbg) toimean->setDebugLevel(1);
|
---|
[1479] | 233 | TOISeqBuffered * toisig = new TOISeqBuffered("sigma", w2);
|
---|
[1442] | 234 | if (fgdbg) toisig->setDebugLevel(1);
|
---|
[1483] | 235 | TOISeqBuffered * toiincopie = new TOISeqBuffered("incopie", w2);
|
---|
[1443] | 236 | if (fgdbg) toiincopie->setDebugLevel(1);
|
---|
[1442] | 237 |
|
---|
| 238 |
|
---|
| 239 |
|
---|
| 240 | // Connecting TOI to FITSTOIReader Processor
|
---|
| 241 | // for(kk=0; kk<5; kk++) {
|
---|
| 242 | // r.addOutput(colname[kk], toitab[kk]);
|
---|
| 243 | // }
|
---|
| 244 |
|
---|
[1454] | 245 | // int kk = 2;
|
---|
| 246 | r.addOutput(intoi, toiin);
|
---|
[1442] | 247 | // toi->dbg=true;
|
---|
| 248 | // r.addOutput("boloMuV_11", toi);
|
---|
| 249 | cout << " connecting in/out to RzTOIProcessor ... " << endl;
|
---|
| 250 |
|
---|
| 251 | // TOIProcessor * filt = NULL;
|
---|
| 252 |
|
---|
| 253 | cout << " Creating SimpleDeglitcher() " << endl;
|
---|
[1479] | 254 | SimpleDeglitcher degl(wdegli);
|
---|
[1500] | 255 | degl.SetDetectionParam(degli_ns1, degli_ns2, degli_maxnpt,
|
---|
| 256 | degli_minnpt, degli_wrec);
|
---|
| 257 |
|
---|
[1454] | 258 | cout << " Setting Range for deglitcher: " << range_min
|
---|
| 259 | << " - " << range_max << endl;
|
---|
[1479] | 260 |
|
---|
[1454] | 261 | degl.SetRange(range_min, range_max);
|
---|
[1442] | 262 | degl.addInput("in", toiin);
|
---|
[1467] | 263 | degl.addOutput("out", toidegli);
|
---|
[1442] | 264 | degl.addOutput("mean", toimean);
|
---|
| 265 | degl.addOutput("sigma", toisig);
|
---|
[1443] | 266 | degl.addOutput("incopie", toiincopie);
|
---|
[1467] | 267 |
|
---|
| 268 | cout << " Creating a FanOut SimpleFanOut Object " << endl;
|
---|
| 269 | SimpleFanOut fanout(2,2);
|
---|
| 270 | TOISeqBuffered * toidegli0 = new TOISeqBuffered("degli0", w1);
|
---|
| 271 | if (fgdbg) toidegli0->setDebugLevel(1);
|
---|
[1479] | 272 | TOISeqBuffered * toidegli1 = new TOISeqBuffered("degli1", w2);
|
---|
[1442] | 273 |
|
---|
[1467] | 274 | TOISeqBuffered * toimean0 = new TOISeqBuffered("mean0", w1);
|
---|
| 275 | if (fgdbg) toimean0->setDebugLevel(1);
|
---|
[1479] | 276 | TOISeqBuffered * toimean1 = new TOISeqBuffered("mean1", w2);
|
---|
[1467] | 277 | if (fgdbg) toimean1->setDebugLevel(1);
|
---|
| 278 |
|
---|
| 279 | fanout.addInput("in0", toidegli);
|
---|
| 280 | fanout.addOutput("out0_0", toidegli0);
|
---|
| 281 | fanout.addOutput("out0_1", toidegli1);
|
---|
| 282 | fanout.addInput("in1", toimean);
|
---|
| 283 | fanout.addOutput("out1_0", toimean0);
|
---|
| 284 | fanout.addOutput("out1_1", toimean1);
|
---|
| 285 |
|
---|
| 286 | cout << " Creating an Adder SimpleAdder Object " << endl;
|
---|
| 287 | SimpleAdder adder(2);
|
---|
| 288 | adder.addInput("in0", toidegli0);
|
---|
| 289 | adder.addInput("in1", toimean0);
|
---|
| 290 | adder.SetGain(0, 1.);
|
---|
| 291 | adder.SetGain(1, -1.);
|
---|
| 292 | TOISeqBuffered * toideglioff = new TOISeqBuffered("deglioff", w1);
|
---|
| 293 | if (fgdbg) toideglioff->setDebugLevel(1);
|
---|
| 294 | adder.addOutput("out", toideglioff);
|
---|
| 295 |
|
---|
| 296 | cout << " Creating a GaussianFilter SimpleFilter Object " << endl;
|
---|
[1531] | 297 | double G_sigma = gfilt_sigma;
|
---|
[1468] | 298 | double G_a = 1./(G_sigma*sqrt(M_PI*2.));
|
---|
[1531] | 299 | SimpleFilter filt(gfilt_wsz, SimpleFilter::GaussFilter, G_a, G_sigma);
|
---|
[1467] | 300 |
|
---|
| 301 | filt.addInput("in", toideglioff);
|
---|
| 302 | TOISeqBuffered * toiout = new TOISeqBuffered("out", w1);
|
---|
| 303 | if (fgdbg) toiout->setDebugLevel(1);
|
---|
[1479] | 304 | TOISeqBuffered * toideglioffcopie = new TOISeqBuffered("deglioffcopie", w2);
|
---|
[1467] | 305 | if (fgdbg) toideglioffcopie->setDebugLevel(1);
|
---|
| 306 | filt.addOutput("out", toiout);
|
---|
| 307 | filt.addOutput("incopie", toideglioffcopie);
|
---|
| 308 |
|
---|
[1484] | 309 | Vector fcoef(wfft/2+1);
|
---|
| 310 | // fcoef = RegularSequence(1., -2./wfft);
|
---|
| 311 | fcoef = 1.;
|
---|
| 312 | for(int kfk=0; kfk<nharm_killfreq; kfk++) {
|
---|
| 313 | double cfreq = bf_killfreq*(kfk+1);
|
---|
| 314 | double xfreq = 0.;
|
---|
| 315 | for(int kfj=cfreq-3.*sigf_killfreq; kfj<= cfreq+3.*sigf_killfreq; kfj++) {
|
---|
| 316 | if ( (kfj < 0) || (kfj >= fcoef.Size() ) ) continue;
|
---|
| 317 | xfreq = (cfreq-kfj)/sigf_killfreq;
|
---|
[1531] | 318 | fcoef(kfj) -= exp(-xfreq*xfreq/2.0);
|
---|
[1484] | 319 | }
|
---|
| 320 | }
|
---|
[1479] | 321 | cout << " Creating Fourier Filter ... " << endl;
|
---|
| 322 | SimpleFourierFilter sfft(fcoef);
|
---|
[1483] | 323 | sfft.KeepSpectra(outppfname, keepfft);
|
---|
[1484] | 324 | sfft.ComputeMeanSpectra(true);
|
---|
[1479] | 325 | TOISeqBuffered * toifft = NULL;
|
---|
| 326 | TOISeqBuffered * toifiltcopie = NULL;
|
---|
| 327 |
|
---|
| 328 | if (fg_f_filt) {
|
---|
| 329 | cout << " Connecting Fourier Filter ... " << endl;
|
---|
| 330 | toifft = new TOISeqBuffered("fftout", w1);
|
---|
| 331 | toifiltcopie = new TOISeqBuffered("filtcopie", w1);
|
---|
| 332 | sfft.addInput("in",toiout);
|
---|
| 333 | sfft.addOutput("out", toifft);
|
---|
| 334 | sfft.addOutput("incopie", toifiltcopie);
|
---|
| 335 | }
|
---|
| 336 |
|
---|
[1467] | 337 | cout << " Connecting to output (FitsWriter) " << endl;
|
---|
| 338 |
|
---|
[1500] | 339 | w.setOutFlags(fg_wrtflag);
|
---|
| 340 |
|
---|
| 341 | // Pour connecter les lignes non connectees au FitsWriter
|
---|
| 342 | NoOpProcessor noop[3];
|
---|
| 343 |
|
---|
| 344 | if (fg_nowrticd) noop[0].addInput("in", toiincopie);
|
---|
| 345 | else w.addInput("in", toiincopie);
|
---|
| 346 |
|
---|
[1479] | 347 | if (fg_f_filt) {
|
---|
| 348 | w.addInput("filtout", toifiltcopie);
|
---|
| 349 | w.addInput("fftout", toifft);
|
---|
| 350 | }
|
---|
[1484] | 351 | else w.addInput("filtout", toiout);
|
---|
[1442] | 352 |
|
---|
[1500] | 353 | if (fg_nowrticd) {
|
---|
| 354 | noop[1].addInput("in", toidegli1);
|
---|
| 355 | noop[1].addInput("in2", toideglioffcopie);
|
---|
| 356 | }
|
---|
| 357 | else {
|
---|
| 358 | w.addInput("degli", toidegli1);
|
---|
| 359 | w.addInput("deglioff", toideglioffcopie);
|
---|
| 360 | }
|
---|
| 361 | if (fg_nowrtms) {
|
---|
| 362 | noop[2].addInput("in", toimean1);
|
---|
| 363 | noop[2].addInput("in2", toisig);
|
---|
| 364 | }
|
---|
| 365 | else {
|
---|
| 366 | w.addInput("mean", toimean1);
|
---|
| 367 | w.addInput("sigma", toisig);
|
---|
| 368 | }
|
---|
| 369 |
|
---|
[1442] | 370 | cout << " ------ FITSReaderTOI::PrintStatus() : ----- " << endl;
|
---|
| 371 | r.PrintStatus(cout);
|
---|
[1467] | 372 | cout << " ------ FanOut::PrintStatus() : ----- " << endl;
|
---|
| 373 | fanout.PrintStatus(cout);
|
---|
| 374 | cout << " ------ Adder::PrintStatus() : ----- " << endl;
|
---|
| 375 | adder.PrintStatus(cout);
|
---|
| 376 | cout << " ------ Filter::PrintStatus() : ----- " << endl;
|
---|
| 377 | filt.PrintStatus(cout);
|
---|
[1442] | 378 | cout << "----- FITSWriterTOI::PrintStatus() : ----- " << endl;
|
---|
| 379 | w.PrintStatus(cout);
|
---|
| 380 |
|
---|
[1501] | 381 |
|
---|
| 382 |
|
---|
[1442] | 383 | PrtTim("starting threads");
|
---|
| 384 | r.start();
|
---|
| 385 | degl.start();
|
---|
[1467] | 386 | fanout.start();
|
---|
| 387 | adder.start();
|
---|
| 388 | filt.start();
|
---|
[1479] | 389 | if (fg_f_filt) sfft.start();
|
---|
[1442] | 390 | w.start();
|
---|
[1500] | 391 | if (fg_nowrticd) {
|
---|
| 392 | noop[0].start();
|
---|
| 393 | noop[1].start();
|
---|
| 394 | }
|
---|
| 395 | if (fg_nowrtms)
|
---|
| 396 | noop[2].start();
|
---|
[1442] | 397 |
|
---|
[1501] | 398 |
|
---|
| 399 | // ------------------- Impression continu de stat ------------------------
|
---|
| 400 | int_8 nb_dns_print = 0;
|
---|
| 401 | int nb_sleep = 0;
|
---|
| 402 | int_8 last_sample_count = 0;
|
---|
| 403 | int_8 processed_samples = 0;
|
---|
| 404 | int_8 total_sample_count = dns_print*nbmax_dns_print;
|
---|
| 405 | bool alldone = false;
|
---|
| 406 | while (!alldone) {
|
---|
| 407 | processed_samples = filt.ProcessedSampleCount();
|
---|
| 408 | if ( (processed_samples-last_sample_count > dns_print) ||
|
---|
| 409 | (processed_samples > total_sample_count-10) ) {
|
---|
| 410 | last_sample_count = processed_samples;
|
---|
| 411 | if (nb_dns_print == 0) cout << "\n";
|
---|
| 412 | nb_dns_print++;
|
---|
| 413 | cout << ">>> simtst/Info: ProcessedSampleCount()= " << last_sample_count
|
---|
| 414 | << " Frac done = " << processed_samples*100/total_sample_count << " %" << endl;
|
---|
| 415 | if (last_sample_count > total_sample_count-10) alldone = true;
|
---|
| 416 | nb_sleep = 0;
|
---|
| 417 | }
|
---|
| 418 | else if ((nb_sleep+1)%5 == 0)
|
---|
| 419 | cout << "> simtst/Info: ProcSamples()= " << processed_samples
|
---|
| 420 | << " Done = " << " %" << processed_samples*100/total_sample_count
|
---|
| 421 | << " NbSleep(1) = " << nb_sleep << endl;
|
---|
| 422 |
|
---|
| 423 | sleep(1); nb_sleep++;
|
---|
| 424 | }
|
---|
| 425 |
|
---|
| 426 | // -----------------------------------------------------------------------
|
---|
| 427 |
|
---|
[1467] | 428 | /*
|
---|
[1454] | 429 | for(int jj=0; jj<3; jj++) {
|
---|
| 430 | cout << *toiin;
|
---|
[1467] | 431 | cout << *toimean;
|
---|
| 432 | cout << *toimean1;
|
---|
[1454] | 433 | cout << *toiout;
|
---|
| 434 | sleep(1);
|
---|
| 435 | }
|
---|
| 436 | */
|
---|
| 437 |
|
---|
[1442] | 438 | mgr->joinAll();
|
---|
| 439 | PrtTim("End threads");
|
---|
| 440 |
|
---|
| 441 | // cout << " ------ FITSReaderTOI::PrintStatus() : ----- " << endl;
|
---|
| 442 | // r.PrintStatus(cout);
|
---|
| 443 | // cout << "----- FITSWriterTOI::PrintStatus() : ----- " << endl;
|
---|
| 444 | // w.PrintStatus(cout);
|
---|
| 445 |
|
---|
[1467] | 446 | cout << " ------ toiin, toidegli and toiout Status information ------- " << endl;
|
---|
[1442] | 447 | cout << *toiin;
|
---|
[1467] | 448 | cout << *toidegli;
|
---|
[1442] | 449 | cout << *toiout;
|
---|
[1491] | 450 | if (fg_f_filt) {
|
---|
| 451 | cout << *toisig;
|
---|
| 452 | cout << *toimean1;
|
---|
| 453 | }
|
---|
[1467] | 454 | cout << degl;
|
---|
| 455 | cout << filt;
|
---|
| 456 | cout << adder;
|
---|
[1479] | 457 | if (fg_f_filt) cout << sfft ;
|
---|
[1467] | 458 |
|
---|
[1442] | 459 | }
|
---|
| 460 | catch (PThrowable & exc) {
|
---|
[1500] | 461 | cerr << "\n simtst: Catched Exception \n" << (string)typeid(exc).name()
|
---|
[1442] | 462 | << " - Msg= " << exc.Msg() << endl;
|
---|
| 463 | }
|
---|
| 464 | catch (const std::exception & sex) {
|
---|
[1500] | 465 | cerr << "\n simtst: Catched std::exception \n"
|
---|
[1442] | 466 | << (string)typeid(sex).name() << endl;
|
---|
| 467 | }
|
---|
| 468 | catch (...) {
|
---|
[1500] | 469 | cerr << "\n simtst: some other exception was caught ! " << endl;
|
---|
[1442] | 470 | }
|
---|
| 471 |
|
---|
| 472 | return(0);
|
---|
| 473 | }
|
---|