Changeset 470
- Timestamp:
- 02/18/05 11:11:53 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/SDWriter.cc
r450 r470 1 1 //#--------------------------------------------------------------------------- 2 2 //# SDWriter.cc: ASAP class to write out single dish spectra. 3 3 //#--------------------------------------------------------------------------- … … 33 33 34 34 #include <casa/aips.h> 35 #include <casa/Arrays.h> 35 #include <casa/Arrays/Array.h> 36 #include <casa/Arrays/Vector.h> 36 37 #include <casa/BasicSL/Complex.h> 37 38 #include <casa/Utilities/CountedPtr.h> 39 #include <casa/Utilities/Assert.h> 38 40 39 41 #include <atnf/PKSIO/PKSMS2writer.h> … … 41 43 42 44 #include <tables/Tables/ArrayColumn.h> 45 46 43 47 44 48 … … 48 52 #include "SDFITSImageWriter.h" 49 53 #include "SDAsciiWriter.h" 54 #include "SDPol.h" 50 55 51 56 using namespace casa; … … 147 152 const Int nPol = hdr.npol; 148 153 const Int nChan = hdr.nchan; 149 if (toStokes) {150 cerr << "Stokes conversion not yet available with SDFITS or MS" << endl;151 }152 154 153 155 // Get Freq table … … 182 184 Int cycleNo; 183 185 Double mjd0 = 0.0; 184 186 // 187 Array<Float> spectra, tSys, stokes; 188 Array<uChar> flags; 189 Bool doLinear = True; 190 // 185 191 Int count = 0; 186 192 for (Int iRow = 0; iRow < in->nRow(); iRow++) { … … 198 204 freqIDCol.get(iRow, freqIDs); 199 205 206 // Get Stokes array (all beams/IFs/Stokes). Its not in SDContainer 207 if (toStokes) { 208 stokes = in->getStokesSpectrum(iRow,-1,-1); 209 } 210 211 IPosition start(asap::nAxes,0); 212 IPosition end(stokes.shape()-1); 213 200 214 // Write it out beam by beam. 201 215 for (Int iBeam = 0; iBeam < hdr.nbeam; iBeam++) { 216 start(asap::BeamAxis) = iBeam; 217 end(asap::BeamAxis) = iBeam; 202 218 203 219 // Write it out IF by IF. 204 220 for (Int iIF = 0; iIF < hdr.nif; iIF++) { 221 start(asap::IFAxis) = iIF; 222 end(asap::IFAxis) = iIF; 205 223 uInt freqID = freqIDs(iIF); 206 224 … … 242 260 Complex xCalFctr; 243 261 Vector<Complex> xPol; 262 263 // Get data. 264 265 if (toStokes) { 266 267 // Big pain in the ass because 268 // 1) Stokes vector may have less polarizations than input 269 // 2) Stokes column virtual and not in SDContainer 270 // 3) Tsys and FLags already selected for IF and Beam 271 // 3) Have to flip order 272 273 Array<Float> t = sd.getTsys(iBeam,iIF); 274 tSys = SDPolUtil::computeStokesTSysForWriter (t, doLinear); 275 Array<uChar> t2 = sd.getFlags(iBeam,iIF); 276 flags = SDPolUtil::computeStokesFlagsForWriter (t2, doLinear); 277 spectra = SDPolUtil::extractStokesForWriter (stokes,start,end); 278 } else { 279 tSys = sd.getTsys(iBeam,iIF); 280 flags = sd.getFlags(iBeam,iIF); 281 spectra = sd.getSpectrum(iBeam,iIF); 282 } 244 283 // 245 284 if (status = cWriter->write(sd.scanid, cycleNo, sd.timestamp, … … 255 294 sd.getDirection(iBeam), 256 295 scanRate, 257 sd.getTsys(iBeam, iIF), sigma, calFctr,296 tSys, sigma, calFctr, 258 297 baseLin, baseSub, 259 sd.getSpectrum(iBeam, iIF), 260 sd.getFlags(iBeam, iIF), 298 spectra, flags, 261 299 xCalFctr, xPol)) { 262 300 cerr << "Error writing output file." << endl; … … 274 312 return 0; 275 313 } 314 315
Note:
See TracChangeset
for help on using the changeset viewer.