source: Sophya/trunk/ArchTOIPipe/TestPipes/tsttoi2ring.cc@ 2316

Last change on this file since 2316 was 2316, checked in by cecile, 23 years ago

TEST - marche pas encore

File size: 3.1 KB
RevLine 
[2316]1//#define TOISEQBUFFERED
2
3#include <unistd.h>
4#include "toi.h"
5#include "cgt.h"
6#include "toiprocessor.h"
7#include "fitstoirdr.h"
8#include "fitsringwtr.h"
9#include "toimanager.h"
10#ifdef TOISEQBUFFERED
11#include "toiseqbuff.h"
12#else
13#include "toisegment.h"
14#endif
15
16#include "sambainit.h"
17#include "toi2ring.h"
18#include "timing.h"
19
20#include <stdexcept>
21
22void usage(void);
23void usage(void) {
24 cout<<"tsttoi2ring fitsin_phase fitsin_value fitsout_value fitsout_weight Nsamples"<<endl;
25 return;
26}
27
28////////////////////////////////////////////////////////////////
29int main(int narg, char** arg) {
30
31TOIManager* mgr = TOIManager::getManager();
32
33//-- Decodage arguments
34 bool fgsegmented = true;
35int wsize = 512;
36char *label_phase = "BOLOMUVC_26", *label_bolomuv = "BOLOMUVC_26";
37bool snimplicit = false;
38
39if(narg != 6) {usage(); exit(2);}
40char * fitsin_phase = arg[1];
41char * fitsin_value = arg[2];
42char * fitsout_value = arg[3];
43char * fitsout_weight = arg[4];
44int Nsamples = atoi(arg[5]);
45
46cout<<">>>> tsttoi2ring:"<<endl
47 <<"Fits OutFile "<<fitsout_value<<endl
48 <<"Fits WOutFile "<<fitsout_weight<<endl;
49cout<<"Fits Infile Value "<<fitsin_value<<endl
50 <<" ...label_bolomuv "<<label_bolomuv<<endl;
51cout<<"Fits Infile Pointing "<<fitsin_phase<<endl
52 <<" ...label_phase "<<label_phase<<endl;
53
54
55SophyaInit();
56InitTim();
57
58//--------------------------------------------------------------------
59try {
60//--------------------------------------------------------------------
61
62 CGT plombier(fgsegmented,wsize);
63 plombier.SetDebugLevel(99);
64
65 // FITS reader et writer
66 FITSTOIReader rfitsp(fitsin_phase);
67 if(snimplicit) rfitsp.setImplicitSN();
68 FITSTOIReader rfitsv(fitsin_value);
69 if(snimplicit) rfitsv.setImplicitSN();
70 cout << "fits reader created"<<endl;
71
72 FITSRingWriter wfits(fitsout_value);
73 FITSRingWriter wwfits(fitsout_weight);
74 cout << "setAperture" << endl;
75 wfits.setAperture(85.);
76 wwfits.setAperture(85.);
77 cout << "setNSamples" << endl;
78 wfits.setNSamples(Nsamples);
79 wwfits.setNSamples(Nsamples);
80
81 cout << "fits writer created"<<endl;
82
83
84 // TOI Processor
85 Toi2RING m2ring(Nsamples);
86 cout<<"Toi2RING created"<<endl;
87
88 // Definition des tuyaux
89 cout << label_phase <<endl;
90
91 plombier.Connect(rfitsp,label_phase,m2ring,"Phase");
92 plombier.Connect(rfitsv,label_bolomuv,m2ring,"Value");
93 cout<<"file out "<<fitsout_value<< endl;
94 plombier.Connect(m2ring,"Rvalue",wfits,"signal");
95 plombier.Connect(m2ring,"WRvalue",wwfits,"signal");
96
97
98 // Run
99 cout<<"----- FITSReaderTOI::PrintStatus() : -----"<<endl;
100
101 plombier.Start();
102 plombier.ListTOIs(cout, 1);
103 cout << "Joining ..." << endl;
104
105 mgr->joinAll();
106 PrtTim("End threads");
107
108//--------------------------------------------------------------------
109} catch (PThrowable & exc) {
110 cout<<"\ntsttoi2ring: Catched Exception \n"<<(string)typeid(exc).name()
111 <<" - Msg= "<<exc.Msg()<<endl;
112} catch (const std::exception & sex) {
113 cout<<"\ntsttoi2ring: Catched std::exception \n"
114 <<(string)typeid(sex).name()<<endl;
115} catch (...) {
116 cout<<"\ntsttoi2ring: some other exception was caught ! "<<endl;
117}
118//--------------------------------------------------------------------
119
120exit(0);
121}
Note: See TracBrowser for help on using the repository browser.