Changeset 1757 for branches/alma/src/STWriter.cpp
- Timestamp:
- 06/09/10 19:03:06 (14 years ago)
- Location:
- branches/alma
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/alma
-
Property
svn:ignore
set to
.sconf_temp
.sconsign.dblite
-
Property
svn:mergeinfo
set to
/branches/asap-3.x merged eligible
-
Property
svn:ignore
set to
-
branches/alma/src/STWriter.cpp
r1683 r1757 42 42 #include <atnf/PKSIO/PKSMS2writer.h> 43 43 #include <atnf/PKSIO/PKSSDwriter.h> 44 #include <atnf/PKSIO/SrcType.h> 44 45 45 46 #include <tables/Tables/Table.h> … … 51 52 #include "STAsciiWriter.h" 52 53 #include "STHeader.h" 54 #include "STMath.h" 55 53 56 54 57 #include "STWriter.h" … … 104 107 const std::string &filename) 105 108 { 109 // If we write out foreign formats we have to convert the frequency system 110 // into the output frame, as we do everything related to SPectarlCoordinates 111 // in asap on-the-fly. 112 113 CountedPtr<Scantable> inst = in; 114 if (in->frequencies().getFrame(true) != in->frequencies().getFrame(false)) { 115 STMath stm(false); 116 inst = stm.frequencyAlign(in); 117 } 106 118 107 119 if (format_=="ASCII") { 108 120 STAsciiWriter iw; 121 // ASCII calls SpectralCoordinate::toWorld so no freqAlign use 'in' 109 122 if (iw.write(*in, filename)) { 110 123 return 0; … … 117 130 iw.setClass(True); 118 131 } 119 if (iw.write(*in , filename)) {132 if (iw.write(*inst, filename)) { 120 133 return 0; 121 134 } … … 127 140 // this is a little different from what I have done 128 141 // before. Need to check with the Offline User Test data 129 STHeader hdr = in ->getHeader();142 STHeader hdr = inst->getHeader(); 130 143 //const Int nPol = hdr.npol; 131 144 //const Int nChan = hdr.nchan; 132 std::vector<uint> ifs = in ->getIFNos();133 int nIF = in ->nif();//ifs.size();145 std::vector<uint> ifs = inst->getIFNos(); 146 int nIF = inst->nif();//ifs.size(); 134 147 Vector<uInt> nPol(nIF),nChan(nIF); 135 148 Vector<Bool> havexpol(nIF); 136 149 String fluxUnit = hdr.fluxunit; 137 150 fluxUnit.upcase(); 138 151 nPol = 0;nChan = 0; havexpol = False; 139 152 for (uint i=0;i<ifs.size();++i) { 140 nPol(ifs[i]) = in ->npol();141 nChan(ifs[i]) = in ->nchan(ifs[i]);153 nPol(ifs[i]) = inst->npol(); 154 nChan(ifs[i]) = inst->nchan(ifs[i]); 142 155 havexpol(ifs[i]) = nPol(ifs[i]) > 2; 143 156 } 144 145 const Table table = in->table(); 157 // Vector<String> obstypes(2); 158 // obstypes(0) = "TR";//on 159 // obstypes(1) = "RF TR";//off 160 const Table table = inst->table(); 161 146 162 147 163 // Create the output file and write static data. … … 155 171 throw(AipsError("Failed to create output file")); 156 172 } 157 158 173 159 174 Int count = 0; … … 206 221 String tcalt; 207 222 Vector<String> stmp0, stmp1; 208 in ->frequencies().getEntry(crpix,crval, pksrec.freqInc,223 inst->frequencies().getEntry(crpix,crval, pksrec.freqInc, 209 224 rec.asuInt("FREQ_ID")); 210 in ->focus().getEntry(pksrec.focusAxi, pksrec.focusTan,211 pksrec.focusRot, tmp0,tmp1,tmp2,tmp3,tmp4,212 rec.asuInt("FOCUS_ID"));213 in ->molecules().getEntry(pksrec.restFreq,stmp0,stmp1,225 inst->focus().getEntry(pksrec.parAngle, pksrec.focusAxi, pksrec.focusTan, 226 pksrec.focusRot, tmp0,tmp1,tmp2,tmp3,tmp4, 227 rec.asuInt("FOCUS_ID")); 228 inst->molecules().getEntry(pksrec.restFreq,stmp0,stmp1, 214 229 rec.asuInt("MOLECULE_ID")); 215 in ->tcal().getEntry(pksrec.tcalTime, pksrec.tcal,230 inst->tcal().getEntry(pksrec.tcalTime, pksrec.tcal, 216 231 rec.asuInt("TCAL_ID")); 217 in ->weather().getEntry(pksrec.temperature, pksrec.pressure,232 inst->weather().getEntry(pksrec.temperature, pksrec.pressure, 218 233 pksrec.humidity, pksrec.windSpeed, 219 234 pksrec.windAz, rec.asuInt("WEATHER_ID")); … … 230 245 pksrec.fieldName = rec.asString("FIELDNAME"); 231 246 pksrec.srcName = rec.asString("SRCNAME"); 232 pksrec.obsType = hdr.obstype; 247 //pksrec.obsType = obstypes[rec.asInt("SRCTYPE")]; 248 pksrec.obsType = getObsTypes( rec.asInt("SRCTYPE") ) ; 233 249 pksrec.bandwidth = nchan * abs(pksrec.freqInc); 234 250 pksrec.azimuth = rec.asFloat("AZIMUTH"); 235 251 pksrec.elevation = rec.asFloat("ELEVATION"); 236 pksrec.parAngle = rec.asFloat("PARANGLE");237 252 pksrec.refBeam = rec.asInt("REFBEAMNO") + 1; 238 253 pksrec.sigma.resize(npol); … … 293 308 { 294 309 String poltype = tab.keywordSet().asString("POLTYPE"); 295 if ( poltype == "stokes") { 310 // Full stokes is not supported. Just allow stokes I 311 if ( poltype == "stokes" && tab.nrow() != 1) { 296 312 String msg = "poltype = " + poltype + " not yet supported in output."; 297 313 throw(AipsError(msg)); … … 340 356 } 341 357 342 } 358 // get obsType string from SRCTYPE value 359 String STWriter::getObsTypes( Int srctype ) 360 { 361 String obsType ; 362 switch( srctype ) { 363 case Int(SrcType::PSON): 364 obsType = "PSON" ; 365 break ; 366 case Int(SrcType::PSOFF): 367 obsType = "PSOFF" ; 368 break ; 369 case Int(SrcType::NOD): 370 obsType = "NOD" ; 371 break ; 372 case Int(SrcType::FSON): 373 obsType = "FSON" ; 374 break ; 375 case Int(SrcType::FSOFF): 376 obsType = "FSOFF" ; 377 break ; 378 case Int(SrcType::SKY): 379 obsType = "SKY" ; 380 break ; 381 case Int(SrcType::HOT): 382 obsType = "HOT" ; 383 break ; 384 case Int(SrcType::WARM): 385 obsType = "WARM" ; 386 break ; 387 case Int(SrcType::COLD): 388 obsType = "COLD" ; 389 break ; 390 case Int(SrcType::PONCAL): 391 obsType = "PSON:CALON" ; 392 break ; 393 case Int(SrcType::POFFCAL): 394 obsType = "PSOFF:CALON" ; 395 break ; 396 case Int(SrcType::NODCAL): 397 obsType = "NOD:CALON" ; 398 break ; 399 case Int(SrcType::FONCAL): 400 obsType = "FSON:CALON" ; 401 break ; 402 case Int(SrcType::FOFFCAL): 403 obsType = "FSOFF:CALOFF" ; 404 break ; 405 case Int(SrcType::FSLO): 406 obsType = "FSLO" ; 407 break ; 408 case Int(SrcType::FLOOFF): 409 obsType = "FS:LOWER:OFF" ; 410 break ; 411 case Int(SrcType::FLOSKY): 412 obsType = "FS:LOWER:SKY" ; 413 break ; 414 case Int(SrcType::FLOHOT): 415 obsType = "FS:LOWER:HOT" ; 416 break ; 417 case Int(SrcType::FLOWARM): 418 obsType = "FS:LOWER:WARM" ; 419 break ; 420 case Int(SrcType::FLOCOLD): 421 obsType = "FS:LOWER:COLD" ; 422 break ; 423 case Int(SrcType::FSHI): 424 obsType = "FSHI" ; 425 break ; 426 case Int(SrcType::FHIOFF): 427 obsType = "FS:HIGHER:OFF" ; 428 break ; 429 case Int(SrcType::FHISKY): 430 obsType = "FS:HIGHER:SKY" ; 431 break ; 432 case Int(SrcType::FHIHOT): 433 obsType = "FS:HIGHER:HOT" ; 434 break ; 435 case Int(SrcType::FHIWARM): 436 obsType = "FS:HIGHER:WARM" ; 437 break ; 438 case Int(SrcType::FHICOLD): 439 obsType = "FS:HIGHER:COLD" ; 440 break ; 441 default: 442 obsType = "NOTYPE" ; 443 } 444 445 return obsType ; 446 } 447 448 }
Note: See TracChangeset
for help on using the changeset viewer.