LELSpectralIndex.h

Go to the documentation of this file.
00001 //# LELSpectralIndex.h: LEL function to calculate spectral index/
00002 //# Copyright (C) 2001
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 #ifndef LATTICES_LELSPECTRALINDEX_H
00029 #define LATTICES_LELSPECTRALINDEX_H
00030 
00031 
00032 //# Includes
00033 #include <casacore/casa/aips.h>
00034 #include <casacore/lattices/LEL/LELFunction.h>
00035 #include <casacore/casa/Containers/Block.h>
00036 
00037 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00038 
00039 //# Forward Declarations
00040 
00041 
00042 // <summary>
00043 // This LEL class handles calculation of the spectral index.
00044 // </summary>
00045 
00046 // <use visibility=local>
00047 
00048 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00049 // </reviewed>
00050 
00051 // <prerequisite>
00052 //   <li> <linkto class="Lattice"> Lattice</linkto>
00053 //   <li> <linkto class="LatticeExpr"> LatticeExpr</linkto>
00054 //   <li> <linkto class="LatticeExprNode"> LatticeExprNode</linkto>
00055 //   <li> <linkto class="LELInterface"> LELInterface</linkto>
00056 //   <li> <linkto class="LELFunctionEnums"> LELFunctionEnums</linkto>
00057 // </prerequisite>
00058 
00059 // <synopsis>
00060 // This LEL letter class is derived from LELInterface. It is used to
00061 // construct LEL objects that calculate the sepectral index from 2 other
00062 // LEL expression (usually images).
00063 // It operates on real types (Float,Double) 
00064 // </synopsis> 
00065 
00066 // <motivation>
00067 // This is a separate class (instead of being part of a LELFunction class),
00068 // because the calculation of the spectral index requires extra variables
00069 // (the frequencies) and some more complicated code.
00070 // </motivation>
00071 
00072 template<class T> class LELSpectralIndex : public LELInterface<T>
00073 {
00074   //# Make members of parent class known.
00075 protected:
00076   using LELInterface<T>::setAttr;
00077 
00078 public: 
00079   // Constructor takes operation and expressions to be operated upon
00080   LELSpectralIndex (const Block<LatticeExprNode>& expr);
00081 
00082   // Destructor 
00083   ~LELSpectralIndex();
00084 
00085   // Recursively evaluate the expression 
00086   virtual void eval (LELArray<T>& result,
00087                      const Slicer& section) const;
00088 
00089   // Get the result of a scalar subexpression.
00090   // Throws an exception as it is not possible.
00091    virtual LELScalar<T> getScalar() const;
00092 
00093   // Do further preparations (e.g. optimization) on the expression.
00094   // Returns False.
00095    virtual Bool prepareScalarExpr();
00096 
00097   // Get class name
00098   virtual String className() const;
00099 
00100   // Handle locking/syncing of a lattice in a lattice expression.
00101   // <group>
00102   virtual Bool lock (FileLocker::LockType, uInt nattempts);
00103   virtual void unlock();
00104   virtual Bool hasLock (FileLocker::LockType) const;
00105   virtual void resync();
00106   // </group>
00107 
00108 private:
00109   Int itsFreqAxis;
00110   Block<Double> itsLogFreq;       //# log(f0/f1)
00111   LatticeExprNode arg0_p;
00112   LatticeExprNode arg1_p;
00113 };
00114 
00115 
00116 
00117 } //# NAMESPACE CASACORE - END
00118 
00119 #ifndef CASACORE_NO_AUTO_TEMPLATES
00120 #include <casacore/lattices/LEL/LELSpectralIndex.tcc>
00121 #endif //# CASACORE_NO_AUTO_TEMPLATES
00122 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1