Legend:
- Unmodified
- Added
- Removed
-
trunk/src/SDPol.cc
r437 r440 35 35 #include <casa/Arrays/Array.h> 36 36 #include <casa/Arrays/ArrayMath.h> 37 #include <casa/Arrays/ArrayLogical.h> 37 38 #include <casa/Containers/Record.h> 38 39 #include <casa/BasicSL/Constants.h> … … 179 180 const uInt polAxis = asap::PolAxis; 180 181 const uInt nPol = inputShape(polAxis); 181 AlwaysAssert(nPol==1 || nPol==2 || nPol== 3, AipsError);182 AlwaysAssert(nPol==1 || nPol==2 || nPol==4, AipsError); 182 183 183 184 // The silly Array slice operator does not give me back … … 322 323 } 323 324 325 Array<Bool> SDPolUtil::stokesMask (Array<Bool> rawFlags, 326 Bool doLinear) 327 // 328 // Generate mask for each Stokes parameter from the 329 // raw flags. This is a lot of computational work and may 330 // not be worth the effort. 331 // 332 { 333 IPosition shapeIn = rawFlags.shape(); 334 uInt nPol = shapeIn(asap::PolAxis); 335 const uInt nDim = shapeIn.nelements(); 336 Array<Bool> stokesFlags; 337 // 338 IPosition start(nDim,0); 339 IPosition end(shapeIn-1); 340 IPosition shapeOut = shapeIn; 341 // 342 if (doLinear) { 343 if (nPol==1) { 344 stokesFlags.resize(shapeOut); 345 stokesFlags = rawFlags; 346 } else if (nPol==2 || nPol==4) { 347 348 // Set shape of output array 349 350 if (nPol==2) { 351 shapeOut(asap::PolAxis) = 1; 352 } else { 353 shapeOut(asap::PolAxis) = 4; 354 } 355 stokesFlags.resize(shapeOut); 356 357 // Get reference slices and assign/compute 358 359 start(asap::PolAxis) = 0; 360 end(asap::PolAxis) = 0; 361 Array<Bool> M1In = rawFlags(start,end); 362 // 363 start(asap::PolAxis) = 1; 364 end(asap::PolAxis) = 1; 365 Array<Bool> M2In = rawFlags(start,end); 366 // 367 start(asap::PolAxis) = 0; 368 end(asap::PolAxis) = 0; 369 Array<Bool> M1Out = stokesFlags(start,end); 370 M1Out = M1In && M2In; // I 371 // 372 if (nPol==4) { 373 start(asap::PolAxis) = 2; 374 end(asap::PolAxis) = 2; 375 Array<Bool> M3In = rawFlags(start,end); 376 // 377 start(asap::PolAxis) = 3; 378 end(asap::PolAxis) = 3; 379 Array<Bool> M4In = rawFlags(start,end); 380 // 381 start(asap::PolAxis) = 1; 382 end(asap::PolAxis) = 1; 383 Array<Bool> M2Out = stokesFlags(start,end); 384 M2Out = M1Out; // Q 385 // 386 start(asap::PolAxis) = 2; 387 end(asap::PolAxis) = 2; 388 Array<Bool> M3Out = stokesFlags(start,end); 389 M3Out = M3In; // U 390 // 391 start(asap::PolAxis) = 3; 392 end(asap::PolAxis) = 3; 393 Array<Bool> M4Out = stokesFlags(start,end); 394 M4Out = M4In; // V 395 } 396 } else { 397 throw(AipsError("Can only handle 1,2 or 4 polarizations")); 398 } 399 } else { 400 throw (AipsError("Only implemented for Linear polarizations")); 401 } 402 // 403 return stokesFlags; 404 } -
trunk/src/SDPol.h
r438 r440 63 63 // Compute Circular polarization RR or LL from I and V 64 64 static casa::Array<casa::Float> circularPolarizationFromStokes (casa::Array<casa::Float>& I, 65 casa::Array<casa::Float>& V, 65 casa::Array<casa::Float>& V, 66 66 casa::Bool doRR); 67 68 // Compute Mask for STokes parameters from raw correlation masks 69 // Gets output shape right (e.g. XX,YY -> I) 70 static casa::Array<casa::Bool> stokesMask (casa::Array<casa::Bool> rawFlags, 71 casa::Bool doLinear); 72 67 73 }; 68 74
Note:
See TracChangeset
for help on using the changeset viewer.