source: Sophya/trunk/AddOn/TAcq/vismfib.cc@ 4015

Last change on this file since 4015 was 4015, checked in by ansari, 14 years ago

Validation/debug calcul de visibilites par tranches en temps, Reza, 08 Aout 2011

File size: 4.0 KB
Line 
1// Utilisation de SOPHYA pour faciliter les tests ...
2#include "sopnamsp.h"
3#include "machdefs.h"
4
5/* ----------------------------------------------------------
6 Programme de lecture / calcul de visibilite multi-canaux
7 BAORadio - LAL/IRFU R. Ansari, C. Magneville
8 V1 : Nov 2009
9 ---------------------------------------------------------- */
10
11// include standard c/c++
12#include <iostream>
13#include <string>
14#include <exception>
15
16// include sophya mesure ressource CPU/memoire ...
17#include "resusage.h"
18#include "ctimer.h"
19#include "timing.h"
20#include "timestamp.h"
21#include "strutilxx.h"
22#include "tarrinit.h"
23#include "histinit.h"
24
25#include "brpaqu.h"
26#include "brfitsrd.h"
27#include "brproc.h"
28#include "brviscalc.h"
29#include "brdiskw.h"
30
31#include "branap.h"
32
33
34
35//----------------------------------------------------
36//----------------------------------------------------
37int main(int narg, char* arg[])
38{
39
40 TArrayInitiator _inia;
41
42 int rc = 0;
43 try {
44 // Decodage parametres
45 BRAnaParam par;
46 cout << " ===> visimfib.cc: decoding command line arguments " << endl;
47 rc = par.DecodeArgs(narg, arg);
48 if (rc) return rc;
49 rc = par.PaqSizeFromFits();
50 if (rc) return rc;
51 par.Print(cout);
52 if ((par.action_!="cube3d")&&(par.action_!="vis")&&(par.action_!="viscktt")) {
53 cout << " !!! visimfib.cc BAD action = " << par.action_ << " possible values: vis,viscktt,cube3d" << endl;
54 return 5;
55 }
56
57 cout << " ---------- visimfib.cc Start - Action= " << par.action_ << " ------------- " << endl;
58 ResourceUsage resu;
59
60 BRPaquet paq(par.paqsize_);
61 uint_4 procsz=sizeof(float)*(paq.DataSize()+4);
62 if ((par.fgdatafft_)||(par.action_=="cube3d")) procsz = 0;
63 cout << " visimfib: Creating MemZoneMgr/processing threads - PaqSz= " << par.paqsize_
64 << " ProcPaqSz=" << procsz << endl;
65
66 RAcqMemZoneMgr mmgr(par.nzones_, par.dirlist_.size(), par.npaqinzone_, par.paqsize_, procsz);
67
68 BRMultiFitsReader reader(mmgr, par.dirlist_, par.rdsamefc_, par.imin_, par.imax_, par.istep_);
69 reader.SetPrintLevel(par.prtlevel_,par.prtmodulo_);
70
71 /* BRVisibilityCalculator proc(mmgr, par.outpath_, par.nmean_, par.nthreads_);
72 proc.SelectFreqBinning(par.freqmin_, par.freqmax_, par.nbinfreq_); */
73 BRVisCalcGroup procg(par.nbcalgrp_, mmgr, par.outpath_, par.nmean_, 0, 999999999, false, par.nthreads_);
74 procg.SelectFreqBinning(par.freqmin_, par.freqmax_, par.nbinfreq_);
75
76 if (par.action_ == "viscktt") procg.ActivateTimeTagCheck(par.TotalNPaquets());
77 if (par.fgfitsout_) procg.SetFitsOutput();
78 if (par.fgtimeinterval_) procg.SetTimeIntervalMode(par.timeinterval_);
79 procg.SetPrintLevel(par.prtlevel_,par.prtmodulo2_);
80 BRFFTCalculator procfft(mmgr, par.fgsinglechannel_);
81
82 // On determine MemZaction pour chaque processeur et le finalizemask en fonction du traitement demande
83 if (par.action_ == "cube3d") mmgr.SetFinalizedMask((uint_4)MemZS_Saved);
84 else {
85 MemZStatus mfmask=MemZS_ProcA;
86 if (par.fgdatafft_) mfmask=procg.SetMemZAction(MemZA_ProcA);
87 else {
88 mfmask=procg.SetMemZAction(MemZA_ProcB);
89 procg.SetRawData();
90 }
91 mmgr.SetFinalizedMask((uint_4)mfmask);
92 }
93
94 FitsCubeWriter wrt(mmgr, par.outpath_, par.nbloc_);
95 // BRBaseProcessor proc(mmgr);
96
97 cout << " visimfib: Starting threads (reader procVisi) ... " << endl;
98 reader.start();
99 if (par.action_ == "cube3d") wrt.start();
100 else {
101 if (!par.fgdatafft_) procfft.start();
102 procg.start();
103 }
104 usleep(200000);
105 reader.join();
106 if (par.action_ == "cube3d") wrt.join();
107 else {
108 if (!par.fgdatafft_) procfft.join();
109 procg.join();
110 }
111 mmgr.Print(cout);
112 cout << resu ;
113 }
114 catch (std::exception& sex) {
115 cerr << "\n visimfib.cc std::exception :" << (string)typeid(sex).name()
116 << "\n msg= " << sex.what() << endl;
117 rc = 78;
118 }
119 catch (...) {
120 cerr << " visimfib.cc catched unknown (...) exception " << endl;
121 rc = 79;
122 }
123
124 cout << ">>>> visimfib.cc ------- END ----------- RC=" << rc << endl;
125 return rc;
126
127}
128
129
Note: See TracBrowser for help on using the repository browser.