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

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

* empty log message *

File size: 3.5 KB
Line 
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
34bool fgsegmented = true;
35int wsize = 512;
36char *label_phase = "PHASE", *label_bolomuv = "BOLOMUVC_26";
37char *label_theta = "THETA", *label_phi = "PHI";
38bool snimplicit = false;
39
40if(narg != 6) {usage(); exit(2);}
41char * fitsin_phase = arg[1];
42char * fitsin_value = arg[2];
43char * fitsout_value = arg[3];
44char * fitsout_weight = arg[4];
45int Nsamples = atoi(arg[5]);
46
47cout<<">>>> tsttoi2ring:"<<endl
48 <<"Fits OutFile "<<fitsout_value<<endl
49 <<"Fits WOutFile "<<fitsout_weight<<endl;
50cout<<"Fits Infile Value "<<fitsin_value<<endl
51 <<" ...label_bolomuv "<<label_bolomuv<<endl;
52cout<<"Fits Infile Pointing "<<fitsin_phase<<endl
53 <<" ...label_phase "<<label_phase<<endl;
54
55
56SophyaInit();
57InitTim();
58
59//--------------------------------------------------------------------
60try {
61//--------------------------------------------------------------------
62
63 CGT plombier(fgsegmented,wsize);
64 plombier.SetDebugLevel(99);
65
66 // FITS reader et writer
67 FITSTOIReader rfitsp(fitsin_phase);
68 if(snimplicit) rfitsp.setImplicitSN();
69 FITSTOIReader rfitsv(fitsin_value);
70 if(snimplicit) rfitsv.setImplicitSN();
71 cout << "fits reader created"<<endl;
72
73 FITSRingWriter wfits(fitsout_value);
74 FITSRingWriter wwfits(fitsout_weight);
75 cout << "setAperture" << endl;
76 wfits.setAperture(85.);
77 wwfits.setAperture(85.);
78 cout << "setNSamples" << endl;
79 wfits.setNSamples(Nsamples);
80 wwfits.setNSamples(Nsamples);
81
82 cout << "fits writer created"<<endl;
83
84
85 // TOI Processor
86 Toi2RING m2ring(Nsamples);
87 cout<<"Toi2RING created"<<endl;
88
89 // Definition des tuyaux
90 cout << label_phase <<endl;
91
92 plombier.Connect(rfitsp,label_theta,m2ring,"Theta");
93 plombier.Connect(rfitsp,label_phi,m2ring,"Phi");
94 plombier.Connect(rfitsp,label_phase,m2ring,"Phase");
95 plombier.Connect(rfitsv,label_bolomuv,m2ring,"Value");
96 cout<<"file out "<<fitsout_value<< endl;
97
98 plombier.Connect(m2ring,"CircTheta",wfits,"CircTheta");
99 plombier.Connect(m2ring,"CircPhi",wfits,"CircPhi");
100 plombier.Connect(m2ring,"Rvalue",wfits,"signal");
101
102// plombier.Connect(m2ring,"CircTheta",wwfits,"CircTheta");
103// plombier.Connect(m2ring,"CircPhi",wwfits,"CircPhi");
104// plombier.Connect(m2ring,"WRvalue",wwfits,"signal");
105
106
107 // Run
108 cout<<"----- FITSReaderTOI::PrintStatus() : -----"<<endl;
109
110 plombier.Start();
111 plombier.ListTOIs(cout, 1);
112 cout << "Joining ..." << endl;
113
114 mgr->joinAll();
115 PrtTim("End threads");
116
117//--------------------------------------------------------------------
118} catch (PThrowable & exc) {
119 cout<<"\ntsttoi2ring: Catched Exception \n"<<(string)typeid(exc).name()
120 <<" - Msg= "<<exc.Msg()<<endl;
121} catch (const std::exception & sex) {
122 cout<<"\ntsttoi2ring: Catched std::exception \n"
123 <<(string)typeid(sex).name()<<endl;
124} catch (...) {
125 cout<<"\ntsttoi2ring: some other exception was caught ! "<<endl;
126}
127//--------------------------------------------------------------------
128
129exit(0);
130}
Note: See TracBrowser for help on using the repository browser.