Changeset 2898 in Sophya
- Timestamp:
- Jan 13, 2006, 7:26:40 PM (20 years ago)
- Location:
- trunk/SophyaExt/FitsIOServer
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaExt/FitsIOServer/fiosinit.cc
r2897 r2898 32 32 // Enregistrement des classes FitsHandler 33 33 // FitsManager::RegisterHandler(new FitsArrayHandler<int_2> , "TArray<int_2>"); 34 cout << " ---- FitsIOServerInitiator / DEBUG ---- debut RegisterHandler " << endl;34 //DBG cout << " ---- FitsIOServerInitiator / DEBUG ---- debut RegisterHandler " << endl; 35 35 FitsManager::RegisterHandler(new FitsArrayHandler<int_4> , 1, "TArray<int_4> "); 36 36 FitsManager::RegisterHandler(new FitsArrayHandler<r_4> , 1, "TArray<r_4>"); … … 54 54 FitsManager::RegisterHandler(new FITS_LocalMap<int_4> , 0, "LocalMap<int_4>"); 55 55 56 cout << " ---- FitsIOServerInitiator / DEBUG ---- ListHandlers() : " << endl;57 FitsManager::ListHandlers();56 //DBG cout << " ---- FitsIOServerInitiator / DEBUG ---- ListHandlers() : " << endl; 57 //DBG FitsManager::ListHandlers(); 58 58 } 59 59 -
trunk/SophyaExt/FitsIOServer/fitsarrhand.h
r2864 r2898 52 52 long naxes[BASEARRAY_MAXNDIMS]; 53 53 int naxis=BASEARRAY_MAXNDIMS; 54 if (FitsTypes::ImageType(x) == is.GetImageHDUInfo(naxis, naxes)) 55 return 2; 54 int imgtyp = is.GetImageHDUInfo(naxis, naxes); 55 if (naxis < 1) return 0; 56 if (FitsTypes::ImageType(x) == imgtyp) return 2; 56 57 else return 1; 57 58 } -
trunk/SophyaExt/FitsIOServer/fitsfile.cc
r2897 r2898 247 247 { 248 248 FitsInFile fis(is); 249 fis.ReadHeader( 0);249 fis.ReadHeader(fis.CurrentHDU()); 250 250 ReadFromFits(fis); 251 251 } -
trunk/SophyaExt/FitsIOServer/fitslocalmap.cc
r2897 r2898 93 93 long ncols = is.GetColInfo(colnames, coltypes, repcnt, width); 94 94 if (ncols < 1) return 0; 95 T x ;95 T x = 0; 96 96 if (coltypes[0] == FitsTypes::DataType(x)) return 2 ; 97 97 else return 1; -
trunk/SophyaExt/FitsIOServer/fitsmanager.cc
r2895 r2898 75 75 for(it = hlistp->begin(); it != hlistp->end(); it++) { 76 76 hfg = (*it).fhi->CheckHandling(o); 77 if (hfg < 1) continue; 77 78 if ( ( hfg > bhfg ) || ( (hfg == bhfg) && ((*it).glev > blev) ) ) { 78 79 fhi = (*it).fhi; bhfg = hfg; blev = (*it).glev; … … 114 115 for(it = hlistp->begin(); it != hlistp->end(); it++) { 115 116 hfg = (*it).fhi->CheckReadability(is); 117 if (hfg < 1) continue; 116 118 if ( ( hfg > bhfg ) || ( (hfg == bhfg) && ((*it).glev > blev) ) ) { 117 119 fhi = (*it).fhi; bhfg = hfg; blev = (*it).glev; … … 136 138 return fhi2; 137 139 } 140 141 /*! 142 \param filename : FITS file name to be scanned 143 \param os : infomation will be sent to formatted stream os 144 \param slev : scan level , bit 0 (1/3) print HDU keywords, 145 bit 2 (2,3) try to read HDU data using the appropraite handler 146 \param Rc : return number of scanned HDU's 147 */ 148 int FitsManager::ScanFile(string filename, ostream& os, int slev) 149 { 150 FitsInOutFile is(filename, FitsInOutFile::Fits_RO); 151 os << "=== FitsManager::ScanFile( " << filename << " ) NbHDUs= " 152 << is.NbHDUs() << endl; 153 int rc = 0; 154 for(int k=0; k<is.NbHDUs(); k++) { 155 os << " ------ HDU No " << is.CurrentHDU() << " Type= " 156 << is.CurrentHDUTypeStr() << endl; 157 int hdutyp = is.CurrentHDUType(); 158 if (hdutyp == IMAGE_HDU) { 159 long naxes[5] = {0,0,0,0,0}; 160 int naxis=5; 161 int imgtyp = is.GetImageHDUInfo(naxis, naxes); 162 os << ">> IMAGE_HDU: naxis= " << naxis << " : "; 163 for(int i=0; i<naxis; i++) { 164 if (i>0) os << " x " ; 165 os << naxes[i]; 166 } 167 os << endl; 168 } 169 else { 170 vector<string> colnames; 171 vector<int> coltypes; 172 vector<long> repcnt; 173 vector<long> width; 174 int ncols = is.GetColInfo(colnames, coltypes, repcnt, width); 175 if (hdutyp == BINARY_TBL) os << ">> BINARY_TBL : NRows= " << is.GetNbRows(); 176 else os << ">> ASCII_TBL : NRows= " << is.GetNbRows(); 177 os << " x NCols= " << ncols << endl; 178 for(int kk=0; kk<colnames.size(); kk++) { 179 os << "Col[" << kk+1 << "] Name= " << colnames[kk] 180 << " Type= " << FitsTypes::DataTypeToTypeString(coltypes[kk]) 181 << " Repeat= " << repcnt[kk] 182 << " W= " << width[kk] << endl; 183 } 184 } 185 // Fin the appropriate handler : 186 ChkHLP(); 187 FitsHandlerInterface * fhi = NULL; 188 HandlerList::iterator it; 189 string hdesc; 190 int hfg = 0; 191 int bhfg = 0; 192 int blev = 0; 193 for(it = hlistp->begin(); it != hlistp->end(); it++) { 194 hfg = (*it).fhi->CheckReadability(is); 195 if (hfg < 1) continue; 196 if ( ( hfg > bhfg ) || ( (hfg == bhfg) && ((*it).glev > blev) ) ) { 197 fhi = (*it).fhi; bhfg = hfg; blev = (*it).glev; hdesc = (*it).desc; 198 } 199 } 200 if (fhi == NULL) 201 os << ">>> Warning : No handler found for this HDU ... " << endl; 202 else 203 os << ">>> Reader/handler: " << hdesc << " : " 204 << typeid(*fhi).name() << " HandLevel= " << blev << ", " << bhfg << endl; 205 if (fhi && (slev >= 2)) { 206 os << ">>> Trying to read HDU data using the handler ..." << endl; 207 FitsHandlerInterface* fhic = fhi->Clone(); 208 fhic->Read(is); 209 os << " FitsHandler.Read() OK " << endl; 210 } 211 if ( (slev == 1) || (slev == 3) ) { 212 os << ">>>> HDU keywords list : " << endl; 213 DVList dvl; 214 is.GetHeaderRecords(dvl); 215 os << dvl; 216 } 217 os << " --------------------- " << endl; 218 is.MoveToNextHDU(); 219 rc++; 220 } 221 os << "===================================================" << endl; 222 return rc; 223 } -
trunk/SophyaExt/FitsIOServer/fitsmanager.h
r2895 r2898 4 4 #include "machdefs.h" 5 5 #include <string> 6 #include <iostream> 6 7 #include "fitsinoutfile.h" 7 8 … … 26 27 //! Finds the appropriate reader for the current HDU and reads the data form \b is 27 28 static FitsHandlerInterface * Read(FitsInOutFile& is); 29 //! Scans the fits file and prints information about each HDU on formatted stream \b os 30 static int ScanFile(string filename, ostream& os, int slev=0); 31 //! Scans the fits file and prints information about each HDU on \b cout 32 static inline int ScanFile(string filename, int slev=0) 33 { return ScanFile(filename, cout, slev); } 34 28 35 protected: 29 36 //! Finds the appropriate handler for the object \b o in the list of registered handlers. -
trunk/SophyaExt/FitsIOServer/fitsntuple.cc
r2897 r2898 61 61 string clsnm = is.KeyValue(key); 62 62 if (clsnm == "SOPHYA::NTuple") return 2; 63 key = "Content"; 64 if (is.KeyValue(key) == "NTuple") return 2; 63 65 else return 1; 64 66 } -
trunk/SophyaExt/FitsIOServer/fitsspherehealpix.cc
r2897 r2898 102 102 long ncols = is.GetColInfo(colnames, coltypes, repcnt, width); 103 103 if (ncols < 1) return 0; 104 T x ;104 T x = 0; 105 105 if (coltypes[0] == FitsTypes::DataType(x)) return 2 ; 106 106 else return 1; -
trunk/SophyaExt/FitsIOServer/fitsspherethetaphi.cc
r2897 r2898 94 94 long ncols = is.GetColInfo(colnames, coltypes, repcnt, width); 95 95 if (ncols < 1) return 0; 96 T x ;96 T x = 0; 97 97 if (coltypes[0] == FitsTypes::DataType(x)) return 2 ; 98 98 else return 1;
Note:
See TracChangeset
for help on using the changeset viewer.