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

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

plus de wring

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