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

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

ok

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 Nring (all if 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 != 9) {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 int_8 Nring = atoi(arg[8]);
50 cout<<"Requested Samples from "<<sdeb<<" , "<<sfin<<endl;
51
52
53cout<<">>>> tsttoi2ring:"<<endl
54 <<"Fits OutFile "<<fitsout_value<<endl
55 <<"Fits WOutFile "<<fitsout_weight<<endl;
56cout<<"Fits Infile Value "<<fitsin_value<<endl
57 <<" ...label_bolomuv "<<label_bolomuv<<endl;
58cout<<"Fits Infile Pointing "<<fitsin_phase<<endl
59 <<" ...label_phase "<<label_phase<<endl;
60
61
62SophyaInit();
63InitTim();
64
65//--------------------------------------------------------------------
66try {
67//--------------------------------------------------------------------
68
69 CGT plombier(fgsegmented,wsize);
70 plombier.SetDebugLevel(99);
71
72 // FITS reader et writer
73 FITSTOIReader rfitsp(fitsin_phase);
74 if(snimplicit) rfitsp.setImplicitSN();
75 if(sfin>=sdeb) rfitsp.setRequestedSample(sdeb,sfin);
76
77 FITSTOIReader rfitsv(fitsin_value);
78 if(snimplicit) rfitsv.setImplicitSN();
79 cout << "fits reader created"<<endl;
80
81 FITSRingWriter wfits(fitsout_value);
82 FITSRingWriter wwfits(fitsout_weight);
83 cout << "setAperture" << endl;
84 wfits.setAperture(85.);
85 wwfits.setAperture(85.);
86 cout << "setNSamples" << endl;
87 wfits.setNSamples(Nsamples);
88 wwfits.setNSamples(Nsamples);
89 wfits.setNRings(Nring);
90 wwfits.setNRings(Nring);
91
92
93
94 // TOI Processor
95 Toi2RING m2ring(Nsamples);
96 cout<<"Toi2RING created"<<endl;
97
98 if(sfin>=sdeb) m2ring.setRequestedSample(sdeb,sfin);
99
100 // Definition des tuyaux
101 cout << label_phase <<endl;
102
103 plombier.Connect(rfitsp,label_theta,m2ring,"Theta");
104 plombier.Connect(rfitsp,label_phi,m2ring,"Phi");
105 plombier.Connect(rfitsp,label_phase,m2ring,"Phase");
106 plombier.Connect(rfitsv,label_bolomuv,m2ring,"Value");
107 cout<<"file out "<<fitsout_value<< endl;
108
109 plombier.Connect(m2ring,"CircTheta",wfits,"CircTheta");
110 plombier.Connect(m2ring,"CircPhi",wfits,"CircPhi");
111 plombier.Connect(m2ring,"Rvalue",wfits,"signal");
112
113 plombier.Connect(m2ring,"WCircTheta",wwfits,"CircTheta");
114 plombier.Connect(m2ring,"WCircPhi",wwfits,"CircPhi");
115 plombier.Connect(m2ring,"WRvalue",wwfits,"signal");
116
117 // Run
118 cout<<"----- FITSReaderTOI::PrintStatus() : -----"<<endl;
119
120 plombier.Start();
121 plombier.ListTOIs(cout, 1);
122 cout << "Joining ..." << endl;
123
124 mgr->joinAll();
125 PrtTim("End threads");
126
127//--------------------------------------------------------------------
128} catch (PThrowable & exc) {
129 cout<<"\ntsttoi2ring: Catched Exception \n"<<(string)typeid(exc).name()
130 <<" - Msg= "<<exc.Msg()<<endl;
131} catch (const std::exception & sex) {
132 cout<<"\ntsttoi2ring: Catched std::exception \n"
133 <<(string)typeid(sex).name()<<endl;
134} catch (...) {
135 cout<<"\ntsttoi2ring: some other exception was caught ! "<<endl;
136}
137//--------------------------------------------------------------------
138
139exit(0);
140}
Note: See TracBrowser for help on using the repository browser.