Changeset 1779 for branches/mergetest/external/atnf/PKSIO/PKSFITSreader.cc
- Timestamp:
- 07/29/10 19:13:46 (14 years ago)
- Location:
- branches/mergetest
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/mergetest
- Property svn:mergeinfo changed
-
branches/mergetest/external/atnf/PKSIO/PKSFITSreader.cc
r1720 r1779 34 34 //#--------------------------------------------------------------------------- 35 35 36 #include <atnf/PKSIO/PKSmsg.h>37 36 #include <atnf/PKSIO/MBFITSreader.h> 38 37 #include <atnf/PKSIO/SDFITSreader.h> … … 44 43 #include <casa/BasicMath/Math.h> 45 44 #include <casa/Quanta/MVTime.h> 45 #include <casa/Logging/LogIO.h> 46 46 47 47 //----------------------------------------------- PKSFITSreader::PKSFITSreader … … 61 61 cReader = new MBFITSreader(retry, interpolate ? 1 : 0); 62 62 } 63 64 // By default, messages are written to stderr.65 initMsg();66 63 } 67 64 … … 76 73 } 77 74 78 //------------------------------------------------------ PKSFITSreader::setMsg79 80 // Set message disposition. If fd is non-zero messages will be written81 // to that file descriptor, else stored for retrieval by getMsg().82 83 Int PKSFITSreader::setMsg(FILE *fd)84 {85 PKSmsg::setMsg(fd);86 cReader->setMsg(fd);87 88 return 0;89 }90 91 75 //-------------------------------------------------------- PKSFITSreader::open 92 76 … … 95 79 Int PKSFITSreader::open( 96 80 const String fitsName, 81 const String antenna, 97 82 Vector<Bool> &beams, 98 83 Vector<Bool> &IFs, … … 103 88 Bool &haveSpectra) 104 89 { 105 clearMsg();106 107 90 int extraSysCal, haveBase_, *haveXPol_, haveSpectra_, nBeam, *nChan_, 108 91 nIF, *nPol_, status; … … 110 93 nChan_, nPol_, haveXPol_, haveBase_, haveSpectra_, 111 94 extraSysCal); 112 logMsg(cReader->getMsg());113 cReader->clearMsg();95 //logMsg(cReader->getMsg()); 96 //cReader->clearMsg(); 114 97 if (status) { 115 98 return status; … … 178 161 obsType_, bunit_, equinox_, radecsys, 179 162 dopplerFrame_, datobs, utc, refFreq, bandwidth); 180 logMsg(cReader->getMsg());181 cReader->clearMsg();163 //logMsg(cReader->getMsg()); 164 //cReader->clearMsg(); 182 165 if (status) { 183 166 return 1; … … 218 201 Int status = cReader->getFreqInfo(nIF, startfreq, endfreq); 219 202 220 logMsg(cReader->getMsg());221 cReader->clearMsg();203 //logMsg(cReader->getMsg()); 204 //cReader->clearMsg(); 222 205 if (!status) { 223 206 startFreq.takeStorage(IPosition(1,nIF), startfreq, TAKE_OVER); … … 240 223 const Bool getSpectra, 241 224 const Bool getXPol, 225 const Bool getFeedPos, 226 const Bool getPointing, 242 227 const Int coordSys) 243 228 { … … 307 292 cGetSpectra = getSpectra; 308 293 cGetXPol = getXPol; 294 cGetFeedPos = getFeedPos; 295 cGetPointing = getPointing; 309 296 cCoordSys = coordSys; 310 297 311 298 uInt maxNChan = cReader->select(start, end, ref, cGetSpectra, cGetXPol, 312 c CoordSys);313 logMsg(cReader->getMsg());314 cReader->clearMsg();299 cGetFeedPos, cGetPointing, cCoordSys); 300 //logMsg(cReader->getMsg()); 301 //cReader->clearMsg(); 315 302 316 303 delete [] end; … … 336 323 337 324 Int status = cReader->findRange(nRow, nSel, dateSpan, utcSpan, posns); 338 logMsg(cReader->getMsg());339 cReader->clearMsg();325 //logMsg(cReader->getMsg()); 326 //cReader->clearMsg(); 340 327 341 328 if (!status) { … … 361 348 { 362 349 Int status = cReader->read(cMBrec); 363 logMsg(cReader->getMsg());364 cReader->clearMsg();350 //logMsg(cReader->getMsg()); 351 //cReader->clearMsg(); 365 352 366 353 if (status) { … … 378 365 pksrec.scanNo = cMBrec.scanNo; 379 366 pksrec.cycleNo = cMBrec.cycleNo; 367 pksrec.polNo = cMBrec.polNo ; 380 368 381 369 // Extract MJD. 382 370 Int day, month, year; 383 sscanf(cMBrec.datobs, "%4d-%2d-%2d", &year, &month, &day); 384 pksrec.mjd = MVTime(year, month, Double(day)).day() + cMBrec.utc/86400.0; 371 if ( strstr( cMBrec.datobs, "T" ) == NULL ) { 372 sscanf(cMBrec.datobs, "%4d-%2d-%2d", &year, &month, &day); 373 pksrec.mjd = MVTime(year, month, Double(day)).day() + cMBrec.utc/86400.0; 374 } 375 else { 376 Double dd, hour, min, sec ; 377 sscanf( cMBrec.datobs, "%4d-%2d-%2lfT%lf:%lf:%lf", &year, &month, &dd, &hour, &min, &sec ) ; 378 dd = dd + ( hour * 3600.0 + min * 60.0 + sec ) / 86400.0 ; 379 pksrec.mjd = MVTime(year, month, dd).day() ; 380 } 385 381 386 382 pksrec.interval = cMBrec.exposure; … … 388 384 pksrec.fieldName = trim(cMBrec.srcName); 389 385 pksrec.srcName = pksrec.fieldName; 386 387 int namelen = pksrec.srcName.length() ; 388 if ( namelen > 4 ) { 389 String srcsub = pksrec.srcName.substr( namelen-4, 4 ) ; 390 if ( srcsub.find( "_psc" ) != string::npos ) { 391 pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ; 392 pksrec.srcName = pksrec.fieldName + "_ps_calon" ; 393 } 394 else if ( srcsub.find( "_pso" ) != string::npos ) { 395 pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ; 396 pksrec.srcName = pksrec.fieldName + "_ps" ; 397 } 398 else if ( srcsub.find( "_prc" ) != string::npos ) { 399 pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ; 400 pksrec.srcName = pksrec.fieldName + "_psr_calon" ; 401 } 402 else if ( srcsub.find( "_pro" ) != string::npos ) { 403 pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ; 404 pksrec.srcName = pksrec.fieldName + "_psr" ; 405 } 406 else if ( srcsub.find( "_fsc" ) != string::npos ) { 407 pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ; 408 pksrec.srcName = pksrec.fieldName + "_fs_calon" ; 409 } 410 else if ( srcsub.find( "_fso" ) != string::npos ) { 411 pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ; 412 pksrec.srcName = pksrec.fieldName + "_fs" ; 413 } 414 else if ( srcsub.find( "_frc" ) != string::npos ) { 415 pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ; 416 pksrec.srcName = pksrec.fieldName + "_fsr_calon" ; 417 } 418 else if ( srcsub.find( "_fro" ) != string::npos ) { 419 pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ; 420 pksrec.srcName = pksrec.fieldName + "_fsr" ; 421 } 422 else if ( srcsub.find( "_nsc" ) != string::npos || srcsub.find( "_nrc" ) != string::npos ) { 423 pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ; 424 pksrec.srcName = pksrec.fieldName + "_nod_calon" ; 425 } 426 else if ( srcsub.find( "_nso" ) != string::npos || srcsub.find( "_nro" ) != string::npos ) { 427 pksrec.fieldName = pksrec.srcName.substr( 0, namelen-4 ) ; 428 pksrec.srcName = pksrec.fieldName + "_nod" ; 429 } 430 } 390 431 391 432 pksrec.srcDir.resize(2); … … 396 437 pksrec.srcPM(0) = 0.0; 397 438 pksrec.srcPM(1) = 0.0; 398 pksrec.srcVel = 0.0;439 pksrec.srcVel = cMBrec.srcVelocity; 399 440 pksrec.obsType = trim(cMBrec.obsType); 400 441 … … 404 445 pksrec.bandwidth = chanWidth * nChan; 405 446 pksrec.freqInc = cMBrec.fqDelt[0]; 406 pksrec.restFreq = cMBrec.restFreq; 447 pksrec.restFreq.resize(1) ; 448 pksrec.restFreq(0) = cMBrec.restFreq; 407 449 408 450 pksrec.tcal.resize(nPol); … … 498 540 { 499 541 cReader->close(); 500 logMsg(cReader->getMsg());501 cReader->clearMsg();542 //logMsg(cReader->getMsg()); 543 //cReader->clearMsg(); 502 544 } 503 545
Note:
See TracChangeset
for help on using the changeset viewer.