Changeset 2099 in Sophya for trunk/ArchTOIPipe/TestPipes


Ignore:
Timestamp:
Jul 16, 2002, 5:26:19 PM (23 years ago)
Author:
cecile
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ArchTOIPipe/TestPipes/tsttoi2toi_addsp.cc

    r2094 r2099  
    11//#define TOISEQBUFFERED
    22
     3#include <iostream.h>
     4#include <string>
    35#include <unistd.h>
    46#include <stdlib.h>
     
    1012#include "fitstoiwtr.h"
    1113#include "toimanager.h"
    12 #ifdef TOISEQBUFFERED
     14#include "toisegment.h"
    1315#include "toiseqbuff.h"
    14 #else
    15 #include "toisegment.h"
    16 #endif
    17 
    1816#include "sambainit.h"
    1917#include "toi2toi_addsp.h"
     
    2220#include <stdexcept>
    2321
    24 void usage(void);
    2522void usage(void) {
    2623 cout<<"tsttoi2toi_addsp [-h] [-p lp] [-s samplemin,samplemax] [-w data_window_size]"<<endl
     
    3532     <<" -d label_coord2 : label fits for delta/gLat (def=coord2)"<<endl
    3633     <<"          coord1 = alpha or gLong ; coord2 = delta or gLat"<<endl
    37      <<" -b label_bolomuv : label fits for bolo value (def=boloMuV)"<<endl
     34     <<" -b label_bolo_in : label fits for bolo value (def=boloMuV)"<<endl
     35     <<" -n label_bolo_out : label fits for bolo value (def=boloMuV_sp)"<<endl
     36     <<" -u label_out : label fits for utc (def=UTC)"<<endl
     37     <<" -l label_out : label fits for longitude (def=longitude)"<<endl
     38     <<" -L label_out : label fits for latitude (def=latitude)"<<endl
    3839     <<" -m vmin : samples are good if sample value >= vmin"<<endl
    3940     <<" -M vmax : samples are good if sample value <= vmax"<<endl
    4041     <<" -f flag : samples are bad if match flag"<<endl
    41      <<" -I : sampleNum are implicit in fits files (def=no)"<<endl
    4242     <<" fitsin_point : fits file for pointing"<<endl
    4343     <<" fitsin_bolo : fits file for bolo values"<<endl
    44      <<" fitsout_bolo : fits file for output bolo value"<<endl
     44     <<" fitsin_utc : fits file for UTC values"<<endl
     45     <<" fitsin_lon : fits file for longitude values"<<endl
     46     <<" fitsin_lat : fits file for latitude values"<<endl
     47     <<" fitsout_bolo : fits file for output bolo value"<<endl;
    4548}
    4649
     
    4851int main(int narg, char** arg) {
    4952
     53int_4 ns = 10;
     54
    5055TOIManager* mgr = TOIManager::getManager();
     56int wsize = 512; /// Segment size for TOISegmented
     57bool fgsegmented = true;
    5158
    5259//-- Decodage arguments
     
    5461bool tflg=false, tmin=false, tmax=false;
    5562r_8 vmin=-1.e30, vmax=1.e30; uint_8 badflg=0;
    56 char *label_coord1 = "coord1", *label_coord2 = "coord2"
    57    , *label_bolomuv = "boloMuV";
     63char * label_coord1 = "coord1";
     64char * label_coord2 = "coord2";
     65char * label_bolo_in = "boloMuV";
     66char * label_bolo_out = "boloMuV_sp";
     67char * label_utc= "UTC";
     68char * label_lon = "longitude";
     69char * label_lat = "latitude";
    5870double equi=2000.;
    5971char *tcoorin="gdcdl", *tcoormap="g";
    6072long sdeb,sfin;
    61 bool snimplicit = false;
     73
    6274int c;
    6375while((c = getopt(narg,arg,"hIp:s:w:a:d:b:n:i:o:m:M:f:e:")) != -1) {
     
    120132    tflg = true;
    121133    break;
    122   case 'I' :
    123     snimplicit = true;
    124     break;
    125134  case 'h' :
    126135  default:
     
    136145char * fitsin_lon = arg[optind+3];
    137146char * fitsin_lat = arg[optind+4];
    138 char * fitsout_bolo = arg[optind+5];
     147char * fitsout = arg[optind+5];
    139148
    140149cout<<">>>> tsttoi2toi_addsp:"<<endl
    141150    <<"Pipe Window Size "<<width<<endl
    142151    <<"Fits Infile Bolo "<<fitsin_bolo<<endl
    143     <<"  ...label_bolo_in "<<label_bolo_in<<endl;
     152    <<"  ...label_bolo_in "<<label_bolo_in<<endl
     153    <<"Fits Infile Utc "<<fitsin_utc<<endl
     154    <<"  ...label_utc "<<label_utc<<endl
     155    <<"Fits Infile Lon "<<fitsin_lon<<endl
     156    <<"  ...label_lon "<<label_lon<<endl
     157    <<"Fits Infile Lat "<<fitsin_lat<<endl
     158    <<"  ...label_lat "<<label_lat<<endl;
    144159cout<<"Fits Infile Pointing "<<fitsin_point<<endl
    145160    <<"  ...label_coord1 "<<label_coord1<<endl
    146161    <<"  ...label_coord2 "<<label_coord2<<endl
    147162    <<"  ...... ctype="<<tcoorin<<endl;
    148 cout<<"Fits Outfile Bolo"<<fitsout_bolo<<endl
     163cout<<"Fits Outfile Bolo "<<fitsout<<endl
    149164    <<"  ...label_bolo_out "<<label_bolo_out<<endl;
    150165
     
    155170try {
    156171//--------------------------------------------------------------------
     172
     173  CGT plombier(fgsegmented,wsize);
     174  plombier.SetDebugLevel(99);
    157175 
    158   CGT plombier(fgsegmented,wsize);
    159   plombier.SetDebugLevel(0);
    160 
    161176 // FITS reader
    162177 FITSTOIReader rfitsb(fitsin_bolo);
    163  if(snimplicit) rfitsb.setImplicitSN();
    164  int ncolb = rfitsb.getNOut();
    165  cout<<"Number of columns in fits Infile_bolo : "<<ncolb<<endl;
    166  if(ncolb<1) exit(-4);
    167 
    168178 FITSTOIReader rfitsp(fitsin_point);
    169  if(snimplicit) rfitsp.setImplicitSN();
    170  int ncolp = rfitsp.getNOut();
    171  cout<<"Number of columns in fits Infile_point : "<<ncolp<<endl;
    172  if(ncolp<2) exit(-5);
    173 
    174 
    175179 FITSTOIReader rfitsu(fitsin_utc);
    176180 FITSTOIReader rfitsl(fitsin_lon);
    177181 FITSTOIReader rfitsL(fitsin_lat);
    178 
    179 
     182 FITSTOIWriter wfits(fitsout);
     183
     184 Info_src* scr;
     185 Fill_Info_scr(scr,ns);
     186 
    180187 // TOI Processor
    181  Toi2toi_Addsp toi2t_sp();
     188 Toi2toi_Addsp toi2t_sp(scr,ns);
    182189 cout<<"Toi2toi_Addsp created"<<endl;
     190
    183191 toi2t_sp.SetEquinox(equi);
    184192 toi2t_sp.SetCoorIn(tcoorin);
     
    190198
    191199 // Definition des tuyaux
     200 plombier.Connect(toi2t_sp,"BoloOut",wfits,label_bolo_out);
     201 plombier.Connect(rfitsb,label_bolo_in,toi2t_sp,"BoloIn");
     202 
     203 // pb dans  prout.addOutput(out, toi);
     204 cout << " tout va bien " << endl;
     205 //pb dans chkinit(); dans  afterinit()
    192206 plombier.Connect(rfitsp,label_coord1,toi2t_sp,"Coord1In");
     207 cout << " ca va plus " << endl;
     208
    193209 plombier.Connect(rfitsp,label_coord2,toi2t_sp,"Coord2In");
    194  plombier.Connect(rfitsb,label_bolo_in,toi2t_sp,"BoloIn");
    195210
    196211 plombier.Connect(rfitsu,label_utc,toi2t_sp,"utc");
     
    198213 plombier.Connect(rfitsL,label_lat,toi2t_sp,"lat");
    199214
    200  plombier.Connect(toi2t_sp,"BoloOut",wfits,label_bolo_out);
    201215
    202216 // Run
     
    225239exit(0);
    226240}
     241
     242//--------------------------------------------------------------------
     243//--------------------------------------------------------------------
     244//--------------------------------------------------------------------
     245//--------------------------------------------------------------------
     246//--------------------------------------------------------------------
     247//--------------------------------------------------------------------
     248void Fill_Info_scr(Info_src* scr, int_4 ns)
     249{
     250  for (int i=0; i<ns ; i++){
     251    scr[i].glon = 80.+i*10.;
     252    scr[i].glat = 0.;
     253    scr[i].amp  = 1.;
     254    scr[i].tau1 = 0.5;
     255    scr[i].tau2 = 0.5;
     256  }
     257}
Note: See TracChangeset for help on using the changeset viewer.