casacore
Loading...
Searching...
No Matches
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: 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#ifndef LATTICES_LELSPECTRALINDEX_H
27#define LATTICES_LELSPECTRALINDEX_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/lattices/LEL/LELFunction.h>
32#include <casacore/casa/Containers/Block.h>
33
34namespace casacore { // # NAMESPACE CASACORE - BEGIN
35
36// # Forward Declarations
37
38// <summary>
39// This LEL class handles calculation of the spectral index.
40// </summary>
41
42// <use visibility=local>
43
44// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
45// </reviewed>
46
47// <prerequisite>
48// <li> <linkto class="Lattice"> Lattice</linkto>
49// <li> <linkto class="LatticeExpr"> LatticeExpr</linkto>
50// <li> <linkto class="LatticeExprNode"> LatticeExprNode</linkto>
51// <li> <linkto class="LELInterface"> LELInterface</linkto>
52// <li> <linkto class="LELFunctionEnums"> LELFunctionEnums</linkto>
53// </prerequisite>
54
55// <synopsis>
56// This LEL letter class is derived from LELInterface. It is used to
57// construct LEL objects that calculate the sepectral index from 2 other
58// LEL expression (usually images).
59// It operates on real types (Float,Double)
60// </synopsis>
61
62// <motivation>
63// This is a separate class (instead of being part of a LELFunction class),
64// because the calculation of the spectral index requires extra variables
65// (the frequencies) and some more complicated code.
66// </motivation>
67
68template <class T>
69class LELSpectralIndex : public LELInterface<T> {
70 // # Make members of parent class known.
71 protected:
72 using LELInterface<T>::setAttr;
73
74 public:
75 // Constructor takes operation and expressions to be operated upon
77
78 // Destructor
80
81 // Recursively evaluate the expression
82 virtual void eval(LELArray<T>& result, const Slicer& section) const;
83
84 // Get the result of a scalar subexpression.
85 // Throws an exception as it is not possible.
86 virtual LELScalar<T> getScalar() const;
87
88 // Do further preparations (e.g. optimization) on the expression.
89 // Returns False.
91
92 // Get class name
93 virtual String className() const;
94
95 // Handle locking/syncing of a lattice in a lattice expression.
96 // <group>
97 virtual Bool lock(FileLocker::LockType, uInt nattempts);
98 virtual void unlock();
100 virtual void resync();
101 // </group>
102
103 private:
105 Block<Double> itsLogFreq; // # log(f0/f1)
108};
109
110} // namespace casacore
111
112#ifndef CASACORE_NO_AUTO_TEMPLATES
113#include <casacore/lattices/LEL/LELSpectralIndex.tcc>
114#endif // # CASACORE_NO_AUTO_TEMPLATES
115#endif
LockType
Define the possible lock types.
Definition FileLocker.h:89
void setAttr(const LELAttribute &attrib)
Set the expression attributes of this object.
virtual String className() const
Get class name.
virtual void eval(LELArray< T > &result, const Slicer &section) const
Recursively evaluate the expression.
~LELSpectralIndex()
Destructor.
virtual Bool prepareScalarExpr()
Do further preparations (e.g.
virtual Bool lock(FileLocker::LockType, uInt nattempts)
Handle locking/syncing of a lattice in a lattice expression.
virtual Bool hasLock(FileLocker::LockType) const
LELSpectralIndex(const Block< LatticeExprNode > &expr)
Constructor takes operation and expressions to be operated upon.
virtual LELScalar< T > getScalar() const
Get the result of a scalar subexpression.
String: the storage and methods of handling collections of characters.
Definition String.h:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40