[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 |
|
---|
| 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
|
---|
[2319] | 34 | bool fgsegmented = true;
|
---|
[2316] | 35 | int wsize = 512;
|
---|
[2319] | 36 | char *label_phase = "PHASE", *label_bolomuv = "BOLOMUVC_26";
|
---|
| 37 | char *label_theta = "THETA", *label_phi = "PHI";
|
---|
[2316] | 38 | bool snimplicit = false;
|
---|
| 39 |
|
---|
| 40 | if(narg != 6) {usage(); exit(2);}
|
---|
| 41 | char * fitsin_phase = arg[1];
|
---|
| 42 | char * fitsin_value = arg[2];
|
---|
| 43 | char * fitsout_value = arg[3];
|
---|
| 44 | char * fitsout_weight = arg[4];
|
---|
| 45 | int Nsamples = atoi(arg[5]);
|
---|
| 46 |
|
---|
| 47 | cout<<">>>> tsttoi2ring:"<<endl
|
---|
| 48 | <<"Fits OutFile "<<fitsout_value<<endl
|
---|
| 49 | <<"Fits WOutFile "<<fitsout_weight<<endl;
|
---|
| 50 | cout<<"Fits Infile Value "<<fitsin_value<<endl
|
---|
| 51 | <<" ...label_bolomuv "<<label_bolomuv<<endl;
|
---|
| 52 | cout<<"Fits Infile Pointing "<<fitsin_phase<<endl
|
---|
| 53 | <<" ...label_phase "<<label_phase<<endl;
|
---|
| 54 |
|
---|
| 55 |
|
---|
| 56 | SophyaInit();
|
---|
| 57 | InitTim();
|
---|
| 58 |
|
---|
| 59 | //--------------------------------------------------------------------
|
---|
| 60 | try {
|
---|
| 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 |
|
---|
[2319] | 92 | plombier.Connect(rfitsp,label_theta,m2ring,"Theta");
|
---|
| 93 | plombier.Connect(rfitsp,label_phi,m2ring,"Phi");
|
---|
[2316] | 94 | plombier.Connect(rfitsp,label_phase,m2ring,"Phase");
|
---|
| 95 | plombier.Connect(rfitsv,label_bolomuv,m2ring,"Value");
|
---|
| 96 | cout<<"file out "<<fitsout_value<< endl;
|
---|
[2319] | 97 |
|
---|
| 98 | plombier.Connect(m2ring,"CircTheta",wfits,"CircTheta");
|
---|
| 99 | plombier.Connect(m2ring,"CircPhi",wfits,"CircPhi");
|
---|
[2316] | 100 | plombier.Connect(m2ring,"Rvalue",wfits,"signal");
|
---|
[2319] | 101 |
|
---|
| 102 | // plombier.Connect(m2ring,"CircTheta",wwfits,"CircTheta");
|
---|
| 103 | // plombier.Connect(m2ring,"CircPhi",wwfits,"CircPhi");
|
---|
| 104 | // plombier.Connect(m2ring,"WRvalue",wwfits,"signal");
|
---|
[2316] | 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 |
|
---|
| 129 | exit(0);
|
---|
| 130 | }
|
---|