LCOV - code coverage report
Current view: top level - imageanalysis/ImageAnalysis - ImagePolarimetry.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 8 0.0 %
Date: 2024-10-04 18:58:15 Functions: 0 4 0.0 %

          Line data    Source code
       1             : //# ImagePolarimetry.h: Polarimetric analysis of images
       2             : //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002
       3             : //# Associated Universities, Inc. Washington DC, USA.
       4             : //#
       5             : //# This library is free software; you can redistribute it and/or modify it
       6             : //# under the terms of the GNU Library General Public License as published by
       7             : //# the Free Software Foundation; either version 2 of the License, or (at your
       8             : //# option) any later version.
       9             : //#
      10             : //# This library is distributed in the hope that it will be useful, but WITHOUT
      11             : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      12             : //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
      13             : //# License for more details.
      14             : //#
      15             : //# You should have received a copy of the GNU Library General Public License
      16             : //# along with this library; if not, write to the Free Software Foundation,
      17             : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
      18             : //#
      19             : //# Correspondence concerning AIPS++ should be addressed as follows:
      20             : //#        Internet email: casa-feedback@nrao.edu.
      21             : //#        Postal address: AIPS++ Project Office
      22             : //#                        National Radio Astronomy Observatory
      23             : //#                        520 Edgemont Road
      24             : //#                        Charlottesville, VA 22903-2475 USA
      25             : //#
      26             : //# $Id: ImagePolarimetry.h 19817 2006-12-22 05:24:00Z gvandiep $
      27             : 
      28             : #ifndef IMAGES_IMAGEPOLARIMETRY_H
      29             : #define IMAGES_IMAGEPOLARIMETRY_H
      30             : 
      31             : #include <casacore/casa/aips.h>
      32             : #include <casacore/casa/Arrays/Vector.h>
      33             : #include <casacore/casa/Containers/Block.h> 
      34             : #include <casacore/measures/Measures/Stokes.h>
      35             : #include <casacore/casa/BasicSL/Complex.h>
      36             : #include <casacore/images/Images/ImageInterface.h>
      37             : #include <casacore/scimath/Fitting/LinearFitSVD.h>
      38             : 
      39             : #include <imageanalysis/ImageTypedefs.h>
      40             : 
      41             : namespace casacore{
      42             : 
      43             : template <class T> class SubImage;
      44             : template <class T> class ImageExpr;
      45             : template <class T> class Quantum;
      46             : template <class T> class LatticeStatistics;
      47             : class CoordinateSystem;
      48             : class IPosition;
      49             : class LatticeExprNode;
      50             : class LCBox;
      51             : class LogIO;
      52             : }
      53             : 
      54             : namespace casa {
      55             : 
      56             : // <summary>
      57             : // Polarimetric analysis of images
      58             : // </summary>
      59             : 
      60             : // <use visibility=export>
      61             : 
      62             : // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
      63             : // </reviewed>
      64             : 
      65             : // <prerequisite>
      66             : //   <li> <linkto class=casacore::ImageExpr>ImageExpr</linkto>
      67             : //   <li> <linkto class=casacore::ImageInterface>ImageInterface</linkto>
      68             : // </prerequisite>
      69             : 
      70             : // <etymology>
      71             : //  Polarimetric analysis of Images
      72             : // </etymology>
      73             : 
      74             : // <synopsis>
      75             : // This class provides polarimetric image analysis capability.
      76             : // It takes an image with a casacore::Stokes axis (some combination
      77             : // of IQUV is needed) as its input.
      78             : //
      79             : // Many functions return casacore::ImageExpr objects.  These are
      80             : // read-only images.
      81             : //
      82             : // Sometimes the standard deviation of the noise is needed.
      83             : // This is for debiasing polarized intensity images or working out
      84             : // error images.  By default it is worked out for you with a
      85             : // clipped mean algorithm.  However, you can provide sigma if you
      86             : // know it accurately.   It should be the standard deviation of the noise in
      87             : // the absence of signal.  You won't measure that very well from
      88             : // casacore::Stokes I if it is dynamic range limited.  Better to get it from 
      89             : // V or Q or U.  When this class needs the standard deviation of
      90             : // the noise, it will try and get it from V or Q and U and finally I.
      91             : //
      92             : // However, note that the functions sigmaStokes{I,Q,U,V} DO return the standard
      93             : // deviation of the noise for that specific casacore::Stokes type.
      94             : //
      95             : // The ImageExpr objects returned have the brightness units and ImageInfo
      96             : // set.  The MiscInfo (a permanent record) and logSink are not set.
      97             : // 
      98             : // </synopsis>
      99             : //
     100             : // <motivation>
     101             : // Basic image analysis capability
     102             : // </motivation>
     103             : 
     104             : // <todo asof="1999/11/01">
     105             : //   <li> plotting for function rotationMeasure 
     106             : //   <li> some assessment of the curvature of pa-l**2
     107             : // </todo>
     108             : 
     109             : class ImagePolarimetry {
     110             : public:
     111             : 
     112             :     // casacore::Stokes types
     113             :     enum StokesTypes {I, Q, U, V};
     114             : 
     115             :     // Constructor.  The input image must have a Stokes
     116             :     // axis with some subset of I,Q,U, and V
     117             :     ImagePolarimetry (const casacore::ImageInterface<casacore::Float>& image);
     118             : 
     119             :     // Copy constructor (reference semantics)
     120             :     ImagePolarimetry(const ImagePolarimetry& other);
     121             : 
     122             :     // Destructor
     123             :     ~ImagePolarimetry ();
     124             :    
     125             :     // Assignment operator (reference semantics)
     126             :     ImagePolarimetry& operator=(const ImagePolarimetry& other);
     127             : 
     128             :     // Summary.  Just invokes the casacore::ImageSummary list function
     129             :     // to summarize the header of the construction image
     130             :     void summary(casacore::LogIO& os) const;
     131             : 
     132             :     // Get the casacore::ImageInterface pointer of the construction image
     133             :     // Don't delete it !
     134           0 :     SPCIIF imageInterface() const {
     135           0 :         return _image;
     136             :     }
     137             : 
     138             :     // Get the casacore::CoordinateSystem of the construction image
     139           0 :     casacore::CoordinateSystem coordinates() const {
     140           0 :         return _image->coordinates();
     141             :     }
     142             : 
     143             :     // Get the shape of the construction image
     144           0 :     casacore::IPosition shape() const {
     145           0 :         return _image->shape();
     146             :     }
     147             : 
     148             :     // Is the construction image masked ?
     149           0 :     casacore::Bool isMasked() const {
     150           0 :         return _image->isMasked();
     151             :     }
     152             : 
     153             :     // Get the shape and casacore::CoordinateSystem of an image for a single
     154             :     // Stokes pixel. Thus, if the construction image shape was [10,10,4,20]
     155             :     // where axis 2 (shape 4) is the casacore::Stokes axis, this function
     156             :     // would return [10,10,1,20]    Specify the type of casacore::Stokes pixel
     157             :     // you want.
     158             :     casacore::IPosition singleStokesShape(
     159             :         casacore::CoordinateSystem& cSys, casacore::Stokes::StokesTypes type
     160             :     ) const;
     161             : 
     162             :     // Complex linear polarization
     163             :     casacore::ImageExpr<casacore::Complex> complexLinearPolarization ();
     164             : 
     165             :     // casacore::Complex fractional linear polarization
     166             :     casacore::ImageExpr<casacore::Complex>
     167             :     complexFractionalLinearPolarization ();
     168             : 
     169             :     // Get the Stokes I image and the standard deviation of the
     170             :     // I image.  This  is worked out by first clipping
     171             :     // outliers from the mean at the specified level.
     172             :     // <group>
     173             :     casacore::ImageExpr<casacore::Float> stokesI() const;
     174             :     casacore::Float sigmaStokesI (casacore::Float clip=10.0);
     175             :     // </group>
     176             : 
     177             :     // Get the casacore::Stokes Q image and the standard deviation
     178             :     // of the Q image.  This  is worked out by first clipping
     179             :     // outliers from the mean at the specified level.
     180             :     // <group>
     181             :     casacore::ImageExpr<casacore::Float> stokesQ() const;
     182             :     casacore::Float sigmaStokesQ (casacore::Float clip=10.0);
     183             :     // </group>
     184             : 
     185             :     // Get the casacore::Stokes U image and the standard deviation
     186             :     // of the U image.  This  is worked out by first clipping
     187             :     // outliers from the mean at the specified level.
     188             :     // <group>
     189             :     casacore::ImageExpr<casacore::Float> stokesU() const;
     190             :     casacore::Float sigmaStokesU (casacore::Float clip=10.0);
     191             :     // </group>
     192             : 
     193             :     // Get the casacore::Stokes V image and the standard deviation
     194             :     // of the V image.  This  is worked out by first clipping
     195             :     // outliers from the mean at the specified level.
     196             :     // <group>
     197             :     casacore::ImageExpr<casacore::Float> stokesV() const;
     198             :     casacore::Float sigmaStokesV (casacore::Float clip=10.0);
     199             :     // </group>
     200             : 
     201             :     // Get the specified casacore::Stokes image and the standard deviation
     202             :     // of the image.  This  is worked out by first clipping
     203             :     // outliers from the mean at the specified level.
     204             :     // <group>
     205             :     casacore::ImageExpr<casacore::Float> stokes(
     206             :         ImagePolarimetry::StokesTypes index
     207             :     ) const;
     208             :     casacore::Float sigmaStokes (
     209             :         ImagePolarimetry::StokesTypes index, casacore::Float clip=10.0
     210             :     );
     211             :     // </group>
     212             : 
     213             :     // Get the best estimate of the statistical noise. This gives you the
     214             :     // standard deviation with outliers from the mean clipped first. The idea is
     215             :     // to not be confused by source or dynamic range issues. Generally Stokes V
     216             :     // is empty of sources (not always), then Q and U are generally less bright
     217             :     // than I.  So this function first tries V, then Q and U and lastly I to
     218             :     // give you its noise estimate
     219             :     casacore::Float sigma(casacore::Float clip=10.0);
     220             : 
     221             :     // Get the linearly polarized intensity image and its
     222             :     // standard deviation.  If wish to debias the image, you
     223             :     // can either provide <src>sigma</src> (the standard
     224             :     // deviation of the termal noise ) or if <src>sigma</src> is non-positive,
     225             :     // it will  be worked out for you with a clipped mean algorithm.
     226             :     // <group>
     227             :     casacore::Float sigmaLinPolInt(
     228             :         casacore::Float clip=10.0, casacore::Float sigma=-1.0
     229             :     );
     230             :     // </group>
     231             : 
     232             :     // Get the total polarized intensity (from whatever combination
     233             :     // of Q, U, and V the construction image has) image and its error
     234             :     // (standard deviation).  If wish to debias the image, you
     235             :     // can either provide <src>sigma</src> (the standard  deviation
     236             :     // of the thermal noise) or if <src>sigma</src> is
     237             :     // non-positive, it will be worked out for you with a
     238             :     // clipped mean algorithm.
     239             :     // <group>
     240             :     casacore::ImageExpr<casacore::Float> totPolInt(
     241             :         casacore::Bool debias, casacore::Float clip=10.0,
     242             :         casacore::Float sigma=-1.0
     243             :     );
     244             : 
     245             :     casacore::Float sigmaTotPolInt(
     246             :         casacore::Float clip=10.0, casacore::Float sigma=-1.0
     247             :     );
     248             :     // </group>
     249             : 
     250             :     // Get linearly polarized position angle (degrees or radians) image
     251             :     // and error (standard deviation).   If you provide
     252             :     // <src>sigma</src> it is the  standard deviation of
     253             :     // the termal noise.  If <src>sigma</src> is non-positive, it will be
     254             :     // worked out for you with a  clipped mean algorithm.
     255             :     // <group>
     256             :     casacore::ImageExpr<casacore::Float> linPolPosAng(
     257             :         casacore::Bool radians
     258             :     ) const;
     259             : 
     260             :     casacore::ImageExpr<casacore::Float> sigmaLinPolPosAng(
     261             :         casacore::Bool radians, casacore::Float clip=10.0,
     262             :         casacore::Float sigma=-1.0
     263             :     );
     264             :     // </group>
     265             : 
     266             :     // Get fractional linear polarization image
     267             :     // and error (standard deviation).   If wish to debias the image, you
     268             :     // can either provide <src>sigma</src> (the standard
     269             :     // deviation of the termal noise) or if <src>sigma</src> is non-positive,
     270             :     // it will  be worked out for you with a clipped mean algorithm.
     271             :     // <group>
     272             :     casacore::ImageExpr<casacore::Float> fracLinPol(
     273             :         casacore::Bool debias, casacore::Float clip=10.0,
     274             :         casacore::Float sigma=-1.0
     275             :     );
     276             : 
     277             :     casacore::ImageExpr<casacore::Float> sigmaFracLinPol(
     278             :         casacore::Float clip=10.0, casacore::Float sigma=-1.0
     279             :     );
     280             :     // </group>
     281             : 
     282             :     // Get Fractional total polarization and error (standard deviation)
     283             :     // <src>var</src> is the standard deviation  of the thermal noise.
     284             :     // If <src>sigma</src> is non-positive,
     285             :     // it will  be worked out for you with a clipped mean algorithm.
     286             :     // <group>
     287             :     casacore::ImageExpr<casacore::Float> fracTotPol(
     288             :         casacore::Bool debias, casacore::Float clip=10.0,
     289             :         casacore::Float sigma=-1.0
     290             :     );
     291             :     casacore::ImageExpr<casacore::Float> sigmaFracTotPol(
     292             :         casacore::Float clip=10.0, casacore::Float sigma=-1.0
     293             :     );
     294             :     // </group>
     295             : 
     296             :     // Fourier Rotation Measure.  The output image is the complex polarization
     297             :     // (Q + iU) with the spectral axis replaced by a RotationMeasure axis. The
     298             :     // appropriate shape and casacore::CoordinateSystem must be obtained with
     299             :     // function singleStokesShape (ask for type STokes::Plinear).
     300             :     // Howeverm this function will replace the casacore::SpectralCoordinate
     301             :     // by a LinearCoordinate describing  the Rotation Measure.
     302             :     // casacore::ImageInfo, and Units are copied to the output.  MiscInfo and
     303             :     // history are not.  If the output has a mask,
     304             :     // and the input is masked, the mask is copied.  If the output
     305             :     // has a mask, it should already have been initialized to true
     306             :     void fourierRotationMeasure(
     307             :         casacore::ImageInterface<casacore::Complex>& pol,
     308             :         casacore::Bool zeroZeroLag
     309             :     );
     310             : 
     311             :     // This function is used in concert with the rotationMeasure function.
     312             :     // It tells you what the shape of the output RM image should be, and
     313             :     // gives you its CoordinateSystem.  Because the ImagePolarimetry
     314             :     // construction image may house the frequencies coordinate description
     315             :     // in a Spectral, Tabular or Linear coordinate, you may explicitly
     316             :     // specify which axis is the Spectral axis (spectralAxis).  By default,
     317             :     // it tries to find the SpectralCoordinate.  If there is none, it will
     318             :     // look for Tabular or Linear coordinates with a "FREQ" label.
     319             :     // It returns to you the frequencyAxis (i.e. the one it is concluded
     320             :     // houses the frequency spectrum) and the stokesAxis that it
     321             :     // finds.
     322             :     casacore::IPosition rotationMeasureShape(
     323             :         casacore::CoordinateSystem& cSys, casacore::Int& frequencyAxis,
     324             :         casacore::Int& stokesAxis, casacore::LogIO& os,
     325             :         casacore::Int spectralAxis=-1
     326             :     ) const;
     327             : 
     328             :     // This function is used in concert with the rotationMeasure function.
     329             :     // It tells you what the shape of the output Position Angle image should be,
     330             :     // and gives you its CoordinateSystem.  Because the ImagePolarimetry
     331             :     // construction image may house the frequencies coordinate description
     332             :     // in a Spectral, Tabular or Linear coordinate, you may explicitly
     333             :     // specify which axis is the Spectral axis (spectralAxis).  By default,
     334             :     // it tries to find the SpectralCoordinate.  If there is none, it will
     335             :     // look for Tabular or Linear coordinates with a "FREQ" label.
     336             :     casacore::IPosition positionAngleShape(
     337             :         casacore::CoordinateSystem& cSys, casacore::Int& frequencyAxis,
     338             :         casacore::Int& stokesAxis, casacore::LogIO& os,
     339             :         casacore::Int spectralAxis=-1
     340             :     ) const;
     341             : 
     342             :     // This function applies a traditional (i.e. non-Fourier) Rotation Measure
     343             :     // algorithm (Leahy et al, A&A, 156, 234) approach.     For the RM images
     344             :     // you must get the shape and CoordinateSYstem from function
     345             :     // rotationMeasureShape. For the position angle images, use function
     346             :     // singleStokesShape. Null pointer ImageInterface objects are
     347             :     // not accessed so you can select which output images you want.
     348             :     // Any output images not masked will be given a mask.
     349             :     // The position angles are all in degrees. The RM images in rad/m/m.
     350             :     // ImageInfo and Units, are copied to the output.  MiscInfo and history are
     351             :     // not. You specify which axis houses the frequencies, the noise level of
     352             :     // Q and U  if you  know it (by default it is worked out for you)
     353             :     // for error images, the value of the foreground RM if you know it
     354             :     // (helps for unwinding ambiguity), the absolute maximum RM it should
     355             :     // solve for, and the maximum error in the position angle that should
     356             :     // be allowed.  The state of the plotter should be set by the caller
     357             :     // (e.g. character size, number of plots in x and y etc).
     358             :     void rotationMeasure(
     359             :         casacore::ImageInterface<casacore::Float>*& rmPtr,
     360             :         casacore::ImageInterface<casacore::Float>*& rmErrPtr,
     361             :         casacore::ImageInterface<casacore::Float>*& pa0Ptr,
     362             :         casacore::ImageInterface<casacore::Float>*& pa0ErrPtr,
     363             :         casacore::ImageInterface<casacore::Float>*& nTurns,
     364             :         casacore::ImageInterface<casacore::Float>*& rChiSqPtr,
     365             :         casacore::Int spectralAxis,  casacore::Float rmMax,
     366             :         casacore::Float maxPaErr=1.0e30, casacore::Float sigma=-1.0,
     367             :         casacore::Float rmFg=0.0, casacore::Bool showProgress=false
     368             :     );
     369             : 
     370             :     // Depolarization ratio image and error.  Requires two images hence static
     371             :     // functions.
     372             :     // <group>
     373             :     static casacore::ImageExpr<casacore::Float> depolarizationRatio(
     374             :         const casacore::ImageInterface<casacore::Float>& im1,
     375             :         const casacore::ImageInterface<casacore::Float>& im2,
     376             :         casacore::Bool debias, casacore::Float clip=10.0,
     377             :         casacore::Float sigma=-1.0
     378             :     );
     379             : 
     380             :     static casacore::ImageExpr<casacore::Float> sigmaDepolarizationRatio(
     381             :         const casacore::ImageInterface<casacore::Float>& im1,
     382             :         const casacore::ImageInterface<casacore::Float>& im2,
     383             :         casacore::Bool debias, casacore::Float clip=10.0,
     384             :         casacore::Float sigma=-1.0
     385             :     );
     386             :     // </group>
     387             : 
     388             : private:
     389             :     static const map<StokesTypes, casacore::String> polMap;
     390             : 
     391             :     SPCIIF _image = nullptr;
     392             :     // const casacore::ImageInterface<casacore::Float>* _image;
     393             :     casacore::LinearFitSVD<casacore::Float>* _fitter = nullptr;
     394             :     casacore::Float _oldClip = 0.0;
     395             : 
     396             : // These blocks are always size 4, with IQUV in slots 0,1,2,3
     397             : // If your image is IV only, they still use slots 0 and 3
     398             : 
     399             :    casacore::PtrBlock<casacore::ImageInterface<casacore::Float>*> _stokes {};
     400             :    casacore::PtrBlock<casacore::LatticeStatistics<casacore::Float>*>
     401             :        _stokesStats {};
     402             : 
     403             :    casacore::Matrix<casacore::Bool> _beamsEqMat {};
     404             : 
     405             : 
     406             :    // Delete all private pointers
     407             :    void _cleanup();
     408             : 
     409             :    // For traiditional RM approach, give output a mask if possible
     410             :    casacore::Bool _dealWithMask(
     411             :        casacore::Lattice<casacore::Bool>*& pMask,
     412             :        casacore::ImageInterface<casacore::Float>*& pIm, casacore::LogIO& os,
     413             :        const casacore::String& type
     414             :    ) const;
     415             : 
     416             :    // Change the Stokes Coordinate for the given float image to be of the
     417             :    // specified Stokes type
     418             :    void _fiddleStokesCoordinate(
     419             :        casacore::ImageInterface<casacore::Float>& ie,
     420             :        casacore::Stokes::StokesTypes type
     421             :    ) const;
     422             : 
     423             :    void _fiddleStokesCoordinate(
     424             :        casacore::CoordinateSystem& cSys, casacore::Stokes::StokesTypes type
     425             :    ) const;
     426             : 
     427             :    // Change the casacore::Stokes casacore::Coordinate for the given complex
     428             :    // image to be of the specified casacore::Stokes type
     429             :    void _fiddleStokesCoordinate(
     430             :        casacore::ImageInterface<casacore::Complex>& ie,
     431             :        casacore::Stokes::StokesTypes type
     432             :    ) const;
     433             : 
     434             :    // Change the time coordinate to be rotation measure
     435             :    void _fiddleTimeCoordinate(
     436             :        casacore::ImageInterface<casacore::Complex>& ie,
     437             :        const casacore::Quantum<casacore::Double>& f, casacore::Int coord
     438             :    ) const;
     439             : 
     440             :    // Find the central frequency from the given spectral coordinate
     441             :    casacore::Quantum<casacore::Double> _findCentralFrequency(
     442             :        const casacore::Coordinate& coord, casacore::Int shape
     443             :    ) const;
     444             : 
     445             :    // Fit the spectrum of position angles to find the
     446             :    // rotation measure via Leahy algorithm
     447             :    casacore::Bool _findRotationMeasure(
     448             :        casacore::Float& rmFitted, casacore::Float& rmErrFitted,
     449             :        casacore::Float& pa0Fitted, casacore::Float& pa0ErrFitted,
     450             :        casacore::Float& rChiSqFitted, casacore::Float& nTurns,
     451             :        const casacore::Vector<casacore::uInt>& sortidx,
     452             :        const casacore::Vector<casacore::Float>& wsq,
     453             :        const casacore::Vector<casacore::Float>& pa,
     454             :        const casacore::Array<casacore::Bool>& paMask,
     455             :        const casacore::Array<casacore::Float>& paerr,
     456             :        casacore::Float rmfg, casacore::Float rmmax, casacore::Float paErrMax,
     457             :        const casacore::String& posString
     458             :    );
     459             : 
     460             :    // Find the casacore::Stokes in the construction image and assign pointers
     461             :    void _findStokes();
     462             : 
     463             :    // Find the spectral coordinate.
     464             :    casacore::Int _findSpectralCoordinate(
     465             :        const casacore::CoordinateSystem& cSys, casacore::LogIO& os,
     466             :        casacore::Bool fail
     467             :    ) const;
     468             : 
     469             :    // FInd frequency axis
     470             :    void _findFrequencyAxis(
     471             :        casacore::Int& spectralCoord, casacore::Int& fAxis,
     472             :        const casacore::CoordinateSystem& cSys, casacore::Int spectralAxis
     473             :    ) const;
     474             : 
     475             :    // So we have Q and U ?  Excpetion if not
     476             :    void _hasQU () const;
     477             : 
     478             :    // Make a LEN for the give types of polarized intensity
     479             :    casacore::LatticeExprNode _makePolIntNode(
     480             :        casacore::LogIO& os, casacore::Bool debias, casacore::Float clip,
     481             :        casacore::Float sigma, casacore::Bool doLin, casacore::Bool doCirc
     482             :    );
     483             : 
     484             :    // Make an IE for the specified Stokes
     485             :    casacore::ImageExpr<casacore::Float> _makeStokesExpr(
     486             :        casacore::ImageInterface<casacore::Float>* imPtr,
     487             :        casacore::Stokes::StokesTypes type, const casacore::String& name
     488             :    ) const;
     489             : 
     490             :    // Make a casacore::SubImage from the construction image for the specified
     491             :    // pixel along the specified pixel axis
     492             :    casacore::ImageInterface<casacore::Float>* _makeSubImage(
     493             :        casacore::IPosition& blc, casacore::IPosition& trc,
     494             :        casacore::Int axis, casacore::Int pix
     495             :    ) const;
     496             : 
     497             :    // Least squares fit to find RM from position angles
     498             :    casacore::Bool _rmLsqFit(
     499             :        casacore::Vector<casacore::Float>& pars,
     500             :        const casacore::Vector<casacore::Float>& wsq,
     501             :        const casacore::Vector<casacore::Float> pa,
     502             :        const casacore::Vector<casacore::Float>& paerr
     503             :    ) const;
     504             : 
     505             :    // Fit the spectrum of position angles to find the rotation measure
     506             :    // via Leahy algorithm for primary (n>2) points
     507             :    casacore::Bool _rmPrimaryFit(
     508             :        casacore::Float& nTurns, casacore::Float& rmFitted,
     509             :        casacore::Float& rmErrFitted, casacore::Float& pa0Fitted,
     510             :        casacore::Float& pa0ErrFitted, casacore::Float& rChiSqFitted,
     511             :        const casacore::Vector<casacore::Float>& wsq,
     512             :        const casacore::Vector<casacore::Float>& pa,
     513             :        const casacore::Vector<casacore::Float>& paerr,
     514             :        casacore::Float rmmax, const casacore::String& posString
     515             :    );
     516             : 
     517             :    // Fit the spectrum of position angles to find the rotation measure
     518             :    // via Leahy algorithm for supplementary (n==2) points
     519             :    casacore::Bool _rmSupplementaryFit(
     520             :        casacore::Float& nTurns, casacore::Float& rmFitted,
     521             :        casacore::Float& rmErrFitted, casacore::Float& pa0Fitted,
     522             :        casacore::Float& pa0ErrFitted, casacore::Float& rChiSqFitted,
     523             :        const casacore::Vector<casacore::Float>& wsq,
     524             :        const casacore::Vector<casacore::Float>& pa,
     525             :        const casacore::Vector<casacore::Float>& paerr
     526             :    );
     527             : 
     528             :    // Return I, Q, U or V for specified integer index (0-3)
     529             :    casacore::String _stokesName(
     530             :        ImagePolarimetry::StokesTypes index
     531             :    ) const;
     532             : 
     533             :    // Return I, Q, U or V for specified integer index (0-3)
     534             :    casacore::Stokes::StokesTypes _stokesType(
     535             :        ImagePolarimetry::StokesTypes index
     536             :    ) const;
     537             : 
     538             :    // Find the standard deviation for the Stokes image
     539             :    // specified by the integer index
     540             :    casacore::Float _sigma(
     541             :        ImagePolarimetry::StokesTypes index, casacore::Float clip
     542             :    );
     543             : 
     544             :    // Subtract profile mean from image
     545             :    void _subtractProfileMean(
     546             :        casacore::ImageInterface<casacore::Float>& im, casacore::uInt axis
     547             :    ) const;
     548             : 
     549             :    void _createBeamsEqMat();
     550             : 
     551             :    casacore::Bool _checkBeams(
     552             :        const std::vector<StokesTypes>& stokes,
     553             :        casacore::Bool requireChannelEquality, casacore::Bool throws=true
     554             :    ) const;
     555             : 
     556             :    casacore::Bool _checkIQUBeams(
     557             :        casacore::Bool requireChannelEquality, casacore::Bool throws=true
     558             :    ) const ;
     559             : 
     560             :    casacore::Bool _checkIVBeams(
     561             :        casacore::Bool requireChannelEquality, casacore::Bool throws=true
     562             :    ) const;
     563             : 
     564             :    casacore::Bool _checkQUBeams(
     565             :        casacore::Bool requireChannelEquality, casacore::Bool throws=true
     566             :    ) const;
     567             : 
     568             :    static void _checkBeams(
     569             :        const ImagePolarimetry& im1, const ImagePolarimetry& im2,
     570             :        const casacore::Vector<StokesTypes>& stokes
     571             :    );
     572             : 
     573             :    void _setInfo(
     574             :        casacore::ImageInterface<casacore::Complex>& im, StokesTypes stokes
     575             :    ) const;
     576             : 
     577             :    void _setInfo(
     578             :        casacore::ImageInterface<casacore::Float>& im, StokesTypes stokes
     579             :    ) const;
     580             : 
     581             :    void _setDoLinDoCirc(casacore::Bool& doLin, casacore::Bool& doCirc) const;
     582             : 
     583             : };
     584             : 
     585             : }
     586             : 
     587             : #endif

Generated by: LCOV version 1.16