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 12 : ImageTotalPolarization::ImageTotalPolarization( 34 : const SPCIIF image, const String& outname, Bool overwrite 35 12 : ) : ImagePolTask(image, outname, overwrite) {} 36 : 37 12 : ImageTotalPolarization::~ImageTotalPolarization() {} 38 : 39 12 : SPIIF ImageTotalPolarization::compute() { 40 12 : *_getLog() << LogOrigin(CLASS_NAME, __func__); 41 12 : ImageExpr<Float> expr = _totPolInt(); 42 12 : auto out = _prepareOutputImage(expr); 43 12 : if (_debias) { 44 1 : _maskAndZeroNaNs(out); 45 : } 46 24 : return out; 47 12 : } 48 : 49 0 : String ImageTotalPolarization::getClass() const { 50 0 : return CLASS_NAME; 51 : } 52 : 53 12 : void ImageTotalPolarization::setClip(Float clip) { 54 12 : _clip = clip; 55 12 : } 56 : 57 12 : void ImageTotalPolarization::setDebias(Bool debias) { 58 12 : _debias = debias; 59 12 : } 60 : 61 12 : void ImageTotalPolarization::setSigma(Float sigma) { 62 12 : _sigma = sigma; 63 12 : } 64 : 65 12 : ImageExpr<Float> ImageTotalPolarization::_totPolInt() { 66 12 : *_getLog() << LogOrigin(CLASS_NAME, __func__, WHERE); 67 : Bool doLin, doCirc; 68 12 : _setDoLinDoCirc(doLin, doCirc, False); 69 : // Make node. 70 12 : LatticeExprNode node = _makePolIntNode(_debias, _clip, _sigma, doLin, doCirc); 71 : // Make expression 72 12 : LatticeExpr<Float> le(node); 73 24 : ImageExpr<Float> ie(le, "totalPolarizedIntensity"); 74 12 : ie.setUnits(_getImage()->units()); // Dodgy. The beam is now rectified 75 12 : StokesTypes stokes = _getStokesImage(Q) ? Q : _getStokesImage(U) ? U : V; 76 12 : _setInfo(ie, stokes); 77 : // Fiddle Stokes coordinate in ImageExpr 78 12 : _fiddleStokesCoordinate(ie, doCirc ? Stokes::Ptotal : Stokes::Plinear); 79 24 : return ie; 80 12 : } 81 : 82 : }