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 |
|
---|
22 | void usage(void);
|
---|
23 | void usage(void) {
|
---|
24 | cout<<"tsttoi2ring fitsin_phase fitsin_value fitsout_value fitsout_weight Nsamples"<<endl;
|
---|
25 | return;
|
---|
26 | }
|
---|
27 |
|
---|
28 | ////////////////////////////////////////////////////////////////
|
---|
29 | int main(int narg, char** arg) {
|
---|
30 |
|
---|
31 | TOIManager* mgr = TOIManager::getManager();
|
---|
32 |
|
---|
33 | //-- Decodage arguments
|
---|
34 | bool fgsegmented = true;
|
---|
35 | int wsize = 512;
|
---|
36 | char *label_phase = "BOLOMUVC_26", *label_bolomuv = "BOLOMUVC_26";
|
---|
37 | bool snimplicit = false;
|
---|
38 |
|
---|
39 | if(narg != 6) {usage(); exit(2);}
|
---|
40 | char * fitsin_phase = arg[1];
|
---|
41 | char * fitsin_value = arg[2];
|
---|
42 | char * fitsout_value = arg[3];
|
---|
43 | char * fitsout_weight = arg[4];
|
---|
44 | int Nsamples = atoi(arg[5]);
|
---|
45 |
|
---|
46 | cout<<">>>> tsttoi2ring:"<<endl
|
---|
47 | <<"Fits OutFile "<<fitsout_value<<endl
|
---|
48 | <<"Fits WOutFile "<<fitsout_weight<<endl;
|
---|
49 | cout<<"Fits Infile Value "<<fitsin_value<<endl
|
---|
50 | <<" ...label_bolomuv "<<label_bolomuv<<endl;
|
---|
51 | cout<<"Fits Infile Pointing "<<fitsin_phase<<endl
|
---|
52 | <<" ...label_phase "<<label_phase<<endl;
|
---|
53 |
|
---|
54 |
|
---|
55 | SophyaInit();
|
---|
56 | InitTim();
|
---|
57 |
|
---|
58 | //--------------------------------------------------------------------
|
---|
59 | try {
|
---|
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 |
|
---|
120 | exit(0);
|
---|
121 | }
|
---|