Changeset 3688 in Sophya for trunk/AddOn/TAcq/minifits.cc
- Timestamp:
- Nov 29, 2009, 12:13:54 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddOn/TAcq/minifits.cc
r3684 r3688 220 220 buff[strlen(buff)] = ' '; 221 221 buff = header+320; 222 sprintf(buff, "NAXIS2 = %20ld / nb of rows = NumberOfPaquets", (long)nax2); 222 if (fgnax3) 223 sprintf(buff, "NAXIS2 = %20ld / Number of fibers ", (long)nax2); 224 else 225 sprintf(buff, "NAXIS2 = %20ld / nb of rows = NumberOfPaquets", (long)nax2); 223 226 buff[strlen(buff)] = ' '; 224 227 buff = header+400; 225 228 if (fgnax3) 226 sprintf(buff, "NAXIS3 = %20ld / nb of rows = NumberOfFibers", (long)nax3);229 sprintf(buff, "NAXIS3 = %20ld / Number of paquets ", (long)nax3); 227 230 else 228 231 strcpy(buff,"COMMENT BAO-Radio / MiniFITSFile "); … … 311 314 312 315 /* --Methode-- */ 316 string MiniFITSFile::GetKey(const char* key) 317 { 318 char rs[80]; 319 char cle[10]; 320 strncpy(cle,key,8); 321 cle[8]='='; 322 for(int i=0;i<8;i++) 323 if (cle[i]=='\0') cle[i]=' '; 324 cle[9]='\0'; 325 for(int kh=80; kh<2800; kh+=80) { 326 char * buff = header+kh; 327 if (strncmp(buff, cle, 9) == 0) { 328 strncpy(rs, buff+10, 70); 329 rs[70]='\0'; 330 break; 331 } 332 } 333 return rs; 334 } 335 336 /* --Methode-- */ 313 337 void MiniFITSFile::DecodeHeader() 314 338 { … … 322 346 bool fgok3=false; 323 347 for(int kh=80; kh<2800; kh+=80) { 324 325 326 327 328 // cout << " FOUND : NAXIS1= " << nax1 << endl;329 330 331 332 333 // cout << " FOUND : NAXIS2= " << nax2 << endl;334 335 336 337 338 // cout << " FOUND : NAXIS2= " << nax2 << endl;339 340 341 342 343 344 345 346 347 // cout << " FOUND : bpix= " << bpix << endl;348 348 buff = header+kh; 349 if (strncmp(buff, "NAXIS1 =", 9) == 0) { 350 nax1 = atol(buff+10); 351 fgok1 = true; 352 // cout << " FOUND : NAXIS1= " << nax1 << endl; 353 } 354 else if (strncmp(buff, "NAXIS2 =", 9) == 0) { 355 nax2 = atol(buff+10); 356 fgok2 = true; 357 // cout << " FOUND : NAXIS2= " << nax2 << endl; 358 } 359 else if (strncmp(buff, "NAXIS3 =", 9) == 0) { 360 nax3 = atol(buff+10); 361 fgok3 = true; 362 // cout << " FOUND : NAXIS2= " << nax2 << endl; 363 } 364 else if (strncmp(buff, "BITPIX =", 9) == 0) { 365 int bpix = atoi(buff+10); 366 fgokt = true; 367 if (bpix == 8) dtype = MF_Byte; 368 else if (bpix == 16) dtype = MF_Int16; 369 else if (bpix == -32) dtype = MF_Float32; 370 else fgokt = false; 371 // cout << " FOUND : bpix= " << bpix << endl; 372 } 349 373 } 350 374 if (!(fgok1&&fgok2&&fgokt)) 351 375 throw MiniFITSException("MiniFITSFile::DecodeHeader()/Error- Missing/wrong NAXIS1/2,BITPIX"); 352 376 if (fgok3) fgnax3=true; 353 377 return;
Note:
See TracChangeset
for help on using the changeset viewer.