casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LELSpectralIndex.h
Go to the documentation of this file.
1 //# LELSpectralIndex.h: LEL function to calculate spectral index/
2 //# Copyright (C) 2001
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: aips2-request@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$
27 
28 #ifndef LATTICES_LELSPECTRALINDEX_H
29 #define LATTICES_LELSPECTRALINDEX_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 //# Forward Declarations
40 
41 
42 // <summary>
43 // This LEL class handles calculation of the spectral index.
44 // </summary>
45 
46 // <use visibility=local>
47 
48 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
49 // </reviewed>
50 
51 // <prerequisite>
52 // <li> <linkto class="Lattice"> Lattice</linkto>
53 // <li> <linkto class="LatticeExpr"> LatticeExpr</linkto>
54 // <li> <linkto class="LatticeExprNode"> LatticeExprNode</linkto>
55 // <li> <linkto class="LELInterface"> LELInterface</linkto>
56 // <li> <linkto class="LELFunctionEnums"> LELFunctionEnums</linkto>
57 // </prerequisite>
58 
59 // <synopsis>
60 // This LEL letter class is derived from LELInterface. It is used to
61 // construct LEL objects that calculate the sepectral index from 2 other
62 // LEL expression (usually images).
63 // It operates on real types (Float,Double)
64 // </synopsis>
65 
66 // <motivation>
67 // This is a separate class (instead of being part of a LELFunction class),
68 // because the calculation of the spectral index requires extra variables
69 // (the frequencies) and some more complicated code.
70 // </motivation>
71 
72 template<class T> class LELSpectralIndex : public LELInterface<T>
73 {
74  //# Make members of parent class known.
75 protected:
77 
78 public:
79  // Constructor takes operation and expressions to be operated upon
81 
82  // Destructor
84 
85  // Recursively evaluate the expression
86  virtual void eval (LELArray<T>& result,
87  const Slicer& section) const;
88 
89  // Get the result of a scalar subexpression.
90  // Throws an exception as it is not possible.
91  virtual LELScalar<T> getScalar() const;
92 
93  // Do further preparations (e.g. optimization) on the expression.
94  // Returns False.
95  virtual Bool prepareScalarExpr();
96 
97  // Get class name
98  virtual String className() const;
99 
100  // Handle locking/syncing of a lattice in a lattice expression.
101  // <group>
102  virtual Bool lock (FileLocker::LockType, uInt nattempts);
103  virtual void unlock();
104  virtual Bool hasLock (FileLocker::LockType) const;
105  virtual void resync();
106  // </group>
107 
108 private:
110  Block<Double> itsLogFreq; //# log(f0/f1)
113 };
114 
115 
116 
117 } //# NAMESPACE CASACORE - END
118 
119 #ifndef CASACORE_NO_AUTO_TEMPLATES
120 #include <casacore/lattices/LEL/LELSpectralIndex.tcc>
121 #endif //# CASACORE_NO_AUTO_TEMPLATES
122 #endif
int Int
Definition: aipstype.h:50
virtual Bool hasLock(FileLocker::LockType) const
This LEL class holds an array with a mask.
Definition: LatticeExpr.h:43
virtual void eval(LELArray< T > &result, const Slicer &section) const
Recursively evaluate the expression.
virtual Bool prepareScalarExpr()
Do further preparations (e.g.
This base class provides the interface for Lattice expressions.
Definition: LELInterface.h:150
LELSpectralIndex(const Block< LatticeExprNode > &expr)
Constructor takes operation and expressions to be operated upon.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual LELScalar< T > getScalar() const
Get the result of a scalar subexpression.
Specify which elements to extract from an n-dimensional array.
Definition: Slicer.h:288
simple 1-D array
Definition: Allocator.h:210
This LEL class handles calculation of the spectral index.
virtual Bool lock(FileLocker::LockType, uInt nattempts)
Handle locking/syncing of a lattice in a lattice expression.
Bridging class to allow C++ expressions involving lattices.
~LELSpectralIndex()
Destructor.
String: the storage and methods of handling collections of characters.
Definition: String.h:225
LockType
Define the possible lock types.
Definition: FileLocker.h:95
unsigned int uInt
Definition: aipstype.h:51
virtual String className() const
Get class name.
This LEL class holds a scalar with a mask.
Definition: LELInterface.h:43