Changeset 2099 in Sophya for trunk/ArchTOIPipe
- Timestamp:
- Jul 16, 2002, 5:26:19 PM (23 years ago)
- Location:
- trunk/ArchTOIPipe
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ArchTOIPipe/ProcWSophya/toi2toi_addsp.cc
r2095 r2099 3 3 // Christophe Magneville 4 4 // Reza Ansari 5 // $Id: toi2toi_addsp.cc,v 1. 1 2002-07-16 08:48:06cecile Exp $5 // $Id: toi2toi_addsp.cc,v 1.2 2002-07-16 15:26:19 cecile Exp $ 6 6 7 7 #include "machdefs.h" … … 9 9 #include "pexceptions.h" 10 10 #include "ctimer.h" 11 #include "toi2 map.h"11 #include "toi2toi_addsp.h" 12 12 // La valeur "Pi" doit etre celle de smathconst.h a cause du test sur theta 13 13 #include "smathconst.h" 14 14 15 15 //////////////////////////////////////////////////////////////////////// 16 T OI2Map::TOI2Map()17 : totnscount(0)16 Toi2toi_Addsp::Toi2toi_Addsp(Info_src* info, int_4 ns) 17 : src(info), nb_src(ns) 18 18 { 19 19 SetEquinox(); … … 26 26 } 27 27 28 T OI2Map::~TOI2Map()28 Toi2toi_Addsp::~Toi2toi_Addsp() 29 29 { 30 30 } 31 31 32 32 //////////////////////////////////////////////////////////////////////// 33 void T OI2Map::Print(::ostream & os)33 void Toi2toi_Addsp::Print(::ostream & os) 34 34 { 35 35 } 36 36 37 37 //////////////////////////////////////////////////////////////////////// 38 void TOI2Map::init() { 39 cout << "TOI2Map::init" << endl; 38 void Toi2toi_Addsp::init() { 39 cout << "Toi2toi_Addsp::init" << endl; 40 declareInput("BoloIn"); 40 41 declareInput("Coord1In"); 41 42 declareInput("Coord2In"); 42 declareInput("BoloIn");43 43 declareInput("utc"); 44 44 declareInput("lon"); … … 49 49 50 50 //////////////////////////////////////////////////////////////////////// 51 // define SANS_BUFFER 52 void TOI2Map::run() 51 void Toi2toi_Addsp::run() 53 52 { 54 53 long snb = getMinIn(); … … 56 55 57 56 if(snb>sne) { 58 cout<<"T OI2Map::run() - Bad sample interval"<<snb<<" , "<<sne<<endl;59 throw ParmError("T OI2Map::run() - Bad sample interval");57 cout<<"Toi2toi_Addsp::run() - Bad sample interval"<<snb<<" , "<<sne<<endl; 58 throw ParmError("Toi2toi_Addsp::run() - Bad sample interval"); 60 59 } 61 60 if(!checkInputTOIIndex(0) || !checkInputTOIIndex(1) || !checkInputTOIIndex(2)) { 62 cout<<"T OI2Map::run() - Input TOI (Coord1In or Coord2In or BoloIn) not connected! "<<endl;63 throw ParmError("T OI2Map::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!"); 64 63 } 65 64 if( !(mTypCoorIn&TypCoordEq || mTypCoorIn&TypCoordGal) ) { 66 cout<<"T OI2Map::run() - Input Coordinates not Eq or Gal! "<<endl;67 throw ParmError("T OI2Map::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!"); 68 67 } 69 68 if( !(mTypCoorMap&TypCoordEq || mTypCoorMap&TypCoordGal) ) { 70 cout<<"T OI2Map::run() - Output Coordinates not Eq or Gal! "<<endl;71 throw ParmError("T OI2Map::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!"); 72 71 } 73 72 … … 76 75 try { 77 76 78 int ii;79 uint_4 mNSnFill=0, mNpixFill=0, NFill[NFILL], BadCoorRange=0;80 for(ii=0;ii<NFILL;ii++) NFill[ii]=0;81 77 double mjd = MJDfrYear(mActualYear); 82 78 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 79 cout<<"Toi2toi_Addsp::run() from "<<snb<<" to "<<sne; 95 80 96 81 for(int s=snb;s<=sne;s++) { 97 82 uint_8 fgbolo = 0; 98 double bolo, coord1,coord2;83 double bolo,bolo_sp,coord1,coord2; 99 84 // Equatoriales / Galactiques 100 85 // coord1,2 = alpha,delta / gLon,gLat 101 86 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); 106 90 107 91 // Comme il n'y a pas de toi en sortie, il faut dire … … 129 113 } 130 114 ToCoLat(&coord2,TypUniteD); 131 115 bolo_sp=bolo; 116 132 117 putData(0,s,bolo_sp,fgbolo); 133 118 … … 135 120 136 121 137 cout<<"T OI2Map::run(): Fin de boucle sur les sampleNum"<<endl;122 cout<<"Toi2toi_Addsp::run(): Fin de boucle sur les sampleNum"<<endl; 138 123 139 124 140 125 //--------------------------------------------------------- 141 126 } catch (PException & exc) { 142 cout<<"T OI2Map: Catched Exception "<<(string)typeid(exc).name()127 cout<<"Toi2toi_Addsp: Catched Exception "<<(string)typeid(exc).name() 143 128 <<"\n .... Msg= "<<exc.Msg()<<endl; 144 129 } 145 130 146 return; 131 return; 147 132 } -
trunk/ArchTOIPipe/ProcWSophya/toi2toi_addsp.h
r2095 r2099 5 5 // Christophe Magneville 6 6 // Reza Ansari 7 // $Id: toi2toi_addsp.h,v 1. 1 2002-07-16 08:48:06cecile Exp $7 // $Id: toi2toi_addsp.h,v 1.2 2002-07-16 15:26:19 cecile Exp $ 8 8 9 9 #ifndef TOI2MAP_H … … 35 35 // Si les CoordIn et les CoordMap sont equatoriales -> meme equinoxe! 36 36 37 class TOI2Map : public TOIProcessor { 37 struct Info_src 38 { 39 double glon,glat; 40 double azi,elv; 41 double amp,tau1,tau2; 42 }; 43 44 void Fill_Info_scr(Info_src* scr, int_4 ns); 45 46 class Toi2toi_Addsp : public TOIProcessor { 38 47 public: 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(); 42 50 43 51 virtual void init(void); … … 71 79 // Print 72 80 void Print(::ostream & os); 73 inline int_8 ProcessedSampleCount() const { return totnscount; }74 81 75 82 protected: … … 77 84 unsigned long mTypCoorIn, mTypCoorMap; 78 85 double mActualYear; 86 Info_src* src; 87 int_4 nb_src; 79 88 80 89 bool mTFlag,mTMin,mTMax; 81 90 uint_8 mBadFlag; 82 91 r_8 mValMin,mValMax; 83 int_8 totnscount; // Nombre total d'echantillon processe84 92 85 93 }; -
trunk/ArchTOIPipe/TestPipes/tsttoi2toi_addsp.cc
r2094 r2099 1 1 //#define TOISEQBUFFERED 2 2 3 #include <iostream.h> 4 #include <string> 3 5 #include <unistd.h> 4 6 #include <stdlib.h> … … 10 12 #include "fitstoiwtr.h" 11 13 #include "toimanager.h" 12 #i fdef TOISEQBUFFERED14 #include "toisegment.h" 13 15 #include "toiseqbuff.h" 14 #else15 #include "toisegment.h"16 #endif17 18 16 #include "sambainit.h" 19 17 #include "toi2toi_addsp.h" … … 22 20 #include <stdexcept> 23 21 24 void usage(void);25 22 void usage(void) { 26 23 cout<<"tsttoi2toi_addsp [-h] [-p lp] [-s samplemin,samplemax] [-w data_window_size]"<<endl … … 35 32 <<" -d label_coord2 : label fits for delta/gLat (def=coord2)"<<endl 36 33 <<" 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 38 39 <<" -m vmin : samples are good if sample value >= vmin"<<endl 39 40 <<" -M vmax : samples are good if sample value <= vmax"<<endl 40 41 <<" -f flag : samples are bad if match flag"<<endl 41 <<" -I : sampleNum are implicit in fits files (def=no)"<<endl42 42 <<" fitsin_point : fits file for pointing"<<endl 43 43 <<" 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; 45 48 } 46 49 … … 48 51 int main(int narg, char** arg) { 49 52 53 int_4 ns = 10; 54 50 55 TOIManager* mgr = TOIManager::getManager(); 56 int wsize = 512; /// Segment size for TOISegmented 57 bool fgsegmented = true; 51 58 52 59 //-- Decodage arguments … … 54 61 bool tflg=false, tmin=false, tmax=false; 55 62 r_8 vmin=-1.e30, vmax=1.e30; uint_8 badflg=0; 56 char *label_coord1 = "coord1", *label_coord2 = "coord2" 57 , *label_bolomuv = "boloMuV"; 63 char * label_coord1 = "coord1"; 64 char * label_coord2 = "coord2"; 65 char * label_bolo_in = "boloMuV"; 66 char * label_bolo_out = "boloMuV_sp"; 67 char * label_utc= "UTC"; 68 char * label_lon = "longitude"; 69 char * label_lat = "latitude"; 58 70 double equi=2000.; 59 71 char *tcoorin="gdcdl", *tcoormap="g"; 60 72 long sdeb,sfin; 61 bool snimplicit = false; 73 62 74 int c; 63 75 while((c = getopt(narg,arg,"hIp:s:w:a:d:b:n:i:o:m:M:f:e:")) != -1) { … … 120 132 tflg = true; 121 133 break; 122 case 'I' :123 snimplicit = true;124 break;125 134 case 'h' : 126 135 default: … … 136 145 char * fitsin_lon = arg[optind+3]; 137 146 char * fitsin_lat = arg[optind+4]; 138 char * fitsout _bolo= arg[optind+5];147 char * fitsout = arg[optind+5]; 139 148 140 149 cout<<">>>> tsttoi2toi_addsp:"<<endl 141 150 <<"Pipe Window Size "<<width<<endl 142 151 <<"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; 144 159 cout<<"Fits Infile Pointing "<<fitsin_point<<endl 145 160 <<" ...label_coord1 "<<label_coord1<<endl 146 161 <<" ...label_coord2 "<<label_coord2<<endl 147 162 <<" ...... ctype="<<tcoorin<<endl; 148 cout<<"Fits Outfile Bolo "<<fitsout_bolo<<endl163 cout<<"Fits Outfile Bolo "<<fitsout<<endl 149 164 <<" ...label_bolo_out "<<label_bolo_out<<endl; 150 165 … … 155 170 try { 156 171 //-------------------------------------------------------------------- 172 173 CGT plombier(fgsegmented,wsize); 174 plombier.SetDebugLevel(99); 157 175 158 CGT plombier(fgsegmented,wsize);159 plombier.SetDebugLevel(0);160 161 176 // FITS reader 162 177 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 168 178 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 175 179 FITSTOIReader rfitsu(fitsin_utc); 176 180 FITSTOIReader rfitsl(fitsin_lon); 177 181 FITSTOIReader rfitsL(fitsin_lat); 178 179 182 FITSTOIWriter wfits(fitsout); 183 184 Info_src* scr; 185 Fill_Info_scr(scr,ns); 186 180 187 // TOI Processor 181 Toi2toi_Addsp toi2t_sp( );188 Toi2toi_Addsp toi2t_sp(scr,ns); 182 189 cout<<"Toi2toi_Addsp created"<<endl; 190 183 191 toi2t_sp.SetEquinox(equi); 184 192 toi2t_sp.SetCoorIn(tcoorin); … … 190 198 191 199 // 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() 192 206 plombier.Connect(rfitsp,label_coord1,toi2t_sp,"Coord1In"); 207 cout << " ca va plus " << endl; 208 193 209 plombier.Connect(rfitsp,label_coord2,toi2t_sp,"Coord2In"); 194 plombier.Connect(rfitsb,label_bolo_in,toi2t_sp,"BoloIn");195 210 196 211 plombier.Connect(rfitsu,label_utc,toi2t_sp,"utc"); … … 198 213 plombier.Connect(rfitsL,label_lat,toi2t_sp,"lat"); 199 214 200 plombier.Connect(toi2t_sp,"BoloOut",wfits,label_bolo_out);201 215 202 216 // Run … … 225 239 exit(0); 226 240 } 241 242 //-------------------------------------------------------------------- 243 //-------------------------------------------------------------------- 244 //-------------------------------------------------------------------- 245 //-------------------------------------------------------------------- 246 //-------------------------------------------------------------------- 247 //-------------------------------------------------------------------- 248 void 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.