Changeset 2099 in Sophya for trunk/ArchTOIPipe


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

* empty log message *

Location:
trunk/ArchTOIPipe
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ArchTOIPipe/ProcWSophya/toi2toi_addsp.cc

    r2095 r2099  
    33//                               Christophe Magneville
    44//                               Reza Ansari
    5 // $Id: toi2toi_addsp.cc,v 1.1 2002-07-16 08:48:06 cecile Exp $
     5// $Id: toi2toi_addsp.cc,v 1.2 2002-07-16 15:26:19 cecile Exp $
    66
    77#include "machdefs.h"
     
    99#include "pexceptions.h"
    1010#include "ctimer.h"
    11 #include "toi2map.h"
     11#include "toi2toi_addsp.h"
    1212// La valeur "Pi" doit etre celle de smathconst.h a cause du test sur theta
    1313#include "smathconst.h"
    1414
    1515////////////////////////////////////////////////////////////////////////
    16 TOI2Map::TOI2Map()
    17   : totnscount(0)
     16Toi2toi_Addsp::Toi2toi_Addsp(Info_src* info, int_4 ns)
     17  : src(info), nb_src(ns)
    1818{
    1919 SetEquinox();
     
    2626}
    2727
    28 TOI2Map::~TOI2Map()
     28Toi2toi_Addsp::~Toi2toi_Addsp()
    2929{
    3030}
    3131
    3232////////////////////////////////////////////////////////////////////////
    33 void TOI2Map::Print(::ostream & os)
     33void Toi2toi_Addsp::Print(::ostream & os)
    3434{
    3535}
    3636
    3737////////////////////////////////////////////////////////////////////////
    38 void TOI2Map::init() {
    39   cout << "TOI2Map::init" << endl;
     38void Toi2toi_Addsp::init() {
     39  cout << "Toi2toi_Addsp::init" << endl;
     40  declareInput("BoloIn");
    4041  declareInput("Coord1In");
    4142  declareInput("Coord2In");
    42   declareInput("BoloIn");
    4343  declareInput("utc");
    4444  declareInput("lon");
     
    4949
    5050////////////////////////////////////////////////////////////////////////
    51 // define SANS_BUFFER
    52 void TOI2Map::run()
     51void Toi2toi_Addsp::run()
    5352{
    5453long snb = getMinIn();
     
    5655
    5756if(snb>sne) {
    58   cout<<"TOI2Map::run() - Bad sample interval"<<snb<<" , "<<sne<<endl;
    59   throw ParmError("TOI2Map::run() - Bad sample interval");
     57  cout<<"Toi2toi_Addsp::run() - Bad sample interval"<<snb<<" , "<<sne<<endl;
     58  throw ParmError("Toi2toi_Addsp::run() - Bad sample interval");
    6059}
    6160if(!checkInputTOIIndex(0) || !checkInputTOIIndex(1) || !checkInputTOIIndex(2)) {
    62   cout<<"TOI2Map::run() - Input TOI (Coord1In or Coord2In or BoloIn) not connected! "<<endl;
    63   throw ParmError("TOI2Map::run() Output TOI (Coord1In or Coord2In or BoloIn) not connected!");
     61  cout<<"Toi2toi_Addsp::run() - Input TOI (Coord1In or Coord2In or BoloIn) not connected! "<<endl;
     62  throw ParmError("Toi2toi_Addsp::run() Output TOI (Coord1In or Coord2In or BoloIn) not connected!");
    6463}
    6564if( !(mTypCoorIn&TypCoordEq || mTypCoorIn&TypCoordGal) ) {
    66   cout<<"TOI2Map::run() - Input Coordinates not Eq or Gal! "<<endl;
    67   throw ParmError("TOI2Map::run() - Input Coordinates not Eq or Gal!");
     65  cout<<"Toi2toi_Addsp::run() - Input Coordinates not Eq or Gal! "<<endl;
     66  throw ParmError("Toi2toi_Addsp::run() - Input Coordinates not Eq or Gal!");
    6867}
    6968if( !(mTypCoorMap&TypCoordEq || mTypCoorMap&TypCoordGal) ) {
    70   cout<<"TOI2Map::run() - Output Coordinates not Eq or Gal! "<<endl;
    71   throw ParmError("TOI2Map::run() - Output Coordinates not Eq or Gal!");
     69  cout<<"Toi2toi_Addsp::run() - Output Coordinates not Eq or Gal! "<<endl;
     70  throw ParmError("Toi2toi_Addsp::run() - Output Coordinates not Eq or Gal!");
    7271}
    7372
     
    7675try {
    7776
    78 int ii;
    79 uint_4 mNSnFill=0, mNpixFill=0, NFill[NFILL], BadCoorRange=0;
    80 for(ii=0;ii<NFILL;ii++) NFill[ii]=0;
    8177double mjd = MJDfrYear(mActualYear);
    8278
    83 cout<<"TOI2Map::run() from "<<snb<<" to "<<sne;
    84 #ifndef SANS_BUFFER
    85 int bufsz = 100;
    86 uint_8* bfgbolo = new uint_8[bufsz];
    87 double* bbolo   = new double[bufsz];
    88 double* bc1     = new double[bufsz];
    89 double* bc2     = new double[bufsz];
    90 int i0 = -1;
    91 cout<<" (getData() bufferized)"<<endl;
    92 #else
    93 cout<<" (getData() not bufferized)"<<endl;
    94 #endif
     79cout<<"Toi2toi_Addsp::run() from "<<snb<<" to "<<sne;
    9580
    9681for(int s=snb;s<=sne;s++) {
    9782  uint_8 fgbolo = 0;
    98   double bolo,coord1,coord2;
     83  double bolo,bolo_sp,coord1,coord2;
    9984  //              Equatoriales   /   Galactiques
    10085  // coord1,2 =   alpha,delta    /   gLon,gLat
    10186
    102   getData(2,s,bolo,fgbolo);
    103   coord1 = getData(0,s);
    104   coord2 = getData(1,s);
    105   totnscount++;
     87  getData(0,s,bolo,fgbolo);
     88  coord1 = getData(1,s);
     89  coord2 = getData(2,s);
    10690
    10791  // Comme il n'y a pas de toi en sortie, il faut dire
     
    129113  }
    130114  ToCoLat(&coord2,TypUniteD);
    131 
     115  bolo_sp=bolo;
     116 
    132117  putData(0,s,bolo_sp,fgbolo);
    133118
     
    135120 
    136121
    137  cout<<"TOI2Map::run(): Fin de boucle sur les sampleNum"<<endl;
     122 cout<<"Toi2toi_Addsp::run(): Fin de boucle sur les sampleNum"<<endl;
    138123
    139124
    140125//---------------------------------------------------------
    141126} catch (PException & exc) {
    142   cout<<"TOI2Map: Catched Exception "<<(string)typeid(exc).name()
     127  cout<<"Toi2toi_Addsp: Catched Exception "<<(string)typeid(exc).name()
    143128      <<"\n .... Msg= "<<exc.Msg()<<endl;
    144129}
    145130
    146 return;                                                                           
     131return;     
    147132}
  • trunk/ArchTOIPipe/ProcWSophya/toi2toi_addsp.h

    r2095 r2099  
    55//                               Christophe Magneville
    66//                               Reza Ansari
    7 // $Id: toi2toi_addsp.h,v 1.1 2002-07-16 08:48:06 cecile Exp $
     7// $Id: toi2toi_addsp.h,v 1.2 2002-07-16 15:26:19 cecile Exp $
    88
    99#ifndef TOI2MAP_H
     
    3535// Si les CoordIn et les CoordMap sont equatoriales -> meme equinoxe!
    3636
    37 class TOI2Map : public TOIProcessor {
     37struct Info_src
     38{
     39  double glon,glat;
     40  double azi,elv;
     41  double amp,tau1,tau2;
     42};
     43
     44void Fill_Info_scr(Info_src* scr, int_4 ns);
     45
     46class Toi2toi_Addsp : public TOIProcessor {
    3847public:
    39                  TOI2Map();
    40                  //TOI2Map(SphereHEALPix<r_8>* map,SphereHEALPix<r_8>* wmap=NULL);
    41   virtual       ~TOI2Map();
     48                 Toi2toi_Addsp(Info_src* info, int_4 ns);
     49  virtual       ~Toi2toi_Addsp();
    4250
    4351  virtual void  init(void);
     
    7179  // Print
    7280  void Print(::ostream & os);
    73   inline int_8  ProcessedSampleCount() const { return totnscount; }
    7481
    7582protected:
     
    7784  unsigned long mTypCoorIn, mTypCoorMap;
    7885  double mActualYear;
     86  Info_src* src;
     87  int_4 nb_src;
    7988
    8089  bool mTFlag,mTMin,mTMax;
    8190  uint_8 mBadFlag;
    8291  r_8 mValMin,mValMax;
    83   int_8 totnscount;   // Nombre total d'echantillon processe
    8492
    8593};
  • 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.