Line data Source code
1 : //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003 2 : //# Associated Universities, Inc. Washington DC, USA. 3 : //# 4 : //# This library is free software; you can redistribute it and/or modify it 5 : //# under the terms of the GNU Library General Public License as published by 6 : //# the Free Software Foundation; either version 2 of the License, or (at your 7 : //# option) any later version. 8 : //# 9 : //# This library is distributed in the hope that it will be useful, but WITHOUT 10 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 : //# License for more details. 13 : //# 14 : //# You should have received a copy of the GNU Library General Public License 15 : //# along with this library; if not, write to the Free Software Foundation, 16 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 17 : //# 18 : //# Correspondence concerning AIPS++ should be addressed as follows: 19 : //# Internet email: casa-feedback@nrao.edu. 20 : //# Postal address: AIPS++ Project Office 21 : //# National Radio Astronomy Observatory 22 : //# 520 Edgemont Road 23 : //# Charlottesville, VA 22903-2475 USA 24 : //# 25 : 26 : #include <imageanalysis/ImageAnalysis/ImageTotalPolarization.h> 27 : 28 : using namespace casacore; 29 : namespace casa { 30 : 31 : const String ImageTotalPolarization::CLASS_NAME = "ImageTotalPolarization"; 32 : 33 0 : ImageTotalPolarization::ImageTotalPolarization( 34 : const SPCIIF image, const String& outname, Bool overwrite 35 0 : ) : ImagePolTask(image, outname, overwrite) {} 36 : 37 0 : ImageTotalPolarization::~ImageTotalPolarization() {} 38 : 39 0 : SPIIF ImageTotalPolarization::compute() { 40 0 : *_getLog() << LogOrigin(CLASS_NAME, __func__); 41 0 : ImageExpr<Float> expr = _totPolInt(); 42 0 : auto out = _prepareOutputImage(expr); 43 0 : if (_debias) { 44 0 : _maskAndZeroNaNs(out); 45 : } 46 0 : return out; 47 0 : } 48 : 49 0 : String ImageTotalPolarization::getClass() const { 50 0 : return CLASS_NAME; 51 : } 52 : 53 0 : void ImageTotalPolarization::setClip(Float clip) { 54 0 : _clip = clip; 55 0 : } 56 : 57 0 : void ImageTotalPolarization::setDebias(Bool debias) { 58 0 : _debias = debias; 59 0 : } 60 : 61 0 : void ImageTotalPolarization::setSigma(Float sigma) { 62 0 : _sigma = sigma; 63 0 : } 64 : 65 0 : ImageExpr<Float> ImageTotalPolarization::_totPolInt() { 66 0 : *_getLog() << LogOrigin(CLASS_NAME, __func__, WHERE); 67 : Bool doLin, doCirc; 68 0 : _setDoLinDoCirc(doLin, doCirc, False); 69 : // Make node. 70 0 : LatticeExprNode node = _makePolIntNode(_debias, _clip, _sigma, doLin, doCirc); 71 : // Make expression 72 0 : LatticeExpr<Float> le(node); 73 0 : ImageExpr<Float> ie(le, "totalPolarizedIntensity"); 74 0 : ie.setUnits(_getImage()->units()); // Dodgy. The beam is now rectified 75 0 : StokesTypes stokes = _getStokesImage(Q) ? Q : _getStokesImage(U) ? U : V; 76 0 : _setInfo(ie, stokes); 77 : // Fiddle Stokes coordinate in ImageExpr 78 0 : _fiddleStokesCoordinate(ie, doCirc ? Stokes::Ptotal : Stokes::Plinear); 79 0 : return ie; 80 0 : } 81 : 82 : }