Changeset 2058 in Sophya for trunk/ArchTOIPipe
- Timestamp:
- Jun 18, 2002, 2:21:09 PM (23 years ago)
- Location:
- trunk/ArchTOIPipe
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ArchTOIPipe/Kernel/fitstoirdr.cc
r2041 r2058 3 3 // Christophe Magneville 4 4 // Reza Ansari 5 // $Id: fitstoirdr.cc,v 1. 29 2002-06-03 14:23:39ansari Exp $5 // $Id: fitstoirdr.cc,v 1.30 2002-06-18 12:21:08 ansari Exp $ 6 6 7 7 #include "fitstoirdr.h" … … 22 22 implicitSN = false; 23 23 implicitSNStart = 0; 24 25 // Variables rajoutee pour gerer les fichiers de flag de LevelS Reza 18/6/2002 26 sepFlagfile = false; 27 fptrflg = NULL; 24 28 } 25 29 … … 63 67 fits_report_error(stderr, fstatus); 64 68 fits_unlock(); 65 throw IOExc(" fitsio error");69 throw IOExc("FITSTOIReader::openFile() fitsio error"); 66 70 } 67 71 … … 89 93 firstSn = (int) (y+.1); 90 94 } 95 96 // Ouverture fichier de flag separe de LevelS (Reza 18/6/2002) 97 if (sepFlagfile) { 98 fits_open_file(&fptrflg,sepFlagFileName.c_str(),READONLY,&fstatus); 99 if (fstatus != 0) { 100 fits_report_error(stderr, fstatus); 101 fits_unlock(); 102 throw IOExc("FITSTOIReader::openFile() - sepFlagfile open fitsio error"); 103 } 104 fits_movabs_hdu(fptrflg, 2, NULL, &fstatus); 105 if (fstatus != 0) { 106 fits_report_error(stderr, fstatus); 107 fits_unlock(); 108 throw IOExc("FITSTOIReader::openFile() - sepFlagfile fits_movabs_hdu(2) fitsio error"); 109 } 110 long nrowsflg; 111 fits_get_num_rows(fptrflg,&nrowsflg,&fstatus); 112 if (nrows != nrowsflg) { 113 cerr << " FITSTOIReader::openFile()/Error: Different NRows in flag and data files!" << endl; 114 fits_unlock(); 115 throw ParmError("FITSTOIReader::openFile() Different NRows in flag and data files"); 116 } 117 } 118 // 91 119 fits_unlock(); 92 120 } 93 121 94 122 void FITSTOIReader::init() { 123 124 // Modif pour fichiers de flag separe de LevelS (Reza 18/6/2002) 125 if (sepFlagfile && (allfn.size() > 1) ) { 126 cerr << "FITSTOIReader::init()/Error- Multiple files and separate flag file not allowed !"<<endl; 127 throw ParmError("FITSTOIReader::init() Multiple files and separate flag file not allowed"); 128 } 129 95 130 openFile(allfn.front()); 96 131 … … 148 183 } 149 184 185 void FITSTOIReader::setFlagFile(string fn, vector<FlagToiDef> flags) 186 { 187 if (flags.size() < 1) { 188 cerr << " FITSTOIReader::setFlagFile()/Error flag.size() = 0 ! " << endl; 189 throw ParmError("FITSTOIReader::setFlagFile() flag.size() = 0"); 190 } 191 192 sepFlagfile = true; 193 sepFlagFileName = fn; 194 sepFlagCols = flags; 195 } 196 150 197 void FITSTOIReader::run() { 151 198 for (vector<string>::iterator i=allfn.begin(); i!=allfn.end(); i++) { … … 154 201 else run1(); // Lecture un echantillon a la fois 155 202 } 203 fits_lock(); 204 if (fptr) { 205 fits_close_file(fptr,&fstatus); 206 fptr = NULL; 207 } 208 if (sepFlagfile && fptrflg) { 209 fits_close_file(fptrflg,&fstatus); 210 fptrflg = NULL; 211 } 212 fits_unlock(); 156 213 } 157 214 … … 198 255 fits_read_col_lng(fptr,j+2,i+1,1,1,0,&flg,&anyNul,&fstatus); 199 256 } 257 258 if (sepFlagfile) { // Ajout Reza (18/6/2002) pour fichier de flags separe 259 int sflg; 260 flg = 0; 261 for(int skf=0; skf<sepFlagCols.size(); skf++) { 262 fits_read_col_int(fptrflg, skf+1, i+1,1,1,0,&sflg,&anyNul,&fstatus); 263 if (sflg) flg |= sepFlagCols[skf]; 264 } 265 } // Fin modif pour fichier de flags separe (18/6/2002) 266 200 267 tabflag[k] = flg; 201 268 // fits_unlock(); … … 237 304 } 238 305 uint_8 * tmpflg = new uint_8[Buff_Sz]; 306 307 // Ajout Reza (18/6/2002) pour fichier de flags separe 308 int* stmpflg = NULL; 309 if (sepFlagfile) stmpflg = new int[Buff_Sz]; 310 // Fin modif pour fichier de flags separe (18/6/2002) 311 239 312 240 313 TOIManager* mgr = TOIManager::getManager(); … … 286 359 if(colflg[k]==NULL) continue; 287 360 fits_read_col_lng(fptr,j+2,ideb+1,1,n,0,colflg[k],&anyNul,&fstatus); 361 // Ajout Reza (18/6/2002) pour fichier de flags separe 362 if (sepFlagfile) { 363 uint_8 sflg = 0; 364 int sjj; 365 for(sjj=0; sjj<n; sjj++) colflg[k][sjj] = 0; 366 for(int skf=0; skf<sepFlagCols.size(); skf++) { 367 fits_read_col_int(fptrflg, skf+1, ideb+1,1,n,0,stmpflg,&anyNul,&fstatus); 368 for(sjj=0; sjj<n; sjj++) 369 if (stmpflg) colflg[k][sjj] |= sepFlagCols[skf]; 370 } 371 } // Fin modif pour fichier de flags separe (18/6/2002) 372 288 373 } 289 374 if(fstatus!=0) { … … 316 401 delete [] samplenum; 317 402 delete [] tmpflg; 403 if (sepFlagfile) delete [] stmpflg; 318 404 {for(int k=0; k<getNOut(); k++) { 319 405 if(colval[k]!=NULL) delete [] colval[k]; -
trunk/ArchTOIPipe/Kernel/fitstoirdr.h
r1994 r2058 5 5 // Christophe Magneville 6 6 // Reza Ansari 7 // $Id: fitstoirdr.h,v 1.1 1 2002-05-13 13:11:32ansari Exp $7 // $Id: fitstoirdr.h,v 1.12 2002-06-18 12:21:08 ansari Exp $ 8 8 9 9 … … 17 17 #include <map> 18 18 #include "fitsio.h" 19 19 #include "flagtoidef.h" 20 20 21 21 class FITSTOIReader : public TOIProcessor { … … 30 30 31 31 virtual void addFile(string fn); 32 33 // Methode rajoutee pour gerer les fichiers de flag de LevelS 34 // Reza 18/6/2002 35 // fn : Nom du fichier FITS, 36 // flags: Indique le nombre de colonne et la correspondence avec les 37 // flags d'ArchTOIPipe flags[0..N-1] ---> 1ere...Neme colonnes 38 virtual void setFlagFile(string fn, vector<FlagToiDef> flags); 32 39 33 40 virtual void init(); … … 65 72 int_8 totnscount; // Nombre total d'echantillon processe 66 73 74 // Variables rajoutee pour gerer les fichiers de flag de LevelS (Reza 18/6/2002) 75 bool sepFlagfile; 76 string sepFlagFileName; 77 vector<FlagToiDef> sepFlagCols; 78 fitsfile* fptrflg; 79 67 80 }; 68 81 -
trunk/ArchTOIPipe/ProcWSophya/toi2map.cc
r2054 r2058 3 3 // Christophe Magneville 4 4 // Reza Ansari 5 // $Id: toi2map.cc,v 1.2 6 2002-06-11 17:14:25ansari Exp $5 // $Id: toi2map.cc,v 1.27 2002-06-18 12:21:08 ansari Exp $ 6 6 7 7 #include "machdefs.h" … … 20 20 SetCoorIn(); 21 21 SetCoorMap(); 22 SetCalibrationFactor(); 22 23 SetTestFlag(); 23 24 SetTestMin(); … … 195 196 int_4 ipix = mMap->PixIndexSph(theta,phi); 196 197 if ((ipix < 0) || (ipix >= mMap->NbPixels()) ) continue; 197 (*mMap)(ipix) += bolo ;198 (*mMap)(ipix) += bolo*mCalibFactor; 198 199 ((*mWMap)(ipix)) += 1; 199 200 mNSnFill++; -
trunk/ArchTOIPipe/ProcWSophya/toi2map.h
r2012 r2058 5 5 // Christophe Magneville 6 6 // Reza Ansari 7 // $Id: toi2map.h,v 1.1 5 2002-05-16 20:39:53ansari Exp $7 // $Id: toi2map.h,v 1.16 2002-06-18 12:21:09 ansari Exp $ 8 8 9 9 #ifndef TOI2MAP_H … … 58 58 {mTypCoorMap = DecodeTypAstro(ctype);} 59 59 60 // Facteur de calibration 61 inline void SetCalibrationFactor(double fac = 1.) 62 { mCalibFactor = fac; } 63 inline double GetCalibrationFactor() 64 { return mCalibFactor; } 65 60 66 // Test on flag value ? if yes, BAD sample have flag matching mBadFlag 61 67 inline void SetTestFlag(bool tflg=false, uint_8 badflg=FlgToiAll) … … 81 87 double mActualYear; 82 88 89 double mCalibFactor; 83 90 bool mTFlag,mTMin,mTMax; 84 91 uint_8 mBadFlag; -
trunk/ArchTOIPipe/TestPipes/toistat.cc
r2054 r2058 45 45 cout << "\n Usage : toistat [-intoi toiname] [-start snb] [-end sne] \n" 46 46 << " [-wtoi sz] [-wclean wsz,nbw] [-range min,max] [-cleannsig nsig] \n" 47 << " [- outppf] [-noprstat] [-useseqbuff] \n"47 << " [-sepflg sepFlagFile] [-outppf] [-noprstat] [-useseqbuff] \n" 48 48 << " inFitsName outFileName \n" 49 49 << " -start snb : sets the start sample num \n" … … 52 52 << " default= -16000,16000\n" 53 53 << " -intoi toiName : select input TOI name (def bolo)\n" 54 << " -sepflg sepFlagFileName: sets separate flag file (Level2)\n" 54 55 << " -wtoi sz : sets TOISeqBuff buffer size (def= 8192)\n" 55 56 << " -wclean wsz,nbw : sets cleaner window parameters (256,5) \n" … … 90 91 int clean_nbw = 5; 91 92 double clean_nsig = 999999.; 93 94 // Fichier de flag separe / Level2 / Reza 18/6/2002 95 string sepflagfile; 96 bool sepflg = false; 92 97 93 98 // File names … … 130 135 intoi = arg[ia+1]; ia++; 131 136 } 137 else if (strcmp(arg[ia],"-sepflg") == 0) { 138 if (ia == narg-1) Usage(true); 139 sepflagfile = arg[ia+1]; 140 sepflg = true; ia++; 141 } 132 142 else if (strcmp(arg[ia],"-outppf") == 0) fgoutppf = true; 133 143 … … 166 176 cout << "> Creating FITSTOIReader object - InFile=" << infile << endl; 167 177 FITSTOIReader r(infile); 178 if (sepflg) { 179 cout << " Setting separate flag file for InTOI_bolo File=" << sepflagfile 180 << " (Flags=FlgToiSpike, FlgToiSource)" << endl; 181 vector<FlagToiDef> flgcol; 182 flgcol.push_back(FlgToiSpike); 183 flgcol.push_back(FlgToiSource); 184 r.setFlagFile(sepflagfile, flgcol); 185 } 168 186 169 187 cout << "> Creating SimpleCleaner() " << endl; -
trunk/ArchTOIPipe/TestPipes/tsttoi2map.cc
r2050 r2058 27 27 <<" [-a label_coord1] [-d label_coord2] [-b label_bolomuv]"<<endl 28 28 <<" [-n nlat] [-i c,h] [-o c,h]"<<endl 29 <<" [-m vmin] [-M vmax] [-f flag] "<<endl29 <<" [-m vmin] [-M vmax] [-f flag] [-F sepFlagFileName]"<<endl 30 30 <<" fitsin_point fitsin_bolo fitsphout [fitsphwout]"<<endl 31 31 <<" -p lp : print level (def=0)"<<endl … … 44 44 <<" -f flag : samples are bad if match flag"<<endl 45 45 <<" -N nbfiles : Number of fitsin_point files fitsin_point%d.fits 0..nb-1"<<endl 46 <<" -c calibcoeff : Coefficient de calibration a appliquer (def=1.)"<<endl 46 47 <<" -I : sampleNum are implicit in fits files (def=no)"<<endl 48 <<" -F sepFlagFileName : separate flag file name for levelS"<<endl 49 <<" (FlagColName: Glitch PtSrc)"<<endl 47 50 <<" fitsin_point : fits file for pointing"<<endl 48 51 <<" fitsin_bolo : fits file for bolo values"<<endl … … 70 73 bool fgprstat = true; 71 74 int nbpointfiles = 0; 75 double coeffcalib = 1.; 76 string sepflagfile; // Fichier de flag separe / Level2 / Reza 18/6/2002 77 bool sepflg = false; // " " " " " " " 78 72 79 int c; 73 while((c = getopt(narg,arg,"hIp:s:w:a:d:b:n:i:o:m:M:f:e:N: ")) != -1) {80 while((c = getopt(narg,arg,"hIp:s:w:a:d:b:n:i:o:m:M:f:e:N:c:F:")) != -1) { 74 81 switch (c) { 75 82 case 's' : … … 125 132 nbpointfiles = atoi(optarg); 126 133 break; 134 case 'c' : 135 coeffcalib = atof(optarg); 136 break; 127 137 case 'I' : 128 138 snimplicit = true; 139 break; 140 case 'F' : 141 sepflagfile = optarg; 142 sepflg = true; 129 143 break; 130 144 case 'h' : … … 154 168 <<" ...... ctype="<<tcoormap<<endl; 155 169 cout<<"Equinoxe "<<equi<<" years"<<endl; 156 170 cout<<"CoeffCalib "<<coeffcalib<<endl; 171 157 172 SophyaInit(); 158 173 InitTim(); … … 170 185 if(ncolb<1) exit(-4); 171 186 187 188 sepflagfile = optarg; 189 sepflg = true; 190 if (sepflg) { 191 cout << " Setting separate flag file for InTOI_bolo File=" << sepflagfile 192 << " (Flags=FlgToiSpike, FlgToiSource)" << endl; 193 vector<FlagToiDef> flgcol; 194 flgcol.push_back(FlgToiSpike); 195 flgcol.push_back(FlgToiSource); 196 rfitsb.setFlagFile(sepflagfile, flgcol); 197 } 172 198 string pointfileI = fitsin_point; 173 199 MuTyV numf=0; … … 212 238 toi2m.SetTestMin(tmin,vmin); 213 239 toi2m.SetTestMax(tmax,vmax); 240 toi2m.SetCalibrationFactor(coeffcalib); 214 241 toi2m.Print(cout); 215 242
Note:
See TracChangeset
for help on using the changeset viewer.