ChebyshevParam.tcc | ChebyshevParam.tcc | |||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
//# along with this library; if not, write to the Free Software Foundation, | //# along with this library; if not, write to the Free Software Foundation, | |||
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | |||
//# | //# | |||
//# Correspondence concerning AIPS++ should be addressed as follows: | //# Correspondence concerning AIPS++ should be addressed as follows: | |||
//# Internet email: aips2-request@nrao.edu. | //# Internet email: aips2-request@nrao.edu. | |||
//# Postal address: AIPS++ Project Office | //# Postal address: AIPS++ Project Office | |||
//# National Radio Astronomy Observatory | //# National Radio Astronomy Observatory | |||
//# 520 Edgemont Road | //# 520 Edgemont Road | |||
//# Charlottesville, VA 22903-2475 USA | //# Charlottesville, VA 22903-2475 USA | |||
//# | //# | |||
//# $Id: ChebyshevParam.tcc 21159 2011-12-13 02:59:29Z ben.h@bigpond.net.au $ | //# $Id: ChebyshevParam.tcc 21227 2012-03-30 06:26:14Z gervandiepen $ | |||
//# Includes | //# Includes | |||
#include <scimath/Functionals/ChebyshevParam.h> | #include <scimath/Functionals/ChebyshevParam.h> | |||
#include <casa/Arrays/Vector.h> | #include <casa/Arrays/Vector.h> | |||
#include <casa/Arrays/ArrayUtil.h> | #include <casa/Arrays/ArrayUtil.h> | |||
#include <casa/Arrays/Matrix.h> | #include <casa/Arrays/Matrix.h> | |||
#include <casa/Exceptions/Error.h> | #include <casa/Exceptions/Error.h> | |||
#include <casa/Utilities/Assert.h> | #include <casa/Utilities/Assert.h> | |||
#include <casa/Containers/RecordInterface.h> | #include <casa/Containers/RecordInterface.h> | |||
#include <casa/Utilities/MUString.h> | #include <casa/Utilities/MUString.h> | |||
skipping to change at line 63 | skipping to change at line 63 | |||
Function1D<T>(n+1), def_p(T(0)), | Function1D<T>(n+1), def_p(T(0)), | |||
minx_p(T(-1)), maxx_p(T(1)), mode_p(ChebyshevEnums::CONSTANT) | minx_p(T(-1)), maxx_p(T(1)), mode_p(ChebyshevEnums::CONSTANT) | |||
{ } | { } | |||
template <class T> | template <class T> | |||
ChebyshevParam<T>::ChebyshevParam(const T &min, const T &max, | ChebyshevParam<T>::ChebyshevParam(const T &min, const T &max, | |||
ChebyshevEnums::OutOfIntervalMode mode, | ChebyshevEnums::OutOfIntervalMode mode, | |||
const T &defval) : | const T &defval) : | |||
Function1D<T>(1), def_p(defval), mode_p(mode) { | Function1D<T>(1), def_p(defval), mode_p(mode) { | |||
param_p[0] = 1; | param_p[0] = 1; | |||
setInterval(min, max); | this->setInterval(min, max); | |||
} | } | |||
template <class T> | template <class T> | |||
ChebyshevParam<T>::ChebyshevParam(const Vector<T> &coeffs, | ChebyshevParam<T>::ChebyshevParam(const Vector<T> &coeffs, | |||
const T &min, const T &max, | const T &min, const T &max, | |||
ChebyshevEnums::OutOfIntervalMode, | ChebyshevEnums::OutOfIntervalMode, | |||
const T &defval) : | const T &defval) : | |||
Function1D<T>(coeffs.nelements()), def_p(defval), | Function1D<T>(coeffs.nelements()), def_p(defval), | |||
minx_p(min), maxx_p(max), mode_p(ChebyshevEnums::CONSTANT) | minx_p(min), maxx_p(max), mode_p(ChebyshevEnums::CONSTANT) | |||
{ | { | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
ComponentList.h | ComponentList.h | |||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | |||
//# | //# | |||
//# Correspondence concerning AIPS++ should be addressed as follows: | //# Correspondence concerning AIPS++ should be addressed as follows: | |||
//# Internet email: aips2-request@nrao.edu. | //# Internet email: aips2-request@nrao.edu. | |||
//# Postal address: AIPS++ Project Office | //# Postal address: AIPS++ Project Office | |||
//# National Radio Astronomy Observatory | //# National Radio Astronomy Observatory | |||
//# 520 Edgemont Road | //# 520 Edgemont Road | |||
//# Charlottesville, VA 22903-2475 USA | //# Charlottesville, VA 22903-2475 USA | |||
//# | //# | |||
//# | //# | |||
//# $Id: ComponentList.h 21130 2011-10-18 07:39:05Z gervandiepen $ | //# $Id: ComponentList.h 21229 2012-04-02 12:00:20Z gervandiepen $ | |||
#ifndef COMPONENTS_COMPONENTLIST_H | #ifndef COMPONENTS_COMPONENTLIST_H | |||
#define COMPONENTS_COMPONENTLIST_H | #define COMPONENTS_COMPONENTLIST_H | |||
#include <casa/aips.h> | #include <casa/aips.h> | |||
#include <components/ComponentModels/SkyComponent.h> | #include <components/ComponentModels/SkyComponent.h> | |||
#include <measures/Measures/MDirection.h> | #include <measures/Measures/MDirection.h> | |||
#include <measures/Measures/MFrequency.h> | #include <measures/Measures/MFrequency.h> | |||
#include <casa/Containers/Block.h> | #include <casa/Containers/Block.h> | |||
#include <tables/Tables/Table.h> | #include <tables/Tables/Table.h> | |||
skipping to change at line 209 | skipping to change at line 209 | |||
const Vector<MVFrequency>& frequencies, | const Vector<MVFrequency>& frequencies, | |||
const MeasRef<MFrequency>& freqRef) const; | const MeasRef<MFrequency>& freqRef) const; | |||
// Add a SkyComponent to the end of the ComponentList. The list length is | // Add a SkyComponent to the end of the ComponentList. The list length is | |||
// increased by one when using this function. By default the newly added | // increased by one when using this function. By default the newly added | |||
// component is not selected. Note that it is possible to add a componen t | // component is not selected. Note that it is possible to add a componen t | |||
// to a list that was opened read-only; however, the table on disk will | // to a list that was opened read-only; however, the table on disk will | |||
// not be updated with new component. | // not be updated with new component. | |||
void add(SkyComponent component); | void add(SkyComponent component); | |||
// Add a SkyComponents in a ComponentList to the end of this ComponentLis | ||||
t. The list length is | ||||
// increased by the number of components in the added list. By default th | ||||
e newly added | ||||
// components are not selected. Note that it is possible to add a compon | ||||
ent list | ||||
// to a list that was opened read-only; however, the table on disk will | ||||
// not be updated with new components. | ||||
void addList(const ComponentList& list); | ||||
// Remove the specified SkyComponent(s) from the ComponentList. After | // Remove the specified SkyComponent(s) from the ComponentList. After | |||
// removing a component all the components with an indices greater than t his | // removing a component all the components with an indices greater than t his | |||
// one will be reduced by one. For example in a five element list removin g | // one will be reduced by one. For example in a five element list removin g | |||
// elements [0,2,4] will result in a two element list, now indexed as | // elements [0,2,4] will result in a two element list, now indexed as | |||
// elements zero and one, containing what was previously the second and | // elements zero and one, containing what was previously the second and | |||
// fourth components. Note that it is possible to remove a component | // fourth components. Note that it is possible to remove a component | |||
// from a list that was opened read-only; however, the table on disk will | // from a list that was opened read-only; however, the table on disk will | |||
// not be updated accordingly. | // not be updated accordingly. | |||
// <thrown> | // <thrown> | |||
// <li> AipsError - If the index is equal to or larger than the number of | // <li> AipsError - If the index is equal to or larger than the number of | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 11 lines changed or added | |||
CoordinateSystem.h | CoordinateSystem.h | |||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | |||
//# | //# | |||
//# Correspondence concerning AIPS++ should be addressed as follows: | //# Correspondence concerning AIPS++ should be addressed as follows: | |||
//# Internet email: aips2-request@nrao.edu. | //# Internet email: aips2-request@nrao.edu. | |||
//# Postal address: AIPS++ Project Office | //# Postal address: AIPS++ Project Office | |||
//# National Radio Astronomy Observatory | //# National Radio Astronomy Observatory | |||
//# 520 Edgemont Road | //# 520 Edgemont Road | |||
//# Charlottesville, VA 22903-2475 USA | //# Charlottesville, VA 22903-2475 USA | |||
//# | //# | |||
//# | //# | |||
//# $Id: CoordinateSystem.h 21130 2011-10-18 07:39:05Z gervandiepen $ | //# $Id: CoordinateSystem.h 21228 2012-04-02 11:58:13Z gervandiepen $ | |||
#ifndef COORDINATES_COORDINATESYSTEM_H | #ifndef COORDINATES_COORDINATESYSTEM_H | |||
#define COORDINATES_COORDINATESYSTEM_H | #define COORDINATES_COORDINATESYSTEM_H | |||
#include <casa/aips.h> | #include <casa/aips.h> | |||
#include <coordinates/Coordinates/Coordinate.h> | #include <coordinates/Coordinates/Coordinate.h> | |||
#include <measures/Measures/MDirection.h> | #include <measures/Measures/MDirection.h> | |||
#include <measures/Measures/MFrequency.h> | #include <measures/Measures/MFrequency.h> | |||
#include <coordinates/Coordinates/ObsInfo.h> | #include <coordinates/Coordinates/ObsInfo.h> | |||
#include <casa/Containers/Block.h> | #include <casa/Containers/Block.h> | |||
skipping to change at line 418 | skipping to change at line 418 | |||
// Find the world axis for the given pixel axis in a CoordinateSystem. | // Find the world axis for the given pixel axis in a CoordinateSystem. | |||
// Returns -1 if the world axis is unavailable (e.g. if it has been | // Returns -1 if the world axis is unavailable (e.g. if it has been | |||
// removed). | // removed). | |||
Int pixelAxisToWorldAxis(uInt pixelAxis) const; | Int pixelAxisToWorldAxis(uInt pixelAxis) const; | |||
// Find the pixel axis for the given world axis in a CoordinateSystem. | // Find the pixel axis for the given world axis in a CoordinateSystem. | |||
// Returns -1 if the pixel axis is unavailable (e.g. if it has been | // Returns -1 if the pixel axis is unavailable (e.g. if it has been | |||
// removed). | // removed). | |||
Int worldAxisToPixelAxis(uInt worldAxis) const; | Int worldAxisToPixelAxis(uInt worldAxis) const; | |||
// Return the name of the record field in which the coordinate is store | ||||
d. | ||||
String coordRecordName(uInt which) const; | ||||
// Returns <src>Coordinate::COORDSYS</src> | // Returns <src>Coordinate::COORDSYS</src> | |||
virtual Coordinate::Type type() const; | virtual Coordinate::Type type() const; | |||
// Always returns "System" | // Always returns "System" | |||
virtual String showType() const; | virtual String showType() const; | |||
// Sums the number of axes in the Coordinates that the CoordinateSystem | // Sums the number of axes in the Coordinates that the CoordinateSystem | |||
// contains, allowing for removed axes. | // contains, allowing for removed axes. | |||
// <group> | // <group> | |||
virtual uInt nPixelAxes() const; | virtual uInt nPixelAxes() const; | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 5 lines changed or added | |||
Flux.tcc | Flux.tcc | |||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
//# along with this library; if not, write to the Free Software Foundation, | //# along with this library; if not, write to the Free Software Foundation, | |||
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | |||
//# | //# | |||
//# Correspondence concerning AIPS++ should be addressed as follows: | //# Correspondence concerning AIPS++ should be addressed as follows: | |||
//# Internet email: aips2-request@nrao.edu. | //# Internet email: aips2-request@nrao.edu. | |||
//# Postal address: AIPS++ Project Office | //# Postal address: AIPS++ Project Office | |||
//# National Radio Astronomy Observatory | //# National Radio Astronomy Observatory | |||
//# 520 Edgemont Road | //# 520 Edgemont Road | |||
//# Charlottesville, VA 22903-2475 USA | //# Charlottesville, VA 22903-2475 USA | |||
//# | //# | |||
//# $Id: Flux.tcc 21130 2011-10-18 07:39:05Z gervandiepen $ | //# $Id: Flux.tcc 21229 2012-04-02 12:00:20Z gervandiepen $ | |||
#include <components/ComponentModels/Flux.h> | #include <components/ComponentModels/Flux.h> | |||
#include <casa/Arrays/Array.h> | #include <casa/Arrays/Array.h> | |||
#include <casa/Arrays/ArrayMath.h> | #include <casa/Arrays/ArrayMath.h> | |||
#include <casa/Arrays/ArrayLogical.h> | #include <casa/Arrays/ArrayLogical.h> | |||
#include <casa/Containers/RecordInterface.h> | #include <casa/Containers/RecordInterface.h> | |||
#include <casa/Exceptions/Error.h> | #include <casa/Exceptions/Error.h> | |||
#include <casa/Logging/LogIO.h> | #include <casa/Logging/LogIO.h> | |||
#include <casa/Logging/LogOrigin.h> | #include <casa/Logging/LogOrigin.h> | |||
#include <casa/BasicSL/Complex.h> | #include <casa/BasicSL/Complex.h> | |||
skipping to change at line 58 | skipping to change at line 58 | |||
template<class T> Vector<String> FluxRep<T>::_allowedUnits(0); | template<class T> Vector<String> FluxRep<T>::_allowedUnits(0); | |||
template<class T> FluxRep<T>:: | template<class T> FluxRep<T>:: | |||
FluxRep() | FluxRep() | |||
:itsVal(4, typename NumericTraits<T>::ConjugateType(0,0)), | :itsVal(4, typename NumericTraits<T>::ConjugateType(0,0)), | |||
itsPol(ComponentType::STOKES), | itsPol(ComponentType::STOKES), | |||
itsUnit("Jy"), | itsUnit("Jy"), | |||
itsErr(4, typename NumericTraits<T>::ConjugateType(0,0)) | itsErr(4, typename NumericTraits<T>::ConjugateType(0,0)) | |||
{ | { | |||
itsVal(0) = 1; | itsVal(0) = 1; | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> FluxRep<T>:: | template<class T> FluxRep<T>:: | |||
FluxRep(T i) | FluxRep(T i) | |||
:itsVal(4, typename NumericTraits<T>::ConjugateType(0,0)), | :itsVal(4, typename NumericTraits<T>::ConjugateType(0,0)), | |||
itsPol(ComponentType::STOKES), | itsPol(ComponentType::STOKES), | |||
itsUnit("Jy"), | itsUnit("Jy"), | |||
itsErr(4, typename NumericTraits<T>::ConjugateType(0,0)) | itsErr(4, typename NumericTraits<T>::ConjugateType(0,0)) | |||
{ | { | |||
itsVal(0) = i; | itsVal(0) = i; | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> FluxRep<T>:: | template<class T> FluxRep<T>:: | |||
FluxRep(T i, T q, T u, T v) | FluxRep(T i, T q, T u, T v) | |||
:itsVal(4, typename NumericTraits<T>::ConjugateType(0,0)), | :itsVal(4, typename NumericTraits<T>::ConjugateType(0,0)), | |||
itsPol(ComponentType::STOKES), | itsPol(ComponentType::STOKES), | |||
itsUnit("Jy"), | itsUnit("Jy"), | |||
itsErr(4, typename NumericTraits<T>::ConjugateType(0,0)) | itsErr(4, typename NumericTraits<T>::ConjugateType(0,0)) | |||
{ | { | |||
itsVal(0) = i; | itsVal(0) = i; | |||
itsVal(1) = q; | itsVal(1) = q; | |||
itsVal(2) = u; | itsVal(2) = u; | |||
itsVal(3) = v; | itsVal(3) = v; | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> FluxRep<T>:: | template<class T> FluxRep<T>:: | |||
FluxRep(typename NumericTraits<T>::ConjugateType xx, | FluxRep(typename NumericTraits<T>::ConjugateType xx, | |||
typename NumericTraits<T>::ConjugateType xy, | typename NumericTraits<T>::ConjugateType xy, | |||
typename NumericTraits<T>::ConjugateType yx, | typename NumericTraits<T>::ConjugateType yx, | |||
typename NumericTraits<T>::ConjugateType yy, | typename NumericTraits<T>::ConjugateType yy, | |||
ComponentType::Polarisation pol) | ComponentType::Polarisation pol) | |||
:itsVal(4), | :itsVal(4), | |||
itsPol(pol), | itsPol(pol), | |||
itsUnit("Jy"), | itsUnit("Jy"), | |||
itsErr(4, typename NumericTraits<T>::ConjugateType(0,0)) | itsErr(4, typename NumericTraits<T>::ConjugateType(0,0)) | |||
{ | { | |||
itsVal(0) = xx; | itsVal(0) = xx; | |||
itsVal(1) = xy; | itsVal(1) = xy; | |||
itsVal(2) = yx; | itsVal(2) = yx; | |||
itsVal(3) = yy; | itsVal(3) = yy; | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> FluxRep<T>:: | template<class T> FluxRep<T>:: | |||
FluxRep(const Vector<T>& flux) | FluxRep(const Vector<T>& flux) | |||
:itsVal(4, typename NumericTraits<T>::ConjugateType(0,0)), | :itsVal(4, typename NumericTraits<T>::ConjugateType(0,0)), | |||
itsPol(ComponentType::STOKES), | itsPol(ComponentType::STOKES), | |||
itsUnit("Jy"), | itsUnit("Jy"), | |||
itsErr(4, typename NumericTraits<T>::ConjugateType(0,0)) | itsErr(4, typename NumericTraits<T>::ConjugateType(0,0)) | |||
{ | { | |||
DebugAssert(flux.nelements() == 4, AipsError); | ||||
for (uInt i = 0 ; i < 4; i++) { | for (uInt i = 0 ; i < 4; i++) { | |||
itsVal(i) = flux(i); | itsVal(i) = flux(i); | |||
} | } | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> FluxRep<T>:: | template<class T> FluxRep<T>:: | |||
FluxRep(const Vector<typename NumericTraits<T>::ConjugateType>& flux, | FluxRep(const Vector<typename NumericTraits<T>::ConjugateType>& flux, | |||
ComponentType::Polarisation pol) | ComponentType::Polarisation pol) | |||
:itsVal(flux.copy()), | :itsVal(flux.copy()), | |||
itsPol(pol), | itsPol(pol), | |||
itsUnit("Jy"), | itsUnit("Jy"), | |||
itsErr(4, typename NumericTraits<T>::ConjugateType(0,0)) | itsErr(4, typename NumericTraits<T>::ConjugateType(0,0)) | |||
{ | { | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> FluxRep<T>:: | template<class T> FluxRep<T>:: | |||
FluxRep(const Quantum<Vector<T> >& flux) | FluxRep(const Quantum<Vector<T> >& flux) | |||
:itsVal(4, typename NumericTraits<T>::ConjugateType(0,0)), | :itsVal(4, typename NumericTraits<T>::ConjugateType(0,0)), | |||
itsPol(ComponentType::STOKES), | itsPol(ComponentType::STOKES), | |||
itsUnit(flux.getFullUnit()), | itsUnit(flux.getFullUnit()), | |||
itsErr(4, typename NumericTraits<T>::ConjugateType(0,0)) | itsErr(4, typename NumericTraits<T>::ConjugateType(0,0)) | |||
{ | { | |||
const Vector<T>& fluxVal(flux.getValue()); | const Vector<T>& fluxVal(flux.getValue()); | |||
DebugAssert(fluxVal.nelements() == 4, AipsError); | ||||
convertArray(itsVal, fluxVal); | convertArray(itsVal, fluxVal); | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> FluxRep<T>:: | template<class T> FluxRep<T>:: | |||
FluxRep(const Quantum<Vector<typename NumericTraits<T>::ConjugateType> >& f lux, | FluxRep(const Quantum<Vector<typename NumericTraits<T>::ConjugateType> >& f lux, | |||
ComponentType::Polarisation pol) | ComponentType::Polarisation pol) | |||
:itsVal(flux.getValue().copy()), | :itsVal(flux.getValue().copy()), | |||
itsPol(pol), | itsPol(pol), | |||
itsUnit(flux.getFullUnit()), | itsUnit(flux.getFullUnit()), | |||
itsErr(4, typename NumericTraits<T>::ConjugateType(0,0)) | itsErr(4, typename NumericTraits<T>::ConjugateType(0,0)) | |||
{ | { | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> FluxRep<T>:: | template<class T> FluxRep<T>:: | |||
FluxRep(const FluxRep<T>& other) | FluxRep(const FluxRep<T>& other) | |||
:itsVal(other.itsVal.copy()), | :itsVal(other.itsVal.copy()), | |||
itsPol(other.itsPol), | itsPol(other.itsPol), | |||
itsUnit(other.itsUnit), | itsUnit(other.itsUnit), | |||
itsErr(other.itsErr) | itsErr(other.itsErr) | |||
{ | { | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> FluxRep<T>:: | template<class T> FluxRep<T>:: | |||
~FluxRep() { | ~FluxRep() { | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> FluxRep<T>& FluxRep<T>:: | template<class T> FluxRep<T>& FluxRep<T>:: | |||
operator=(const FluxRep<T>& other) { | operator=(const FluxRep<T>& other) { | |||
if (this != &other) { | if (this != &other) { | |||
itsVal = other.itsVal; | itsVal = other.itsVal; | |||
itsPol = other.itsPol; | itsPol = other.itsPol; | |||
itsUnit = other.itsUnit; | itsUnit = other.itsUnit; | |||
itsErr = other.itsErr; | itsErr = other.itsErr; | |||
} | } | |||
DebugAssert(ok(), AipsError); | ||||
return *this; | return *this; | |||
} | } | |||
template<class T> const Unit& FluxRep<T>:: | template<class T> const Unit& FluxRep<T>:: | |||
unit() const { | unit() const { | |||
DebugAssert(ok(), AipsError); | ||||
return itsUnit; | return itsUnit; | |||
} | } | |||
template<class T> void FluxRep<T>:: | template<class T> void FluxRep<T>:: | |||
unit(Unit& unit) const { | unit(Unit& unit) const { | |||
unit = itsUnit; | unit = itsUnit; | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> void FluxRep<T>:: | template<class T> void FluxRep<T>:: | |||
setUnit(const Unit& unit) { | setUnit(const Unit& unit) { | |||
itsUnit = unit; | itsUnit = unit; | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> void FluxRep<T>:: | template<class T> void FluxRep<T>:: | |||
convertUnit(const Unit& unit) { | convertUnit(const Unit& unit) { | |||
if (unit.getName() != itsUnit.getName()) { | if (unit.getName() != itsUnit.getName()) { | |||
T factor = itsUnit.getValue().getFac()/unit.getValue().getFac(); | T factor = itsUnit.getValue().getFac()/unit.getValue().getFac(); | |||
for (uInt i = 0; i < 4; i++) { | for (uInt i = 0; i < 4; i++) { | |||
itsVal(i) *= factor; | itsVal(i) *= factor; | |||
itsErr(i) *= factor; | itsErr(i) *= factor; | |||
} | } | |||
itsUnit = unit; | itsUnit = unit; | |||
} | } | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> ComponentType::Polarisation FluxRep<T>:: | template<class T> ComponentType::Polarisation FluxRep<T>:: | |||
pol() const { | pol() const { | |||
DebugAssert(ok(), AipsError); | ||||
return itsPol; | return itsPol; | |||
} | } | |||
template<class T> void FluxRep<T>:: | template<class T> void FluxRep<T>:: | |||
pol(ComponentType::Polarisation& pol) const { | pol(ComponentType::Polarisation& pol) const { | |||
pol = itsPol; | pol = itsPol; | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> void FluxRep<T>:: | template<class T> void FluxRep<T>:: | |||
setPol(ComponentType::Polarisation pol) { | setPol(ComponentType::Polarisation pol) { | |||
itsPol = pol; | itsPol = pol; | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> void FluxRep<T>:: | template<class T> void FluxRep<T>:: | |||
convertPol(ComponentType::Polarisation pol) { | convertPol(ComponentType::Polarisation pol) { | |||
if (itsPol != pol) { | if (itsPol != pol) { | |||
switch (pol){ | switch (pol){ | |||
case ComponentType::STOKES: | case ComponentType::STOKES: | |||
if (itsPol == ComponentType::LINEAR) { | if (itsPol == ComponentType::LINEAR) { | |||
Flux<T>::linearToStokes(itsVal, itsVal); | Flux<T>::linearToStokes(itsVal, itsVal); | |||
} else { | } else { | |||
skipping to change at line 271 | skipping to change at line 251 | |||
C::dbl_epsilon)) { | C::dbl_epsilon)) { | |||
LogIO logErr(LogOrigin("FluxRep", "convertPol()")); | LogIO logErr(LogOrigin("FluxRep", "convertPol()")); | |||
logErr << LogIO::WARN | logErr << LogIO::WARN | |||
<< "The change in flux representation means the numerical value s" | << "The change in flux representation means the numerical value s" | |||
<< " have changed" << endl | << " have changed" << endl | |||
<< "But the errors in the flux are not being changed " | << "But the errors in the flux are not being changed " | |||
<< "and are probably now incorrect" | << "and are probably now incorrect" | |||
<< LogIO::POST; | << LogIO::POST; | |||
} | } | |||
} | } | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> | template<class T> | |||
const Vector<typename NumericTraits<T>::ConjugateType>& FluxRep<T>:: | const Vector<typename NumericTraits<T>::ConjugateType>& FluxRep<T>:: | |||
value() const { | value() const { | |||
DebugAssert(ok(), AipsError); | ||||
return itsVal; | return itsVal; | |||
} | } | |||
template<class T> | template<class T> | |||
const typename NumericTraits<T>::ConjugateType& FluxRep<T>:: | const typename NumericTraits<T>::ConjugateType& FluxRep<T>:: | |||
value(uInt p) const { | value(uInt p) const { | |||
DebugAssert(p < 4, AipsError); | ||||
DebugAssert(ok(), AipsError); | ||||
return itsVal(p); | return itsVal(p); | |||
} | } | |||
template<class T> void FluxRep<T>:: | template<class T> void FluxRep<T>:: | |||
value(Vector<T>& value) { | value(Vector<T>& value) { | |||
const uInt len = value.nelements(); | const uInt len = value.nelements(); | |||
DebugAssert (len == 4 || len == 0, AipsError); | ||||
if (len == 0) value.resize(4); | if (len == 0) value.resize(4); | |||
convertPol(ComponentType::STOKES); | convertPol(ComponentType::STOKES); | |||
for (uInt s = 0 ; s < 4; s++) { | for (uInt s = 0 ; s < 4; s++) { | |||
value(s) = itsVal(s).real(); | value(s) = itsVal(s).real(); | |||
} | } | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> void FluxRep<T>:: | template<class T> void FluxRep<T>:: | |||
value(Vector<typename NumericTraits<T>::ConjugateType>& value) const { | value(Vector<typename NumericTraits<T>::ConjugateType>& value) const { | |||
DebugAssert(ok(), AipsError); | ||||
DebugAssert (value.nelements() == 4 || value.nelements() == 0, AipsError) | ||||
; | ||||
value = itsVal; | value = itsVal; | |||
} | } | |||
template<class T> void FluxRep<T>:: | template<class T> void FluxRep<T>:: | |||
value(Quantum<Vector<T> >& value) { | value(Quantum<Vector<T> >& value) { | |||
const Unit& curUnit = value.getFullUnit(); | const Unit& curUnit = value.getFullUnit(); | |||
if (curUnit != itsUnit) { | if (curUnit != itsUnit) { | |||
value.setUnit(itsUnit); | value.setUnit(itsUnit); | |||
} | } | |||
convertPol(ComponentType::STOKES); | convertPol(ComponentType::STOKES); | |||
Vector<T>& newValue = value.getValue(); | Vector<T>& newValue = value.getValue(); | |||
if (newValue.nelements() != 4) newValue.resize(4); | if (newValue.nelements() != 4) newValue.resize(4); | |||
for (uInt s = 0 ; s < 4; s++) { | for (uInt s = 0 ; s < 4; s++) { | |||
newValue(s) = itsVal(s).real(); | newValue(s) = itsVal(s).real(); | |||
} | } | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> Quantum<T> FluxRep<T>:: | template<class T> Quantum<T> FluxRep<T>:: | |||
value (Stokes::StokesTypes stokes, Bool toJy) | value (Stokes::StokesTypes stokes, Bool toJy) | |||
{ | { | |||
LogIO os(LogOrigin("FluxRep", "value(Stokes::StokesTypes)")); | LogIO os(LogOrigin("FluxRep", "value(Stokes::StokesTypes)")); | |||
// Get the vector of values that we are holding | // Get the vector of values that we are holding | |||
Vector<T> values; | Vector<T> values; | |||
skipping to change at line 380 | skipping to change at line 351 | |||
value) const { | value) const { | |||
const Unit& curUnit = value.getFullUnit(); | const Unit& curUnit = value.getFullUnit(); | |||
if (curUnit != itsUnit) { | if (curUnit != itsUnit) { | |||
value.setUnit(itsUnit); | value.setUnit(itsUnit); | |||
} | } | |||
Vector<typename NumericTraits<T>::ConjugateType>& newValue = value.getVal ue(); | Vector<typename NumericTraits<T>::ConjugateType>& newValue = value.getVal ue(); | |||
if (newValue.nelements() != 4) newValue.resize(4); | if (newValue.nelements() != 4) newValue.resize(4); | |||
for (uInt s = 0 ; s < 4; s++) { | for (uInt s = 0 ; s < 4; s++) { | |||
newValue(s) = itsVal(s); | newValue(s) = itsVal(s); | |||
} | } | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> void FluxRep<T>:: | template<class T> void FluxRep<T>:: | |||
setValue(T value) { | setValue(T value) { | |||
for (uInt i = 0; i < 4; i++) { | for (uInt i = 0; i < 4; i++) { | |||
itsVal(i) = 0.0; | itsVal(i) = 0.0; | |||
} | } | |||
itsVal(0) = value; | itsVal(0) = value; | |||
itsPol = ComponentType::STOKES; | itsPol = ComponentType::STOKES; | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> void FluxRep<T>:: | template<class T> void FluxRep<T>:: | |||
setValue(const Vector<T>& value) { | setValue(const Vector<T>& value) { | |||
DebugAssert (value.nelements() == 4, AipsError); | ||||
for (uInt i = 0; i < 4; i++) { | for (uInt i = 0; i < 4; i++) { | |||
itsVal(i) = value(i); | itsVal(i) = value(i); | |||
} | } | |||
itsPol = ComponentType::STOKES; | itsPol = ComponentType::STOKES; | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> void FluxRep<T>:: | template<class T> void FluxRep<T>:: | |||
setValue(const Vector<typename NumericTraits<T>::ConjugateType>& value) { | setValue(const Vector<typename NumericTraits<T>::ConjugateType>& value) { | |||
DebugAssert (value.nelements() == 4, AipsError); | ||||
itsVal = value; | itsVal = value; | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> void FluxRep<T>:: | template<class T> void FluxRep<T>:: | |||
setValue(const Quantum<Vector<T> >& value) { | setValue(const Quantum<Vector<T> >& value) { | |||
DebugAssert (value.getValue().nelements() == 4, AipsError); | ||||
const Vector<T>& val = value.getValue(); | const Vector<T>& val = value.getValue(); | |||
for (uInt s = 0; s < 4; s++) { | for (uInt s = 0; s < 4; s++) { | |||
itsVal(s) = val(s); | itsVal(s) = val(s); | |||
} | } | |||
itsUnit = value.getFullUnit(); | itsUnit = value.getFullUnit(); | |||
itsPol = ComponentType::STOKES; | itsPol = ComponentType::STOKES; | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> void FluxRep<T>:: | template<class T> void FluxRep<T>:: | |||
setValue(const | setValue(const | |||
Quantum<Vector<typename NumericTraits<T>::ConjugateType> >& value, | Quantum<Vector<typename NumericTraits<T>::ConjugateType> >& value, | |||
ComponentType::Polarisation pol) { | ComponentType::Polarisation pol) { | |||
DebugAssert (value.getValue().nelements() == 4, AipsError); | ||||
itsVal = value.getValue(); | itsVal = value.getValue(); | |||
itsUnit = value.getFullUnit(); | itsUnit = value.getFullUnit(); | |||
itsPol = pol; | itsPol = pol; | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> void FluxRep<T>::setValue( | template<class T> void FluxRep<T>::setValue( | |||
const Quantum<T>& value, Stokes::StokesTypes stokes | const Quantum<T>& value, Stokes::StokesTypes stokes | |||
) { | ) { | |||
LogIO os(LogOrigin("FluxRep", "setValue(const Quantum<Double>&, Stok es::StokesTypes)")); | LogIO os(LogOrigin("FluxRep", "setValue(const Quantum<Double>&, Stok es::StokesTypes)")); | |||
Vector<T> tmp(4, 0.0); | Vector<T> tmp(4, 0.0); | |||
String conversionUnit = "Jy"; | String conversionUnit = "Jy"; | |||
if (! value.isConform("Jy")) { | if (! value.isConform("Jy")) { | |||
Bool found = False; | Bool found = False; | |||
skipping to change at line 479 | skipping to change at line 440 | |||
os << LogIO::WARN << "Can only properly handle I,Q,U,V prese ntly." << endl; | os << LogIO::WARN << "Can only properly handle I,Q,U,V prese ntly." << endl; | |||
os << "The brightness is assumed to be Stokes I" << LogIO:: POST; | os << "The brightness is assumed to be Stokes I" << LogIO:: POST; | |||
tmp(0) = value.getValue(Unit("Jy")); | tmp(0) = value.getValue(Unit("Jy")); | |||
} | } | |||
setValue(tmp); | setValue(tmp); | |||
} | } | |||
template<class T> void FluxRep<T>:: | template<class T> void FluxRep<T>:: | |||
scaleValue(const T& factor) { | scaleValue(const T& factor) { | |||
itsVal(0) *= factor; | itsVal(0) *= factor; | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> void FluxRep<T>:: | template<class T> void FluxRep<T>:: | |||
scaleValue(const T& factor0, const T& factor1, | scaleValue(const T& factor0, const T& factor1, | |||
const T& factor2, const T& factor3) { | const T& factor2, const T& factor3) { | |||
itsVal(0) *= factor0; | itsVal(0) *= factor0; | |||
itsVal(1) *= factor1; | itsVal(1) *= factor1; | |||
itsVal(2) *= factor2; | itsVal(2) *= factor2; | |||
itsVal(3) *= factor3; | itsVal(3) *= factor3; | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> void FluxRep<T>:: | template<class T> void FluxRep<T>:: | |||
scaleValue(const typename NumericTraits<T>::ConjugateType& factor) { | scaleValue(const typename NumericTraits<T>::ConjugateType& factor) { | |||
itsVal(0) *= factor; | itsVal(0) *= factor; | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> void FluxRep<T>:: | template<class T> void FluxRep<T>:: | |||
scaleValue(const typename NumericTraits<T>::ConjugateType& factor0, | scaleValue(const typename NumericTraits<T>::ConjugateType& factor0, | |||
const typename NumericTraits<T>::ConjugateType& factor1, | const typename NumericTraits<T>::ConjugateType& factor1, | |||
const typename NumericTraits<T>::ConjugateType& factor2, | const typename NumericTraits<T>::ConjugateType& factor2, | |||
const typename NumericTraits<T>::ConjugateType& factor3) { | const typename NumericTraits<T>::ConjugateType& factor3) { | |||
itsVal(0) *= factor0; | itsVal(0) *= factor0; | |||
itsVal(1) *= factor1; | itsVal(1) *= factor1; | |||
itsVal(2) *= factor2; | itsVal(2) *= factor2; | |||
itsVal(3) *= factor3; | itsVal(3) *= factor3; | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> void FluxRep<T>:: | template<class T> void FluxRep<T>:: | |||
setErrors(const typename NumericTraits<T>::ConjugateType& error0, | setErrors(const typename NumericTraits<T>::ConjugateType& error0, | |||
const typename NumericTraits<T>::ConjugateType& error1, | const typename NumericTraits<T>::ConjugateType& error1, | |||
const typename NumericTraits<T>::ConjugateType& error2, | const typename NumericTraits<T>::ConjugateType& error2, | |||
const typename NumericTraits<T>::ConjugateType& error3) { | const typename NumericTraits<T>::ConjugateType& error3) { | |||
itsErr(0) = error0; | itsErr(0) = error0; | |||
itsErr(1) = error1; | itsErr(1) = error1; | |||
itsErr(2) = error2; | itsErr(2) = error2; | |||
skipping to change at line 742 | skipping to change at line 699 | |||
} | } | |||
template<class T> void FluxRep<T>::clearAllowedUnits() { | template<class T> void FluxRep<T>::clearAllowedUnits() { | |||
_allowedUnits.resize(0); | _allowedUnits.resize(0); | |||
} | } | |||
template<class T> Flux<T>:: | template<class T> Flux<T>:: | |||
Flux() | Flux() | |||
:itsFluxPtr(new FluxRep<T>) | :itsFluxPtr(new FluxRep<T>) | |||
{ | { | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> Flux<T>:: | template<class T> Flux<T>:: | |||
Flux(T i) | Flux(T i) | |||
:itsFluxPtr(new FluxRep<T>(i)) | :itsFluxPtr(new FluxRep<T>(i)) | |||
{ | { | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> Flux<T>:: | template<class T> Flux<T>:: | |||
Flux(T i, T q, T u, T v) | Flux(T i, T q, T u, T v) | |||
:itsFluxPtr(new FluxRep<T>(i, q, u, v)) | :itsFluxPtr(new FluxRep<T>(i, q, u, v)) | |||
{ | { | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> Flux<T>:: | template<class T> Flux<T>:: | |||
Flux(typename NumericTraits<T>::ConjugateType xx, | Flux(typename NumericTraits<T>::ConjugateType xx, | |||
typename NumericTraits<T>::ConjugateType xy, | typename NumericTraits<T>::ConjugateType xy, | |||
typename NumericTraits<T>::ConjugateType yx, | typename NumericTraits<T>::ConjugateType yx, | |||
typename NumericTraits<T>::ConjugateType yy, | typename NumericTraits<T>::ConjugateType yy, | |||
ComponentType::Polarisation pol) | ComponentType::Polarisation pol) | |||
:itsFluxPtr(new FluxRep<T>(xx, xy, yx, yy, pol)) | :itsFluxPtr(new FluxRep<T>(xx, xy, yx, yy, pol)) | |||
{ | { | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> Flux<T>:: | template<class T> Flux<T>:: | |||
Flux(const Vector<T>& flux) | Flux(const Vector<T>& flux) | |||
:itsFluxPtr(new FluxRep<T>(flux)) | :itsFluxPtr(new FluxRep<T>(flux)) | |||
{ | { | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> Flux<T>:: | template<class T> Flux<T>:: | |||
Flux(const Vector<typename NumericTraits<T>::ConjugateType>& flux, | Flux(const Vector<typename NumericTraits<T>::ConjugateType>& flux, | |||
ComponentType::Polarisation pol) | ComponentType::Polarisation pol) | |||
:itsFluxPtr(new FluxRep<T>(flux, pol)) | :itsFluxPtr(new FluxRep<T>(flux, pol)) | |||
{ | { | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> Flux<T>:: | template<class T> Flux<T>:: | |||
Flux(const Quantum<Vector<T> >& flux) | Flux(const Quantum<Vector<T> >& flux) | |||
:itsFluxPtr(new FluxRep<T>(flux)) | :itsFluxPtr(new FluxRep<T>(flux)) | |||
{ | { | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> Flux<T>:: | template<class T> Flux<T>:: | |||
Flux(const Flux<T>& other) | Flux(const Flux<T>& other) | |||
:itsFluxPtr(other.itsFluxPtr) | :itsFluxPtr(other.itsFluxPtr) | |||
{ | { | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> Flux<T>:: | template<class T> Flux<T>:: | |||
~Flux() { | ~Flux() { | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> Flux<T>& Flux<T>:: | template<class T> Flux<T>& Flux<T>:: | |||
operator=(const Flux<T>& other) { | operator=(const Flux<T>& other) { | |||
if (this != &other) { | if (this != &other) { | |||
itsFluxPtr = other.itsFluxPtr; | itsFluxPtr = other.itsFluxPtr; | |||
} | } | |||
DebugAssert(ok(), AipsError); | ||||
return *this; | return *this; | |||
} | } | |||
template<class T> Flux<T> Flux<T>:: | template<class T> Flux<T> Flux<T>:: | |||
copy() const { | copy() const { | |||
DebugAssert(ok(), AipsError); | ||||
Flux<T> newFlux(value(), pol()); | Flux<T> newFlux(value(), pol()); | |||
newFlux.setUnit(unit()); | newFlux.setUnit(unit()); | |||
return newFlux; | return newFlux; | |||
} | } | |||
template<class T> const Unit& Flux<T>:: | template<class T> const Unit& Flux<T>:: | |||
unit() const { | unit() const { | |||
DebugAssert(ok(), AipsError); | ||||
return itsFluxPtr->unit(); | return itsFluxPtr->unit(); | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
unit(Unit& unit) const { | unit(Unit& unit) const { | |||
DebugAssert(ok(), AipsError); | ||||
itsFluxPtr->unit(unit); | itsFluxPtr->unit(unit); | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
setUnit(const Unit& unit) { | setUnit(const Unit& unit) { | |||
DebugAssert(ok(), AipsError); | ||||
itsFluxPtr->setUnit(unit); | itsFluxPtr->setUnit(unit); | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
convertUnit(const Unit& unit) { | convertUnit(const Unit& unit) { | |||
DebugAssert(ok(), AipsError); | ||||
itsFluxPtr->convertUnit(unit); | itsFluxPtr->convertUnit(unit); | |||
} | } | |||
template<class T> ComponentType::Polarisation Flux<T>:: | template<class T> ComponentType::Polarisation Flux<T>:: | |||
pol() const { | pol() const { | |||
DebugAssert(ok(), AipsError); | ||||
return itsFluxPtr->pol(); | return itsFluxPtr->pol(); | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
pol(ComponentType::Polarisation& pol) const { | pol(ComponentType::Polarisation& pol) const { | |||
DebugAssert(ok(), AipsError); | ||||
itsFluxPtr->pol(pol); | itsFluxPtr->pol(pol); | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
setPol(ComponentType::Polarisation pol) { | setPol(ComponentType::Polarisation pol) { | |||
DebugAssert(ok(), AipsError); | ||||
itsFluxPtr->setPol(pol); | itsFluxPtr->setPol(pol); | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
convertPol(ComponentType::Polarisation pol) { | convertPol(ComponentType::Polarisation pol) { | |||
DebugAssert(ok(), AipsError); | ||||
itsFluxPtr->convertPol(pol); | itsFluxPtr->convertPol(pol); | |||
} | } | |||
template<class T> const | template<class T> const | |||
Vector<typename NumericTraits<T>::ConjugateType>& Flux<T>::value() const { | Vector<typename NumericTraits<T>::ConjugateType>& Flux<T>::value() const { | |||
DebugAssert(ok(), AipsError); | ||||
return itsFluxPtr->value(); | return itsFluxPtr->value(); | |||
} | } | |||
template<class T> const typename NumericTraits<T>::ConjugateType& Flux<T>:: | template<class T> const typename NumericTraits<T>::ConjugateType& Flux<T>:: | |||
value(uInt p) const { | value(uInt p) const { | |||
DebugAssert(ok(), AipsError); | ||||
return itsFluxPtr->value(p); | return itsFluxPtr->value(p); | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
value(Vector<T>& value) { | value(Vector<T>& value) { | |||
DebugAssert(ok(), AipsError); | ||||
itsFluxPtr->value(value); | itsFluxPtr->value(value); | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
value(Vector<typename NumericTraits<T>::ConjugateType>& value) const { | value(Vector<typename NumericTraits<T>::ConjugateType>& value) const { | |||
DebugAssert(ok(), AipsError); | ||||
itsFluxPtr->value(value); | itsFluxPtr->value(value); | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
value(Quantum<Vector<T> >& value) { | value(Quantum<Vector<T> >& value) { | |||
DebugAssert(ok(), AipsError); | ||||
itsFluxPtr->value(value); | itsFluxPtr->value(value); | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
value(Quantum<Vector<typename NumericTraits<T>::ConjugateType> >& | value(Quantum<Vector<typename NumericTraits<T>::ConjugateType> >& | |||
value) const { | value) const { | |||
DebugAssert(ok(), AipsError); | ||||
itsFluxPtr->value(value); | itsFluxPtr->value(value); | |||
} | } | |||
template<class T> Quantum<T> Flux<T>:: | template<class T> Quantum<T> Flux<T>:: | |||
value (Stokes::StokesTypes stokes, Bool toJy) | value (Stokes::StokesTypes stokes, Bool toJy) | |||
{ | { | |||
DebugAssert(ok(), AipsError); | ||||
return itsFluxPtr->value(stokes, toJy); | return itsFluxPtr->value(stokes, toJy); | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
setValue(T value) { | setValue(T value) { | |||
DebugAssert(ok(), AipsError); | ||||
itsFluxPtr->setValue(value); | itsFluxPtr->setValue(value); | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
setValue(const Vector<T>& value) { | setValue(const Vector<T>& value) { | |||
DebugAssert(ok(), AipsError); | ||||
itsFluxPtr->setValue(value); | itsFluxPtr->setValue(value); | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
setValue(const Vector<typename NumericTraits<T>::ConjugateType>& value) { | setValue(const Vector<typename NumericTraits<T>::ConjugateType>& value) { | |||
DebugAssert(ok(), AipsError); | ||||
itsFluxPtr->setValue(value); | itsFluxPtr->setValue(value); | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
setValue(const Quantum<Vector<T> >& value) { | setValue(const Quantum<Vector<T> >& value) { | |||
DebugAssert(ok(), AipsError); | ||||
itsFluxPtr->setValue(value); | itsFluxPtr->setValue(value); | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
setValue(const | setValue(const | |||
Quantum<Vector<typename NumericTraits<T>::ConjugateType> >& value, | Quantum<Vector<typename NumericTraits<T>::ConjugateType> >& value, | |||
ComponentType::Polarisation pol) { | ComponentType::Polarisation pol) { | |||
DebugAssert(ok(), AipsError); | ||||
itsFluxPtr->setValue(value, pol); | itsFluxPtr->setValue(value, pol); | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
setValue(const Quantum<T>& value, Stokes::StokesTypes stokes) | setValue(const Quantum<T>& value, Stokes::StokesTypes stokes) | |||
{ | { | |||
DebugAssert(ok(), AipsError); | ||||
itsFluxPtr->setValue(value, stokes); | itsFluxPtr->setValue(value, stokes); | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
scaleValue(const T& factor) { | scaleValue(const T& factor) { | |||
itsFluxPtr->scaleValue(factor); | itsFluxPtr->scaleValue(factor); | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
scaleValue(const T& factor0, const T& factor1, | scaleValue(const T& factor0, const T& factor1, | |||
const T& factor2, const T& factor3) { | const T& factor2, const T& factor3) { | |||
itsFluxPtr->scaleValue(factor0, factor1, factor2, factor3); | itsFluxPtr->scaleValue(factor0, factor1, factor2, factor3); | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
scaleValue(const typename NumericTraits<T>::ConjugateType& factor) { | scaleValue(const typename NumericTraits<T>::ConjugateType& factor) { | |||
itsFluxPtr->scaleValue(factor); | itsFluxPtr->scaleValue(factor); | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
scaleValue(const typename NumericTraits<T>::ConjugateType& factor0, | scaleValue(const typename NumericTraits<T>::ConjugateType& factor0, | |||
const typename NumericTraits<T>::ConjugateType& factor1, | const typename NumericTraits<T>::ConjugateType& factor1, | |||
const typename NumericTraits<T>::ConjugateType& factor2, | const typename NumericTraits<T>::ConjugateType& factor2, | |||
const typename NumericTraits<T>::ConjugateType& factor3) { | const typename NumericTraits<T>::ConjugateType& factor3) { | |||
itsFluxPtr->scaleValue(factor0, factor1, factor2, factor3); | itsFluxPtr->scaleValue(factor0, factor1, factor2, factor3); | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
setErrors(const typename NumericTraits<T>::ConjugateType& error0, | setErrors(const typename NumericTraits<T>::ConjugateType& error0, | |||
const typename NumericTraits<T>::ConjugateType& error1, | const typename NumericTraits<T>::ConjugateType& error1, | |||
const typename NumericTraits<T>::ConjugateType& error2, | const typename NumericTraits<T>::ConjugateType& error2, | |||
const typename NumericTraits<T>::ConjugateType& error3) { | const typename NumericTraits<T>::ConjugateType& error3) { | |||
itsFluxPtr->setErrors(error0, error1, error2, error3); | itsFluxPtr->setErrors(error0, error1, error2, error3); | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> void Flux<T>::setErrors( | template<class T> void Flux<T>::setErrors( | |||
const Vector<typename NumericTraits<T>::ConjugateType>& errors | const Vector<typename NumericTraits<T>::ConjugateType>& errors | |||
) { | ) { | |||
itsFluxPtr->setErrors(errors); | itsFluxPtr->setErrors(errors); | |||
DebugAssert(ok(), AipsError); | ||||
} | } | |||
template<class T> const | template<class T> const | |||
Vector<typename NumericTraits<T>::ConjugateType>& Flux<T>::errors() const { | Vector<typename NumericTraits<T>::ConjugateType>& Flux<T>::errors() const { | |||
return itsFluxPtr->errors(); | return itsFluxPtr->errors(); | |||
} | } | |||
template<class T> Bool Flux<T>:: | template<class T> Bool Flux<T>:: | |||
fromRecord(String& errorMessage, const RecordInterface& record) { | fromRecord(String& errorMessage, const RecordInterface& record) { | |||
DebugAssert(ok(), AipsError); | ||||
return itsFluxPtr->fromRecord(errorMessage, record); | return itsFluxPtr->fromRecord(errorMessage, record); | |||
} | } | |||
template<class T> Bool Flux<T>:: | template<class T> Bool Flux<T>:: | |||
toRecord(String& errorMessage, RecordInterface& record) const { | toRecord(String& errorMessage, RecordInterface& record) const { | |||
DebugAssert(ok(), AipsError); | ||||
return itsFluxPtr->toRecord(errorMessage, record); | return itsFluxPtr->toRecord(errorMessage, record); | |||
} | } | |||
template<class T> Bool Flux<T>:: | template<class T> Bool Flux<T>:: | |||
ok() const { | ok() const { | |||
if (itsFluxPtr.null() == True) { | if (itsFluxPtr.null() == True) { | |||
LogIO logErr(LogOrigin("Flux", "ok()")); | LogIO logErr(LogOrigin("Flux", "ok()")); | |||
logErr << LogIO::SEVERE << "Internal pointer is not pointing to anythin g" | logErr << LogIO::SEVERE << "Internal pointer is not pointing to anythin g" | |||
<< LogIO::POST; | << LogIO::POST; | |||
return False; | return False; | |||
skipping to change at line 1033 | skipping to change at line 950 | |||
logErr << LogIO::SEVERE << "Flux representation is not ok" | logErr << LogIO::SEVERE << "Flux representation is not ok" | |||
<< LogIO::POST; | << LogIO::POST; | |||
return False; | return False; | |||
} | } | |||
return True; | return True; | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
stokesToCircular(Vector<typename NumericTraits<T>::ConjugateType>& out, | stokesToCircular(Vector<typename NumericTraits<T>::ConjugateType>& out, | |||
const Vector<T>& in) { | const Vector<T>& in) { | |||
DebugAssert(in.nelements() == 4, AipsError); | ||||
DebugAssert(out.nelements() == 4, AipsError); | ||||
const T i = in(0); | const T i = in(0); | |||
const T q = in(1); | const T q = in(1); | |||
const T u = in(2); | const T u = in(2); | |||
const T v = in(3); | const T v = in(3); | |||
out(0) = typename NumericTraits<T>::ConjugateType(i + v); | out(0) = typename NumericTraits<T>::ConjugateType(i + v); | |||
out(1) = typename NumericTraits<T>::ConjugateType(q, u); | out(1) = typename NumericTraits<T>::ConjugateType(q, u); | |||
out(2) = typename NumericTraits<T>::ConjugateType(q, -u); | out(2) = typename NumericTraits<T>::ConjugateType(q, -u); | |||
out(3) = typename NumericTraits<T>::ConjugateType(i - v); | out(3) = typename NumericTraits<T>::ConjugateType(i - v); | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
stokesToCircular(Vector<typename NumericTraits<T>::ConjugateType>& out, | stokesToCircular(Vector<typename NumericTraits<T>::ConjugateType>& out, | |||
const Vector<typename NumericTraits<T>::ConjugateType>& in) { | const Vector<typename NumericTraits<T>::ConjugateType>& in) { | |||
DebugAssert(in.nelements() == 4, AipsError); | ||||
DebugAssert(out.nelements() == 4, AipsError); | ||||
const typename NumericTraits<T>::ConjugateType i = in(0); | const typename NumericTraits<T>::ConjugateType i = in(0); | |||
const typename NumericTraits<T>::ConjugateType q = in(1); | const typename NumericTraits<T>::ConjugateType q = in(1); | |||
const typename NumericTraits<T>::ConjugateType& u = in(2); | const typename NumericTraits<T>::ConjugateType& u = in(2); | |||
const typename NumericTraits<T>::ConjugateType ju(-u.imag(), u.real()); | const typename NumericTraits<T>::ConjugateType ju(-u.imag(), u.real()); | |||
const typename NumericTraits<T>::ConjugateType v = in(3); | const typename NumericTraits<T>::ConjugateType v = in(3); | |||
out(0) = i + v; | out(0) = i + v; | |||
out(1) = q + ju; | out(1) = q + ju; | |||
out(2) = q - ju; | out(2) = q - ju; | |||
out(3) = i - v; | out(3) = i - v; | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
circularToStokes(Vector<T>& out, | circularToStokes(Vector<T>& out, | |||
const Vector<typename NumericTraits<T>::ConjugateType>& in) { | const Vector<typename NumericTraits<T>::ConjugateType>& in) { | |||
DebugAssert(in.nelements() == 4, AipsError); | ||||
DebugAssert(out.nelements() == 4, AipsError); | ||||
const T rr = in(0).real(); | const T rr = in(0).real(); | |||
const typename NumericTraits<T>::ConjugateType rl = in(1); | const typename NumericTraits<T>::ConjugateType rl = in(1); | |||
const typename NumericTraits<T>::ConjugateType lr = in(2); | const typename NumericTraits<T>::ConjugateType lr = in(2); | |||
const T ll = in(3).real(); | const T ll = in(3).real(); | |||
const T two(2); | const T two(2); | |||
out(0) = (rr + ll)/two; | out(0) = (rr + ll)/two; | |||
out(1) = (rl.real() + lr.real())/two; | out(1) = (rl.real() + lr.real())/two; | |||
out(2) = (rl.imag() - lr.imag())/two; | out(2) = (rl.imag() - lr.imag())/two; | |||
out(3) = (rr - ll)/two; | out(3) = (rr - ll)/two; | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
circularToStokes(Vector<typename NumericTraits<T>::ConjugateType>& out, | circularToStokes(Vector<typename NumericTraits<T>::ConjugateType>& out, | |||
const Vector<typename NumericTraits<T>::ConjugateType>& in) { | const Vector<typename NumericTraits<T>::ConjugateType>& in) { | |||
DebugAssert(in.nelements() == 4, AipsError); | ||||
DebugAssert(out.nelements() == 4, AipsError); | ||||
const typename NumericTraits<T>::ConjugateType rr = in(0); | const typename NumericTraits<T>::ConjugateType rr = in(0); | |||
const typename NumericTraits<T>::ConjugateType rl = in(1); | const typename NumericTraits<T>::ConjugateType rl = in(1); | |||
const typename NumericTraits<T>::ConjugateType lr = in(2); | const typename NumericTraits<T>::ConjugateType lr = in(2); | |||
const typename NumericTraits<T>::ConjugateType ll = in(3); | const typename NumericTraits<T>::ConjugateType ll = in(3); | |||
const T two(2); | const T two(2); | |||
out(0) = (rr + ll)/two; | out(0) = (rr + ll)/two; | |||
out(1) = (rl + lr)/two; | out(1) = (rl + lr)/two; | |||
out(2) = typename NumericTraits<T>::ConjugateType((rl.imag()-lr.imag())/t wo, | out(2) = typename NumericTraits<T>::ConjugateType((rl.imag()-lr.imag())/t wo, | |||
(lr.real()-rl.real())/two); | (lr.real()-rl.real())/two); | |||
out(3) = (rr - ll)/two; | out(3) = (rr - ll)/two; | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
stokesToLinear(Vector<typename NumericTraits<T>::ConjugateType>& out, | stokesToLinear(Vector<typename NumericTraits<T>::ConjugateType>& out, | |||
const Vector<T>& in) { | const Vector<T>& in) { | |||
DebugAssert(in.nelements() == 4, AipsError); | ||||
DebugAssert(out.nelements() == 4, AipsError); | ||||
const T i = in(0); | const T i = in(0); | |||
const T q = in(1); | const T q = in(1); | |||
const T u = in(2); | const T u = in(2); | |||
const T v = in(3); | const T v = in(3); | |||
out(0) = typename NumericTraits<T>::ConjugateType(i + q); | out(0) = typename NumericTraits<T>::ConjugateType(i + q); | |||
out(1) = typename NumericTraits<T>::ConjugateType(u, v); | out(1) = typename NumericTraits<T>::ConjugateType(u, v); | |||
out(2) = typename NumericTraits<T>::ConjugateType(u, -v); | out(2) = typename NumericTraits<T>::ConjugateType(u, -v); | |||
out(3) = typename NumericTraits<T>::ConjugateType(i - q); | out(3) = typename NumericTraits<T>::ConjugateType(i - q); | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
stokesToLinear(Vector<typename NumericTraits<T>::ConjugateType>& out, | stokesToLinear(Vector<typename NumericTraits<T>::ConjugateType>& out, | |||
const Vector<typename NumericTraits<T>::ConjugateType>& in) { | const Vector<typename NumericTraits<T>::ConjugateType>& in) { | |||
DebugAssert(in.nelements() == 4, AipsError); | ||||
DebugAssert(out.nelements() == 4, AipsError); | ||||
const typename NumericTraits<T>::ConjugateType i = in(0); | const typename NumericTraits<T>::ConjugateType i = in(0); | |||
const typename NumericTraits<T>::ConjugateType q = in(1); | const typename NumericTraits<T>::ConjugateType q = in(1); | |||
const typename NumericTraits<T>::ConjugateType u = in(2); | const typename NumericTraits<T>::ConjugateType u = in(2); | |||
const typename NumericTraits<T>::ConjugateType& v = in(3); | const typename NumericTraits<T>::ConjugateType& v = in(3); | |||
const typename NumericTraits<T>::ConjugateType jv(-v.imag(), v.real()); | const typename NumericTraits<T>::ConjugateType jv(-v.imag(), v.real()); | |||
out(0) = i + q; | out(0) = i + q; | |||
out(1) = u + jv; | out(1) = u + jv; | |||
out(2) = u - jv; | out(2) = u - jv; | |||
out(3) = i - q; | out(3) = i - q; | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
linearToStokes(Vector<T>& out, | linearToStokes(Vector<T>& out, | |||
const Vector<typename NumericTraits<T>::ConjugateType>& in) { | const Vector<typename NumericTraits<T>::ConjugateType>& in) { | |||
DebugAssert(in.nelements() == 4, AipsError); | ||||
DebugAssert(out.nelements() == 4, AipsError); | ||||
const T xx = in(0).real(); | const T xx = in(0).real(); | |||
const typename NumericTraits<T>::ConjugateType xy = in(1); | const typename NumericTraits<T>::ConjugateType xy = in(1); | |||
const typename NumericTraits<T>::ConjugateType yx = in(2); | const typename NumericTraits<T>::ConjugateType yx = in(2); | |||
const T yy = in(3).real(); | const T yy = in(3).real(); | |||
const T two(2); | const T two(2); | |||
out(0) = (xx + yy)/two; | out(0) = (xx + yy)/two; | |||
out(1) = (xx - yy)/two; | out(1) = (xx - yy)/two; | |||
out(2) = (xy.real() + xy.real())/two; | out(2) = (xy.real() + xy.real())/two; | |||
out(3) = (xy.imag() - yx.imag())/two; | out(3) = (xy.imag() - yx.imag())/two; | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
linearToStokes(Vector<typename NumericTraits<T>::ConjugateType>& out, | linearToStokes(Vector<typename NumericTraits<T>::ConjugateType>& out, | |||
const Vector<typename NumericTraits<T>::ConjugateType>& in) { | const Vector<typename NumericTraits<T>::ConjugateType>& in) { | |||
DebugAssert(in.nelements() == 4, AipsError); | ||||
DebugAssert(out.nelements() == 4, AipsError); | ||||
const typename NumericTraits<T>::ConjugateType xx = in(0); | const typename NumericTraits<T>::ConjugateType xx = in(0); | |||
const typename NumericTraits<T>::ConjugateType xy = in(1); | const typename NumericTraits<T>::ConjugateType xy = in(1); | |||
const typename NumericTraits<T>::ConjugateType yx = in(2); | const typename NumericTraits<T>::ConjugateType yx = in(2); | |||
const typename NumericTraits<T>::ConjugateType yy = in(3); | const typename NumericTraits<T>::ConjugateType yy = in(3); | |||
const T two(2); | const T two(2); | |||
out(0) = (xx + yy)/two; | out(0) = (xx + yy)/two; | |||
out(1) = (xx - yy)/two; | out(1) = (xx - yy)/two; | |||
out(2) = (xy + yx)/two; | out(2) = (xy + yx)/two; | |||
out(3) = typename NumericTraits<T>::ConjugateType((xy.imag()-yx.imag())/t wo, | out(3) = typename NumericTraits<T>::ConjugateType((xy.imag()-yx.imag())/t wo, | |||
(yx.real()-xy.real())/two); | (yx.real()-xy.real())/two); | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
linearToCircular(Vector<typename NumericTraits<T>::ConjugateType>& out, | linearToCircular(Vector<typename NumericTraits<T>::ConjugateType>& out, | |||
const Vector<typename NumericTraits<T>::ConjugateType>& in) { | const Vector<typename NumericTraits<T>::ConjugateType>& in) { | |||
DebugAssert(in.nelements() == 4, AipsError); | ||||
DebugAssert(out.nelements() == 4, AipsError); | ||||
const typename NumericTraits<T>::ConjugateType xx = in(0); | const typename NumericTraits<T>::ConjugateType xx = in(0); | |||
const typename NumericTraits<T>::ConjugateType& xy = in(1); | const typename NumericTraits<T>::ConjugateType& xy = in(1); | |||
const typename NumericTraits<T>::ConjugateType jxy(-xy.imag(), xy.real()) ; | const typename NumericTraits<T>::ConjugateType jxy(-xy.imag(), xy.real()) ; | |||
const typename NumericTraits<T>::ConjugateType& yx = in(2); | const typename NumericTraits<T>::ConjugateType& yx = in(2); | |||
const typename NumericTraits<T>::ConjugateType jyx(-yx.imag(), yx.real()) ; | const typename NumericTraits<T>::ConjugateType jyx(-yx.imag(), yx.real()) ; | |||
const typename NumericTraits<T>::ConjugateType yy = in(3); | const typename NumericTraits<T>::ConjugateType yy = in(3); | |||
const T two(2); | const T two(2); | |||
out(0) = (xx - jxy + jyx + yy)/two; | out(0) = (xx - jxy + jyx + yy)/two; | |||
out(1) = (xx + jxy + jyx - yy)/two; | out(1) = (xx + jxy + jyx - yy)/two; | |||
out(2) = (xx - jxy - jyx - yy)/two; | out(2) = (xx - jxy - jyx - yy)/two; | |||
out(3) = (xx + jxy - jyx + yy)/two; | out(3) = (xx + jxy - jyx + yy)/two; | |||
} | } | |||
template<class T> void Flux<T>:: | template<class T> void Flux<T>:: | |||
circularToLinear(Vector<typename NumericTraits<T>::ConjugateType>& out, | circularToLinear(Vector<typename NumericTraits<T>::ConjugateType>& out, | |||
const Vector<typename NumericTraits<T>::ConjugateType>& in) { | const Vector<typename NumericTraits<T>::ConjugateType>& in) { | |||
DebugAssert(in.nelements() == 4, AipsError); | ||||
DebugAssert(out.nelements() == 4, AipsError); | ||||
const typename NumericTraits<T>::ConjugateType rr = in(0); | const typename NumericTraits<T>::ConjugateType rr = in(0); | |||
const typename NumericTraits<T>::ConjugateType rl = in(1); | const typename NumericTraits<T>::ConjugateType rl = in(1); | |||
const typename NumericTraits<T>::ConjugateType lr = in(2); | const typename NumericTraits<T>::ConjugateType lr = in(2); | |||
const typename NumericTraits<T>::ConjugateType ll = in(3); | const typename NumericTraits<T>::ConjugateType ll = in(3); | |||
const T two(2); | const T two(2); | |||
out(0) = (rr + rl + lr + ll)/two; | out(0) = (rr + rl + lr + ll)/two; | |||
out(1) = typename NumericTraits<T>::ConjugateType( | out(1) = typename NumericTraits<T>::ConjugateType( | |||
(-rr.imag() + rl.imag() - lr.imag() + ll.imag())/two, | (-rr.imag() + rl.imag() - lr.imag() + ll.imag())/two, | |||
( rr.real() - rl.real() + lr.real() - ll.real())/two); | ( rr.real() - rl.real() + lr.real() - ll.real())/two); | |||
out(2) = typename NumericTraits<T>::ConjugateType( | out(2) = typename NumericTraits<T>::ConjugateType( | |||
End of changes. 92 change blocks. | ||||
105 lines changed or deleted | 1 lines changed or added | |||
FluxCalcQS.h | FluxCalcQS.h | |||
---|---|---|---|---|
skipping to change at line 33 | skipping to change at line 33 | |||
//# National Radio Astronomy Observatory | //# National Radio Astronomy Observatory | |||
//# 520 Edgemont Road | //# 520 Edgemont Road | |||
//# Charlottesville, VA 22903-2475 USA | //# Charlottesville, VA 22903-2475 USA | |||
//# | //# | |||
//# | //# | |||
#ifndef COMPONENTS_FLUXCALCQS_H | #ifndef COMPONENTS_FLUXCALCQS_H | |||
#define COMPONENTS_FLUXCALCQS_H | #define COMPONENTS_FLUXCALCQS_H | |||
#include <components/ComponentModels/FluxStandard.h> | #include <components/ComponentModels/FluxStandard.h> | |||
#include <casa/BasicSL/String.h> | #include <casa/BasicSL/String.h> | |||
#include <measures/Measures/MDirection.h> | ||||
//# Handy for passing anonymous arrays to functions. | //# Handy for passing anonymous arrays to functions. | |||
#include <scimath/Mathematics/RigidVector.h> | #include <scimath/Mathematics/RigidVector.h> | |||
#include <map> | #include <map> | |||
namespace casa { //# NAMESPACE CASA - BEGIN | namespace casa { //# NAMESPACE CASA - BEGIN | |||
//class Flux; | //class Flux; | |||
class MFrequency; | class MFrequency; | |||
skipping to change at line 118 | skipping to change at line 119 | |||
// If a FS::Source enum matches srcName, returns the enum. | // If a FS::Source enum matches srcName, returns the enum. | |||
// Otherwise, FCQS::UNKNOWN_SOURCE. | // Otherwise, FCQS::UNKNOWN_SOURCE. | |||
FCQS::Source srcNameToEnum(const String& srcName) const; | FCQS::Source srcNameToEnum(const String& srcName) const; | |||
// Sets srcEnum_p = srcNameToEnum(sourceName), and returns | // Sets srcEnum_p = srcNameToEnum(sourceName), and returns | |||
// srcEnum_p != FCQS::UNKNOWN_SOURCE | // srcEnum_p != FCQS::UNKNOWN_SOURCE | |||
virtual Bool setSource(const String& sourceName); | virtual Bool setSource(const String& sourceName); | |||
FCQS::Source getSrcEnum(); | FCQS::Source getSrcEnum(); | |||
MDirection getDirection() {return directions_p[srcEnum_p];} | ||||
protected: | protected: | |||
FluxCalcQS(); // Initializes names_p. | FluxCalcQS(); // Initializes names_p. | |||
private: | private: | |||
FCQS::Source srcEnum_p; // The source identifier. | FCQS::Source srcEnum_p; // The source identifier. | |||
// A map from an FS::Source enum to a list of recognized names for it. | // A map from an FS::Source enum to a list of recognized names for it. | |||
std::map<FCQS::Source, Vector<String> > names_p; | std::map<FCQS::Source, Vector<String> > names_p; | |||
// A map from an FS::Source enum to its J2000 direction. | ||||
std::map<FCQS::Source, MDirection> directions_p; | ||||
}; | }; | |||
} //# NAMESPACE CASA - END | } //# NAMESPACE CASA - END | |||
#endif /* COMPONENTS_FLUXCALCQS_H */ | #endif /* COMPONENTS_FLUXCALCQS_H */ | |||
End of changes. 3 change blocks. | ||||
0 lines changed or deleted | 6 lines changed or added | |||
FluxCalc_SS_JPL_Butler.h | FluxCalc_SS_JPL_Butler.h | |||
---|---|---|---|---|
skipping to change at line 20 | skipping to change at line 20 | |||
//# | //# | |||
//# This library is distributed in the hope that it will be useful, but WIT HOUT | //# This library is distributed in the hope that it will be useful, but WIT HOUT | |||
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public | //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public | |||
//# License for more details. | //# License for more details. | |||
//# | //# | |||
//# You should have received a copy of the GNU Library General Public Licen se | //# You should have received a copy of the GNU Library General Public Licen se | |||
//# along with this library; if not, write to the Free Software Foundation, | //# along with this library; if not, write to the Free Software Foundation, | |||
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | |||
//# | //# | |||
//# Correspondence concerning AIPS++ should be adressed as follows: | //# Correspondence concerning AIPS++ should be addressed as follows: | |||
//# Internet email: aips2-request@nrao.edu. | //# Internet email: aips2-request@nrao.edu. | |||
//# Postal address: AIPS++ Project Office | //# Postal address: AIPS++ Project Office | |||
//# National Radio Astronomy Observatory | //# National Radio Astronomy Observatory | |||
//# 520 Edgemont Road | //# 520 Edgemont Road | |||
//# Charlottesville, VA 22903-2475 USA | //# Charlottesville, VA 22903-2475 USA | |||
//# | //# | |||
#ifndef COMPONENTS_FLUXCALC_SS_JPL_BUTLER_H | #ifndef COMPONENTS_FLUXCALC_SS_JPL_BUTLER_H | |||
#define COMPONENTS_FLUXCALC_SS_JPL_BUTLER_H | #define COMPONENTS_FLUXCALC_SS_JPL_BUTLER_H | |||
//# include directives | //# include directives | |||
#include <casa/aips.h> | #include <casa/aips.h> | |||
#include <casa/BasicSL/String.h> | #include <casa/BasicSL/String.h> | |||
#include <measures/Measures/MEpoch.h> | #include <measures/Measures/MEpoch.h> | |||
//#include <measures/Measures/MFrequency.h> | //#include <measures/Measures/MFrequency.h> | |||
#include <measures/Measures/MDirection.h> | ||||
#include <components/ComponentModels/Flux.h> | #include <components/ComponentModels/Flux.h> | |||
#include <tables/Tables/ScalarColumn.h> | #include <tables/Tables/ScalarColumn.h> | |||
namespace casa { //# NAMESPACE CASA - BEGIN | namespace casa { //# NAMESPACE CASA - BEGIN | |||
class MFrequency; | class MFrequency; | |||
//class ROScalarColumn<Double>; There doesn't seem to be a way to forward | //class ROScalarColumn<Double>; There doesn't seem to be a way to forward | |||
//declare a template. | //declare a template. | |||
// <summary> | // <summary> | |||
skipping to change at line 112 | skipping to change at line 113 | |||
void setTime(const MEpoch& time); | void setTime(const MEpoch& time); | |||
//void setFreq(const MFrequency& freq); | //void setFreq(const MFrequency& freq); | |||
// These return whether or not the item has been set, and if has, copy th eir | // These return whether or not the item has been set, and if has, copy th eir | |||
// item to the arg. | // item to the arg. | |||
Bool getName(String& output) const; | Bool getName(String& output) const; | |||
Bool getTime(MEpoch& output) const; | Bool getTime(MEpoch& output) const; | |||
//Bool getFreq(MFrequency& output) const; | //Bool getFreq(MFrequency& output) const; | |||
// Returns the default direction (N. Pole) on failure. | ||||
MDirection getDirection(); | ||||
// Sets angdiam to the source's angular diameter in radians and returns t he | // Sets angdiam to the source's angular diameter in radians and returns t he | |||
// object's component type (i.e. DISK), or UNKNOWN_SHAPE on failure. | // object's component type (i.e. DISK), or UNKNOWN_SHAPE on failure. | |||
ComponentType::Shape getShape(Double& angdiam); | ComponentType::Shape getShape(Double& angdiam); | |||
// Returns the distance from the object to the Sun in AU, or -1 if unknow | ||||
n. | ||||
Double getHeliocentricDist(); | ||||
// returns the number of objects supported by this class. | // returns the number of objects supported by this class. | |||
uInt n_known() const; | uInt n_known() const; | |||
// Compute the flux densities, their uncertainties, and the angular diame ter | // Compute the flux densities, their uncertainties, and the angular diame ter | |||
// of the calibration source for a set of frequencies. It will try to re ad | // of the calibration source for a set of frequencies. It will try to re ad | |||
// the right table in data/ephemerides/JPL-Horizons/. | // the right table in data/ephemerides/JPL-Horizons/. | |||
// | // | |||
// Return value: | // Return value: | |||
// the model's shape, or UNKNOWN_SHAPE on failure. | // the model's shape, or UNKNOWN_SHAPE on failure. | |||
// Inputs: | // Inputs: | |||
// must be already set, or it returns UNKNOWN_SHAPE. | // must be already set, or it returns UNKNOWN_SHAPE. | |||
// report: If False, suppress logger messages like e.g. references for | ||||
the | ||||
// temperature. Intended for use in a loop, i.e. print the | ||||
// messages for the 1st spw but do not repeat them for the oth | ||||
ers. | ||||
// Output args: | // Output args: | |||
// value: the calculated flux. | // value: the calculated flux. | |||
// error: the estimated uncertainty of value. | // error: the estimated uncertainty of value. | |||
// angdiam: angular diameter in radians | // angdiam: angular diameter in radians | |||
ComponentType::Shape compute(Vector<Flux<Double> >& values, | ComponentType::Shape compute(Vector<Flux<Double> >& values, | |||
Vector<Flux<Double> >& errors, Double& angdi am, | Vector<Flux<Double> >& errors, Double& angdi am, | |||
const Vector<MFrequency>& mfreqs); | const Vector<MFrequency>& mfreqs, | |||
const Bool report=True); | ||||
// Same as the above, but for a set of sets of frequencies, i.e. | // Same as the above, but for a set of sets of frequencies, i.e. | |||
// mfreqs[spw] is a set of frequencies for channels in spectral window sp w. | // mfreqs[spw] is a set of frequencies for channels in spectral window sp w. | |||
ComponentType::Shape compute(Vector<Vector<Flux<Double> > >& values, | ComponentType::Shape compute(Vector<Vector<Flux<Double> > >& values, | |||
Vector<Vector<Flux<Double> > >& errors, | Vector<Vector<Flux<Double> > >& errors, | |||
Double& angdiam, | Double& angdiam, | |||
const Vector<Vector<MFrequency> >& mfreqs); | const Vector<Vector<MFrequency> >& mfreqs); | |||
private: | private: | |||
enum KnownObjects { | enum KnownObjects { | |||
Mercury = 0, | Mercury = 0, | |||
skipping to change at line 209 | skipping to change at line 220 | |||
Vector<Flux<Double> >& errors, const Double angdiam, | Vector<Flux<Double> >& errors, const Double angdiam, | |||
const Vector<MFrequency>& mfreqs); | const Vector<MFrequency>& mfreqs); | |||
void compute_neptune(Vector<Flux<Double> >& values, | void compute_neptune(Vector<Flux<Double> >& values, | |||
Vector<Flux<Double> >& errors, const Double angdiam, | Vector<Flux<Double> >& errors, const Double angdiam, | |||
const Vector<MFrequency>& mfreqs); | const Vector<MFrequency>& mfreqs); | |||
void compute_pluto(Vector<Flux<Double> >& values, | void compute_pluto(Vector<Flux<Double> >& values, | |||
Vector<Flux<Double> >& errors, const Double angdiam, | Vector<Flux<Double> >& errors, const Double angdiam, | |||
const Vector<MFrequency>& mfreqs); | const Vector<MFrequency>& mfreqs); | |||
// Uses objnum_p to look up a mean temperature, and uses that. | // Uses objnum_p to look up a mean temperature, and uses that. | |||
// report: If False, suppress logger messages like references for the | ||||
// temperature. Intended for use in a loop, i.e. print the | ||||
// messages for the 1st spw but do not repeat them for the others. | ||||
// Returns whether or not it was successful. | // Returns whether or not it was successful. | |||
Bool compute_constant_temperature(Vector<Flux<Double> >& values, | Bool compute_constant_temperature(Vector<Flux<Double> >& values, | |||
Vector<Flux<Double> >& errors, const Dou | Vector<Flux<Double> >& errors, | |||
ble angdiam, | const Double angdiam, | |||
const Vector<MFrequency>& mfreqs); | const Vector<MFrequency>& mfreqs, | |||
const Bool report=True); | ||||
// Find the row in mjd closest to time_p, and the rows just before and af ter | // Find the row in mjd closest to time_p, and the rows just before and af ter | |||
// it, taking boundaries into account. | // it, taking boundaries into account. | |||
Bool get_row_numbers(uInt& rowbef, uInt& rowclosest, uInt& rowaft, | Bool get_row_numbers(uInt& rowbef, uInt& rowclosest, uInt& rowaft, | |||
const ROScalarColumn<Double>& mjd); | const ROScalarColumn<Double>& mjd); | |||
// Put a quadratic, linear, or nearest neighbor interpolation of colname | ||||
into | ||||
// val. Returns whether or not it did it. | ||||
// verbose: Send a message to the logger if nearest neighbor is used. | ||||
static Bool get_interpolated_value(Double& val, const String& colname, | ||||
const Table& tab, const uInt rowbef, | ||||
const uInt rowclosest, const uInt rowa | ||||
ft, | ||||
const Double f, const Double dt, | ||||
const Double tp1mt0, const Double t0mt | ||||
m1, | ||||
const Bool verbose=True); | ||||
// Data members which are initialized in the c'tor's initialization list: | // Data members which are initialized in the c'tor's initialization list: | |||
String name_p; | String name_p; | |||
Bool hasName_p; | Bool hasName_p; | |||
MEpoch time_p; | MEpoch time_p; | |||
Bool hasTime_p; | Bool hasTime_p; | |||
// MFrequency freq_p; | // MFrequency freq_p; | |||
// Bool hasFreq_p; | // Bool hasFreq_p; | |||
Bool hasEphemInfo_p; | Bool hasEphemInfo_p; | |||
Unit hertz_p; // make it static and/or const? | Unit hertz_p; // make it static and/or const? | |||
Bool has_ra_p; | ||||
Bool has_dec_p; | ||||
Bool has_illu_p; | ||||
// These are also initialized by the c'tor, but not in the initialization | // These are also initialized by the c'tor, but not in the initialization | |||
// list: | // list: | |||
FluxCalc_SS_JPL_Butler::KnownObjects objnum_p; | FluxCalc_SS_JPL_Butler::KnownObjects objnum_p; | |||
Bool hasObjNum_p; | Bool hasObjNum_p; | |||
// Data members that are not initialized by the c'tor: | // Data members that are not initialized by the c'tor: | |||
Double temperature_p; // in K | Double temperature_p; // in K | |||
Double mean_rad_p; // in AU (really!) | Double mean_rad_p; // in AU (really!) | |||
Double r_p; // heliocentric distance in AU | Double r_p; // heliocentric distance in AU | |||
Double delta_p; // geocentric distance in AU | Double delta_p; // geocentric distance in AU | |||
Double phang_p; // Phase angle in radians. | Double phang_p; // Phase angle in radians. | |||
Bool has_r_p; | ||||
Double illu_p; // Illumination, as a fraction. | ||||
Double ra_p; // RA, in deg. | ||||
Double dec_p; // Declination, in deg. | ||||
}; | }; | |||
} //# NAMESPACE CASA - END | } //# NAMESPACE CASA - END | |||
#endif | #endif | |||
End of changes. 11 change blocks. | ||||
5 lines changed or deleted | 43 lines changed or added | |||
FluxStandard.h | FluxStandard.h | |||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | |||
//# | //# | |||
//# Correspondence concerning AIPS++ should be adressed as follows: | //# Correspondence concerning AIPS++ should be adressed as follows: | |||
//# Internet email: aips2-request@nrao.edu. | //# Internet email: aips2-request@nrao.edu. | |||
//# Postal address: AIPS++ Project Office | //# Postal address: AIPS++ Project Office | |||
//# National Radio Astronomy Observatory | //# National Radio Astronomy Observatory | |||
//# 520 Edgemont Road | //# 520 Edgemont Road | |||
//# Charlottesville, VA 22903-2475 USA | //# Charlottesville, VA 22903-2475 USA | |||
//# | //# | |||
//# | //# | |||
//# $Id: FluxStandard.h 21130 2011-10-18 07:39:05Z gervandiepen $ | //# $Id: FluxStandard.h 21229 2012-04-02 12:00:20Z gervandiepen $ | |||
#ifndef COMPONENTS_FLUXSTANDARD_H | #ifndef COMPONENTS_FLUXSTANDARD_H | |||
#define COMPONENTS_FLUXSTANDARD_H | #define COMPONENTS_FLUXSTANDARD_H | |||
#include <casa/aips.h> | #include <casa/aips.h> | |||
#include <components/ComponentModels/Flux.h> | #include <components/ComponentModels/Flux.h> | |||
#include <measures/Measures/MDirection.h> | ||||
namespace casa { //# NAMESPACE CASA - BEGIN | namespace casa { //# NAMESPACE CASA - BEGIN | |||
// Forward declarations | // Forward declarations | |||
class String; //#include <casa/BasicSL/String.h> | class String; //#include <casa/BasicSL/String.h> | |||
class MDirection; //#include <measures/Measures/MDirection.h> | ||||
class MEpoch; //#include <measures/Measures/MEpoch.h> | class MEpoch; //#include <measures/Measures/MEpoch.h> | |||
class MFrequency; //#include <measures/Measures/MFrequency.h> | class MFrequency; //#include <measures/Measures/MFrequency.h> | |||
class SpectralModel; //#include <components/ComponentModels/SpectralModel.h > | class SpectralModel; //#include <components/ComponentModels/SpectralModel.h > | |||
// <summary> | // <summary> | |||
// FluxStandard: Compute flux densities for standard reference sources | // FluxStandard: Compute flux densities for standard reference sources | |||
// </summary> | // </summary> | |||
// <use visibility=export> | // <use visibility=export> | |||
skipping to change at line 122 | skipping to change at line 122 | |||
NUMBER_STANDARDS | NUMBER_STANDARDS | |||
}; | }; | |||
// Default constructor, and destructor | // Default constructor, and destructor | |||
FluxStandard(const FluxStandard::FluxScale scale = | FluxStandard(const FluxStandard::FluxScale scale = | |||
FluxStandard::PERLEY_TAYLOR_99); | FluxStandard::PERLEY_TAYLOR_99); | |||
~FluxStandard(); | ~FluxStandard(); | |||
// Compute the flux density for a specified source at a specified frequen cy | // Compute the flux density for a specified source at a specified frequen cy | |||
Bool compute (const String& sourceName, const MFrequency& mfreq, | Bool compute (const String& sourceName, const MFrequency& mfreq, | |||
Flux<Double>& value, Flux<Double>& error) const; | Flux<Double>& value, Flux<Double>& error); | |||
// Compute the flux densities and their uncertainties for a specified sou rce | // Compute the flux densities and their uncertainties for a specified sou rce | |||
// at a set of specified frequencies. | // at a set of specified frequencies. | |||
Bool compute(const String& sourceName, const Vector<MFrequency>& mfreqs, | Bool compute(const String& sourceName, const Vector<MFrequency>& mfreqs, | |||
Vector<Flux<Double> >& values, | Vector<Flux<Double> >& values, | |||
Vector<Flux<Double> >& errors, | Vector<Flux<Double> >& errors, | |||
const Bool verbose=True) const; | const Bool verbose=True); | |||
// Compute the flux densities and their uncertainties for a specified sou rce | // Compute the flux densities and their uncertainties for a specified sou rce | |||
// for a set of sets of specified frequencies, i.e. mfreqs[spw] is a set of | // for a set of sets of specified frequencies, i.e. mfreqs[spw] is a set of | |||
// frequencies for channels in spectral window spw, and values and errors are | // frequencies for channels in spectral window spw, and values and errors are | |||
// arranged the same way. | // arranged the same way. | |||
Bool compute(const String& sourceName, | Bool compute(const String& sourceName, | |||
const Vector<Vector<MFrequency> >& mfreqs, | const Vector<Vector<MFrequency> >& mfreqs, | |||
Vector<Vector<Flux<Double> > >& values, | Vector<Vector<Flux<Double> > >& values, | |||
Vector<Vector<Flux<Double> > >& errors) const; | Vector<Vector<Flux<Double> > >& errors); | |||
// Like compute, but it also saves a set of ComponentLists for the source to | // Like compute, but it also saves a set of ComponentLists for the source to | |||
// disk and puts the paths (sourceName_mfreq_mtime.cl) in clnames, making it | // disk and puts the paths (sourceName_mfreq_mtime.cl) in clnames, making it | |||
// suitable for resolved sources. | // suitable for resolved sources. | |||
// mtime is ignored for nonvariable objects. | // mtime is ignored for nonvariable objects. | |||
// Solar System objects are typically resolved and variable! | // Solar System objects are typically resolved and variable! | |||
// The ComponentList names are formed from prefix, sourceName, the | // The ComponentList names are formed from prefix, sourceName, the | |||
// frequencies, and times. | // frequencies, and times. | |||
Bool computeCL(const String& sourceName, const Vector<Vector<MFrequency> >& mfreqs, | Bool computeCL(const String& sourceName, const Vector<Vector<MFrequency> >& mfreqs, | |||
const MEpoch& mtime, const MDirection& position, | const MEpoch& mtime, const MDirection& position, | |||
Vector<Vector<Flux<Double> > >& values, | Vector<Vector<Flux<Double> > >& values, | |||
Vector<Vector<Flux<Double> > >& errors, | Vector<Vector<Flux<Double> > >& errors, | |||
Vector<String>& clnames, const String& prefix="") const; | Vector<String>& clnames, const String& prefix=""); | |||
// Take a component cmp and save it to a ComponentList on disk, returning the | // Take a component cmp and save it to a ComponentList on disk, returning the | |||
// pathname. ("" if unsuccessful, sourceName_mfreqGHzDateTime.cl otherwi se) | // pathname. ("" if unsuccessful, sourceName_mfreqGHzDateTime.cl otherwi se) | |||
// | // | |||
// This is also used outside of FluxStandard, but it is declared here ins tead | // This is also used outside of FluxStandard, but it is declared here ins tead | |||
// of in ComponentList because it is somewhat specialized, mainly in sett ing | // of in ComponentList because it is somewhat specialized, mainly in sett ing | |||
// up the pathname. The ComponentList name is formed from prefix, source Name, | // up the pathname. The ComponentList name is formed from prefix, source Name, | |||
// mfreq, and mtime. | // mfreq, and mtime. | |||
// | // | |||
static String makeComponentList(const String& sourceName, const MFrequenc y& mfreq, | static String makeComponentList(const String& sourceName, const MFrequenc y& mfreq, | |||
skipping to change at line 187 | skipping to change at line 187 | |||
static Bool matchStandard(const String& name, | static Bool matchStandard(const String& name, | |||
FluxStandard::FluxScale& stdEnum, | FluxStandard::FluxScale& stdEnum, | |||
String& stdName); | String& stdName); | |||
// Return a standard string description for each scale or catalog | // Return a standard string description for each scale or catalog | |||
static String standardName(const FluxStandard::FluxScale& stdEnum); | static String standardName(const FluxStandard::FluxScale& stdEnum); | |||
private: | private: | |||
// Flux scale in use | // Flux scale in use | |||
FluxStandard::FluxScale itsFluxScale; | FluxStandard::FluxScale itsFluxScale; | |||
Bool has_direction_p; | ||||
MDirection direction_p; | ||||
}; | }; | |||
} //# NAMESPACE CASA - END | } //# NAMESPACE CASA - END | |||
#endif | #endif | |||
End of changes. 8 change blocks. | ||||
6 lines changed or deleted | 10 lines changed or added | |||
HDF5Record.h | HDF5Record.h | |||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
//# along with this library; if not, write to the Free Software Foundation, | //# along with this library; if not, write to the Free Software Foundation, | |||
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | |||
//# | //# | |||
//# Correspondence concerning AIPS++ should be addressed as follows: | //# Correspondence concerning AIPS++ should be addressed as follows: | |||
//# Internet email: aips2-request@nrao.edu. | //# Internet email: aips2-request@nrao.edu. | |||
//# Postal address: AIPS++ Project Office | //# Postal address: AIPS++ Project Office | |||
//# National Radio Astronomy Observatory | //# National Radio Astronomy Observatory | |||
//# 520 Edgemont Road | //# 520 Edgemont Road | |||
//# Charlottesville, VA 22903-2475 USA | //# Charlottesville, VA 22903-2475 USA | |||
//# | //# | |||
//# $Id: HDF5Record.h 20615 2009-06-09 02:16:01Z Malte.Marquarding $ | //# $Id: HDF5Record.h 21233 2012-04-02 13:29:35Z gervandiepen $ | |||
#ifndef CASA_HDF5RECORD_H | #ifndef CASA_HDF5RECORD_H | |||
#define CASA_HDF5RECORD_H | #define CASA_HDF5RECORD_H | |||
//# Includes | //# Includes | |||
#include <casa/HDF5/HDF5Object.h> | #include <casa/HDF5/HDF5Object.h> | |||
#include <casa/HDF5/HDF5DataType.h> | #include <casa/HDF5/HDF5DataType.h> | |||
#include <casa/Containers/Record.h> | #include <casa/Containers/Record.h> | |||
namespace casa { //# NAMESPACE CASA - BEGIN | namespace casa { //# NAMESPACE CASA - BEGIN | |||
skipping to change at line 97 | skipping to change at line 97 | |||
// The group is deleted first if it already exists. | // The group is deleted first if it already exists. | |||
static void writeRecord (const HDF5Object& parentHid, | static void writeRecord (const HDF5Object& parentHid, | |||
const String& recordName, | const String& recordName, | |||
const RecordInterface& rec); | const RecordInterface& rec); | |||
// Remove the record (i.e. group) from the given parent. | // Remove the record (i.e. group) from the given parent. | |||
// Nothing is done if the record does not exist. | // Nothing is done if the record does not exist. | |||
static void remove (const HDF5Object& parentHid, | static void remove (const HDF5Object& parentHid, | |||
const String& recordName); | const String& recordName); | |||
// Read back a (nested) record. | // Read the (possibly nested) record values from the given group hid. | |||
static Record doReadRecord (hid_t parentHid); | static Record doReadRecord (hid_t parentHid); | |||
// Write the (possibly nested) record values into the given group hid. | ||||
static void doWriteRecord (const HDF5Object& groupHid, | ||||
const RecordInterface& rec); | ||||
private: | private: | |||
// Read a scalar value and add it to the record. | // Read a scalar value and add it to the record. | |||
static void readScalar (hid_t attrId, hid_t dtid, | static void readScalar (hid_t attrId, hid_t dtid, | |||
const String& name, RecordInterface& rec); | const String& name, RecordInterface& rec); | |||
// Read an array value and add it to the record. | // Read an array value and add it to the record. | |||
static void readArray (hid_t attrId, hid_t dtid, const IPosition&, | static void readArray (hid_t attrId, hid_t dtid, const IPosition&, | |||
const String& name, RecordInterface& rec); | const String& name, RecordInterface& rec); | |||
// Read a scalar string from an attribute and add it to the record. | // Read a scalar string from an attribute and add it to the record. | |||
skipping to change at line 148 | skipping to change at line 152 | |||
Array<T> value(shape); | Array<T> value(shape); | |||
HDF5DataType dtype((T*)0); | HDF5DataType dtype((T*)0); | |||
read (attrId, value.data(), dtype); | read (attrId, value.data(), dtype); | |||
rec.define (name, value); | rec.define (name, value); | |||
} | } | |||
// Read fixed length values from an attribute (scalar and array). | // Read fixed length values from an attribute (scalar and array). | |||
static void read (hid_t attrId, void* value, | static void read (hid_t attrId, void* value, | |||
const HDF5DataType& dtype); | const HDF5DataType& dtype); | |||
// Write a (nested) record. | ||||
static void doWriteRecord (const HDF5Object& groupHid, | ||||
const RecordInterface& rec); | ||||
// Write a fixed length scalar value as attribute. | // Write a fixed length scalar value as attribute. | |||
static void writeScalar (hid_t parentHid, const String& name, | static void writeScalar (hid_t parentHid, const String& name, | |||
const void* value, | const void* value, | |||
const HDF5DataType& dtype); | const HDF5DataType& dtype); | |||
// Write an array of fixed length values as attribute. | // Write an array of fixed length values as attribute. | |||
static void writeArray (hid_t parentHid, const String& name, | static void writeArray (hid_t parentHid, const String& name, | |||
const void* value, const IPosition& shape, | const void* value, const IPosition& shape, | |||
const HDF5DataType& dtype); | const HDF5DataType& dtype); | |||
End of changes. 4 change blocks. | ||||
6 lines changed or deleted | 6 lines changed or added | |||
ImageAttrGroup.h | ImageAttrGroup.h | |||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
//# along with this library; if not, write to the Free Software Foundation, | //# along with this library; if not, write to the Free Software Foundation, | |||
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | |||
//# | //# | |||
//# Correspondence concerning AIPS++ should be addressed as follows: | //# Correspondence concerning AIPS++ should be addressed as follows: | |||
//# Internet email: aips2-request@nrao.edu. | //# Internet email: aips2-request@nrao.edu. | |||
//# Postal address: AIPS++ Project Office | //# Postal address: AIPS++ Project Office | |||
//# National Radio Astronomy Observatory | //# National Radio Astronomy Observatory | |||
//# 520 Edgemont Road | //# 520 Edgemont Road | |||
//# Charlottesville, VA 22903-2475 USA | //# Charlottesville, VA 22903-2475 USA | |||
//# | //# | |||
//# $Id: ImageAttrGroup.h 21200 2012-03-20 09:55:47Z gervandiepen $ | //# $Id: ImageAttrGroup.h 21241 2012-04-12 13:37:37Z gervandiepen $ | |||
#ifndef IMAGES_IMAGEATTRGROUP_H | #ifndef IMAGES_IMAGEATTRGROUP_H | |||
#define IMAGES_IMAGEATTRGROUP_H | #define IMAGES_IMAGEATTRGROUP_H | |||
//# Includes | //# Includes | |||
#include <casa/Containers/ValueHolder.h> | #include <casa/Containers/ValueHolder.h> | |||
#include <casa/Arrays/Vector.h> | #include <casa/Arrays/Vector.h> | |||
namespace casa { | namespace casa { | |||
skipping to change at line 68 | skipping to change at line 68 | |||
// Furthermore, it must be possible to access the information in a way that | // Furthermore, it must be possible to access the information in a way that | |||
// arbitrary attributes can be stored and retrieved in a way that is agnost ic | // arbitrary attributes can be stored and retrieved in a way that is agnost ic | |||
// to the format the image is stored in. It must also work fine for an imag e | // to the format the image is stored in. It must also work fine for an imag e | |||
// stored in FITS format, be it that such an image cannot have such attribu tes. | // stored in FITS format, be it that such an image cannot have such attribu tes. | |||
// | // | |||
// The attributes are divided into groups. A group resides in a subtable | // The attributes are divided into groups. A group resides in a subtable | |||
// of a casacore image or in a group of an HDF5 image. This class handles | // of a casacore image or in a group of an HDF5 image. This class handles | |||
// the attributes of a group. It can get and put the attribute values, as w ell | // the attributes of a group. It can get and put the attribute values, as w ell | |||
// as their unit and measure info (type and reference frame type). | // as their unit and measure info (type and reference frame type). | |||
// For HDF5 images the unit is stored in attribute <src>attrname>_UNIT</src > | // For HDF5 images the unit is stored in attribute <src>attrname>_UNIT</src > | |||
// and the measure info in <rc>attrname>_MEASINFO</src>. For casacore image s | // and the measure info in <src>attrname>_MEASINFO</src>. For casacore imag es | |||
// that info is stored as TableMeasure info in the column keywords. | // that info is stored as TableMeasure info in the column keywords. | |||
// | // | |||
// All attributes in a group must have the same number of values, where eac h | // All attributes in a group must have the same number of values, where eac h | |||
// value can be a scalar or (small) array. The unit and measure info have | // value can be a scalar or (small) array. The unit and measure info have | |||
// only one value, thus all values of an attribute have the same unit. | // only one value, thus all values of an attribute have the same unit. | |||
// </synopsis> | // </synopsis> | |||
// <example> | // <example> | |||
// This example shows how to get attributes from an image. | // This example shows how to get attributes from an image. | |||
// <srcblock> | // <srcblock> | |||
skipping to change at line 123 | skipping to change at line 123 | |||
class ImageAttrGroup | class ImageAttrGroup | |||
{ | { | |||
public: | public: | |||
// Default constructor. | // Default constructor. | |||
ImageAttrGroup() | ImageAttrGroup() | |||
{} | {} | |||
virtual ~ImageAttrGroup(); | virtual ~ImageAttrGroup(); | |||
// Get the number of values of the group. | // Get the number of rows in the group. | |||
// This is the number of elements in an attribute. | virtual uInt nrows() const = 0; | |||
virtual uInt nvalues() const = 0; | ||||
// Test if an attribute exists. | // Test if an attribute exists. | |||
virtual Bool hasAttr (const String& attrName) const = 0; | virtual Bool hasAttr (const String& attrName) const = 0; | |||
// Get all attribute names. | // Get all attribute names. | |||
virtual Vector<String> attrNames() const = 0; | virtual Vector<String> attrNames() const = 0; | |||
// Get the datatype of a attribute. | // Get the datatype of a attribute. | |||
// It returns TpOther if the attribute is not defined. | // It returns TpOther if the attribute is not defined. | |||
virtual DataType dataType (const String& attrName) const = 0; | virtual DataType dataType (const String& attrName) const = 0; | |||
// Get the data of the given attribute. | // Get the data of the given attribute in the given row | |||
virtual ValueHolder getData (const String& attrName) = 0; | virtual ValueHolder getData (const String& attrName, uInt rownr) = 0; | |||
// Get the data of all attributes in a rows. | ||||
virtual Record getDataRow (uInt rownr) = 0; | ||||
// Get the possible units of the values. | // Get the possible units of the values. | |||
// An empty vector is returned if no units. | // An empty vector is returned if the attribute has no units. | |||
virtual Vector<String> getUnit (const String& attrName) = 0; | virtual Vector<String> getUnit (const String& attrName) = 0; | |||
// Get the possible measure info as type and Ref. | // Get the possible measure info as type and Ref. | |||
// An empty vector is returned if no MEASINFO exists. | // An empty vector is returned if the attribute has no MEASINFO. | |||
virtual Vector<String> getMeasInfo (const String& attrName) = 0; | virtual Vector<String> getMeasInfo (const String& attrName) = 0; | |||
// Put the data of the given attribute. | // Put the data of the given attribute in the given row. | |||
// If the table does not contain data yet, it will be sized to the size | // If the row or attribute is new, it will be added. Note that the | |||
// of the vector. Otherwise the vector size has to match the table size. | // new row must be directly after the last row in the group. | |||
// <br>If not empty, the units and MEASINFO will be put as column keyword s. | // <br>If not empty, the units and MEASINFO will be put as column keyword s. | |||
// The MEASINFO vector must be given as type,Ref. | // The MEASINFO vector must be given as type,Ref. | |||
virtual void putData (const String& attrName, const ValueHolder& data, | virtual void putData (const String& attrName, uInt rownr, | |||
const ValueHolder& data, | ||||
const Vector<String>& units = Vector<String>(), | const Vector<String>& units = Vector<String>(), | |||
const Vector<String>& measInfo = Vector<String>()) = 0; | const Vector<String>& measInfo = Vector<String>()) = 0; | |||
}; | }; | |||
} //# NAMESPACE CASA - END | } //# NAMESPACE CASA - END | |||
#endif | #endif | |||
End of changes. 8 change blocks. | ||||
13 lines changed or deleted | 16 lines changed or added | |||
ImageAttrGroupCasa.h | ImageAttrGroupCasa.h | |||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
//# along with this library; if not, write to the Free Software Foundation, | //# along with this library; if not, write to the Free Software Foundation, | |||
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | |||
//# | //# | |||
//# Correspondence concerning AIPS++ should be addressed as follows: | //# Correspondence concerning AIPS++ should be addressed as follows: | |||
//# Internet email: aips2-request@nrao.edu. | //# Internet email: aips2-request@nrao.edu. | |||
//# Postal address: AIPS++ Project Office | //# Postal address: AIPS++ Project Office | |||
//# National Radio Astronomy Observatory | //# National Radio Astronomy Observatory | |||
//# 520 Edgemont Road | //# 520 Edgemont Road | |||
//# Charlottesville, VA 22903-2475 USA | //# Charlottesville, VA 22903-2475 USA | |||
//# | //# | |||
//# $Id: ImageAttrGroupCasa.h 21200 2012-03-20 09:55:47Z gervandiepen $ | //# $Id: ImageAttrGroupCasa.h 21241 2012-04-12 13:37:37Z gervandiepen $ | |||
#ifndef IMAGES_IMAGEATTRGROUPCASA_H | #ifndef IMAGES_IMAGEATTRGROUPCASA_H | |||
#define IMAGES_IMAGEATTRGROUPCASA_H | #define IMAGES_IMAGEATTRGROUPCASA_H | |||
//# Includes | //# Includes | |||
#include <images/Images/ImageAttrGroup.h> | #include <images/Images/ImageAttrGroup.h> | |||
#include <tables/Tables/TableProxy.h> | #include <tables/Tables/TableProxy.h> | |||
namespace casa { | namespace casa { | |||
skipping to change at line 76 | skipping to change at line 76 | |||
virtual ~ImageAttrGroupCasa(); | virtual ~ImageAttrGroupCasa(); | |||
// Test if it is a null object. | // Test if it is a null object. | |||
Bool isNull() const | Bool isNull() const | |||
{ return itsTable.table().isNull(); } | { return itsTable.table().isNull(); } | |||
// Flush the attibrutes if needed. | // Flush the attibrutes if needed. | |||
void flush(); | void flush(); | |||
// Get the number of values of the group. | // Get the number of rows in the group. | |||
// This is the number of elements in an attribute. | virtual uInt nrows() const; | |||
virtual uInt nvalues() const; | ||||
// Test if an attribute exists. | // Test if an attribute exists. | |||
virtual Bool hasAttr (const String& attrName) const; | virtual Bool hasAttr (const String& attrName) const; | |||
// Get all attribute names. | // Get all attribute names. | |||
virtual Vector<String> attrNames() const; | virtual Vector<String> attrNames() const; | |||
// Get the datatype of a attribute. | // Get the datatype of a attribute. | |||
// It returns TpOther if the attribute is not defined. | // It returns TpOther if the attribute is not defined. | |||
virtual DataType dataType (const String& attrName) const; | virtual DataType dataType (const String& attrName) const; | |||
// Get the data of the given attribute. | // Get the data of the given attribute. | |||
virtual ValueHolder getData (const String& attrName); | virtual ValueHolder getData (const String& attrName, uInt rownr); | |||
// Get the data of all attributes in a rows. | ||||
virtual Record getDataRow (uInt rownr); | ||||
// Get the possible units of the values. | // Get the possible units of the values. | |||
// An empty vector is returned if no units. | // An empty vector is returned if the attribute has no units. | |||
virtual Vector<String> getUnit (const String& attrName); | virtual Vector<String> getUnit (const String& attrName); | |||
// Get the possible measure info as type and Ref. | // Get the possible measure info as type and Ref. | |||
// An empty vector is returned if no MEASINFO. | // An empty vector is returned if the attribute has no MEASINFO. | |||
virtual Vector<String> getMeasInfo (const String& attrName); | virtual Vector<String> getMeasInfo (const String& attrName); | |||
// Put the data of the given attribute. | // Put the data of the given attribute. | |||
// If the table does not contain data yet, it will be sized to the size | // If the table does not contain data yet, it will be sized to the size | |||
// of the vector. Otherwise the vector size has to match the table size. | // of the vector. Otherwise the vector size has to match the table size. | |||
// <br>If not empty, the units and MEASINFO will be put as column keyword s. | // <br>If not empty, the units and MEASINFO will be put as column keyword s. | |||
// The MEASINFO vector must be given as type,Ref. | // The MEASINFO vector must be given as type,Ref. | |||
virtual void putData (const String& attrName, const ValueHolder& data, | virtual void putData (const String& attrName, uInt rownr, | |||
const ValueHolder& data, | ||||
const Vector<String>& units = Vector<String>(), | const Vector<String>& units = Vector<String>(), | |||
const Vector<String>& measInfo = Vector<String>()); | const Vector<String>& measInfo = Vector<String>()); | |||
private: | private: | |||
// Check if the size matches the number of rows. | // Check if the size matches the number of rows. | |||
// Add rows if the table is still empty. | // Add rows if the table is still empty. | |||
void checkRows (const String& attrName, uInt size); | void checkRows (const String& attrName, uInt size); | |||
// Add a column for the given attribute for the data type in the value. | // Add a new column for the given attribute for the data type in the valu | |||
void addColumn (const String& attrName, const ValueHolder&); | e. | |||
Bool addNewColumn (const String& attrName, const ValueHolder&); | ||||
//# Data members. | //# Data members. | |||
TableProxy itsTable; | TableProxy itsTable; | |||
}; | }; | |||
} //# NAMESPACE CASA - END | } //# NAMESPACE CASA - END | |||
#endif | #endif | |||
End of changes. 7 change blocks. | ||||
10 lines changed or deleted | 14 lines changed or added | |||
ImageAttrGroupHDF5.h | ImageAttrGroupHDF5.h | |||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
//# along with this library; if not, write to the Free Software Foundation, | //# along with this library; if not, write to the Free Software Foundation, | |||
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | |||
//# | //# | |||
//# Correspondence concerning AIPS++ should be addressed as follows: | //# Correspondence concerning AIPS++ should be addressed as follows: | |||
//# Internet email: aips2-request@nrao.edu. | //# Internet email: aips2-request@nrao.edu. | |||
//# Postal address: AIPS++ Project Office | //# Postal address: AIPS++ Project Office | |||
//# National Radio Astronomy Observatory | //# National Radio Astronomy Observatory | |||
//# 520 Edgemont Road | //# 520 Edgemont Road | |||
//# Charlottesville, VA 22903-2475 USA | //# Charlottesville, VA 22903-2475 USA | |||
//# | //# | |||
//# $Id: ImageAttrGroupHDF5.h 21200 2012-03-20 09:55:47Z gervandiepen $ | //# $Id: ImageAttrGroupHDF5.h 21241 2012-04-12 13:37:37Z gervandiepen $ | |||
#ifndef IMAGES_IMAGEATTRGROUPHDF5_H | #ifndef IMAGES_IMAGEATTRGROUPHDF5_H | |||
#define IMAGES_IMAGEATTRGROUPHDF5_H | #define IMAGES_IMAGEATTRGROUPHDF5_H | |||
//# Includes | //# Includes | |||
#include <images/Images/ImageAttrGroup.h> | #include <images/Images/ImageAttrGroup.h> | |||
#include <tables/Tables/TableProxy.h> | #include <tables/Tables/TableProxy.h> | |||
#include <casa/HDF5/HDF5Group.h> | #include <casa/HDF5/HDF5Group.h> | |||
namespace casa { | namespace casa { | |||
skipping to change at line 63 | skipping to change at line 63 | |||
// stored in the HDF5 format. | // stored in the HDF5 format. | |||
// See the base class for more information. | // See the base class for more information. | |||
// </synopsis> | // </synopsis> | |||
class ImageAttrGroupHDF5 : public ImageAttrGroup | class ImageAttrGroupHDF5 : public ImageAttrGroup | |||
{ | { | |||
public: | public: | |||
// The default constructor creates a null object. | // The default constructor creates a null object. | |||
explicit ImageAttrGroupHDF5 (Bool isWritable=False) | explicit ImageAttrGroupHDF5 (Bool isWritable=False) | |||
: itsChanged (False), | : itsChanged (False), | |||
itsCanWrite (isWritable), | itsCanWrite (isWritable) | |||
itsNValues (0) | ||||
{} | {} | |||
// Construct the object for an attribute group in the image. | // Construct the object for an attribute group in the image. | |||
// If present, it reads all attributes. | // If present, it reads all attributes. | |||
ImageAttrGroupHDF5 (const HDF5Group& image, const String& attrGroupName, | ImageAttrGroupHDF5 (const HDF5Group& image, const String& attrGroupName, | |||
Bool writable); | Bool writable); | |||
virtual ~ImageAttrGroupHDF5(); | virtual ~ImageAttrGroupHDF5(); | |||
// Test if it is a null object. | // Test if it is a null object. | |||
Bool isNull() const | Bool isNull() const | |||
{ return itsRecord.empty(); } | { return itsRecord.empty(); } | |||
// Flush the attibrutes if needed. | // Flush the attibrutes if needed. | |||
void flush (HDF5Group& image, const String& attrGroupName); | void flush (HDF5Group& image, const String& attrGroupName); | |||
// Get the number of values of the group. | // Get the number of rows in the group. | |||
// This is the number of elements in an attribute. | virtual uInt nrows() const; | |||
virtual uInt nvalues() const; | ||||
// Test if an attribute exists. | // Test if an attribute exists. | |||
virtual Bool hasAttr (const String& attrName) const; | virtual Bool hasAttr (const String& attrName) const; | |||
// Get all attribute names. | // Get all attribute names. | |||
virtual Vector<String> attrNames() const; | virtual Vector<String> attrNames() const; | |||
// Get the datatype of a attribute. | // Get the datatype of a attribute. | |||
// It returns TpOther if the attribute is not defined. | // It returns TpOther if the attribute is not defined. | |||
virtual DataType dataType (const String& attrName) const; | virtual DataType dataType (const String& attrName) const; | |||
// Get the data of the given attribute. | // Get the data of the given attribute in the given row. | |||
virtual ValueHolder getData (const String& attrName); | virtual ValueHolder getData (const String& attrName, uInt rownr); | |||
// Get the possible units of the values (stored as <name>_UNIT). | // Get the data of all attributes in a rows. | |||
// An empty vector is returned if no units. | virtual Record getDataRow (uInt rownr); | |||
// Get the possible units of the values (stored as attrName_UNIT). | ||||
// An empty vector is returned if the attribute has no units. | ||||
virtual Vector<String> getUnit (const String& attrName); | virtual Vector<String> getUnit (const String& attrName); | |||
// Get the possible measure info as type and Ref (stored as <name>_MEASIN | // Get the possible measure info as type,Ref (stored as attrName_MEASINFO | |||
FO). | ). | |||
// An empty vector is returned if no MEASINFO. | // An empty vector is returned if the attribute has no MEASINFO. | |||
virtual Vector<String> getMeasInfo (const String& attrName); | virtual Vector<String> getMeasInfo (const String& attrName); | |||
// Put the data of the given attribute. | // Put the data of the given attribute. | |||
// If the table does not contain data yet, it will be sized to the size | // If the table does not contain data yet, it will be sized to the size | |||
// of the vector. Otherwise the vector size has to match the table size. | // of the vector. Otherwise the vector size has to match the table size. | |||
// <br>If not empty, the units and MEASINFO will be put as column keyword s. | // <br>If not empty, the units and MEASINFO will be put as column keyword s. | |||
// The MEASINFO vector must be given as type,Ref. | // The MEASINFO vector must be given as type,Ref. | |||
virtual void putData (const String& attrName, const ValueHolder& data, | virtual void putData (const String& attrName, uInt rownr, | |||
const ValueHolder& data, | ||||
const Vector<String>& units = Vector<String>(), | const Vector<String>& units = Vector<String>(), | |||
const Vector<String>& measInfo = Vector<String>()); | const Vector<String>& measInfo = Vector<String>()); | |||
private: | private: | |||
// Check if the value size is correct. | // Check the rownr and add a row if needed. | |||
void checkSize (const String& attrName); | void checkRows (const String& attrName, uInt rownr); | |||
//# Data members. | //# Data members. | |||
Record itsRecord; //# Record containing all attributes | Record itsRecord; //# Record containing all attributes (subrecord per row) | |||
Bool itsChanged; //# Has the Record changed? | Bool itsChanged; //# Has the Record changed? | |||
Bool itsCanWrite; //# Can attributes be written? | Bool itsCanWrite; //# Can attributes be written? | |||
uInt itsNValues; //# Number of values per attribute; 0 = unknown yet | ||||
}; | }; | |||
} //# NAMESPACE CASA - END | } //# NAMESPACE CASA - END | |||
#endif | #endif | |||
End of changes. 10 change blocks. | ||||
18 lines changed or deleted | 19 lines changed or added | |||
ImageProxy.h | ImageProxy.h | |||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | |||
//# | //# | |||
//# Correspondence concerning AIPS++ should be addressed as follows: | //# Correspondence concerning AIPS++ should be addressed as follows: | |||
//# Internet email: aips2-request@nrao.edu. | //# Internet email: aips2-request@nrao.edu. | |||
//# Postal address: AIPS++ Project Office | //# Postal address: AIPS++ Project Office | |||
//# National Radio Astronomy Observatory | //# National Radio Astronomy Observatory | |||
//# 520 Edgemont Road | //# 520 Edgemont Road | |||
//# Charlottesville, VA 22903-2475 USA | //# Charlottesville, VA 22903-2475 USA | |||
//# | //# | |||
//# | //# | |||
//# $Id: ImageProxy.h 21200 2012-03-20 09:55:47Z gervandiepen $ | //# $Id: ImageProxy.h 21239 2012-04-05 14:35:49Z gervandiepen $ | |||
#ifndef IMAGES_IMAGEPROXY_H | #ifndef IMAGES_IMAGEPROXY_H | |||
#define IMAGES_IMAGEPROXY_H | #define IMAGES_IMAGEPROXY_H | |||
//# Includes | //# Includes | |||
#include <images/Images/MaskSpecifier.h> | #include <images/Images/MaskSpecifier.h> | |||
#include <lattices/Lattices/LatticeBase.h> | #include <lattices/Lattices/LatticeBase.h> | |||
#include <lattices/Lattices/TiledShape.h> | #include <lattices/Lattices/TiledShape.h> | |||
#include <casa/Utilities/CountedPtr.h> | #include <casa/Utilities/CountedPtr.h> | |||
#include <casa/Containers/ValueHolder.h> | #include <casa/Containers/ValueHolder.h> | |||
skipping to change at line 187 | skipping to change at line 187 | |||
// Get the names of the attribute groups. | // Get the names of the attribute groups. | |||
Vector<String> attrGroupNames() const; | Vector<String> attrGroupNames() const; | |||
// Create a new attribute group. | // Create a new attribute group. | |||
void createAttrGroup (const String& groupName); | void createAttrGroup (const String& groupName); | |||
// Get the names of all attributes in a group. | // Get the names of all attributes in a group. | |||
Vector<String> attrNames (const String& groupName) const; | Vector<String> attrNames (const String& groupName) const; | |||
// Get the value of an attribute in a group. | // Get the number of rows in an attribute group. | |||
uInt attrNrows (const String& groupName) const; | ||||
// Get the value of an attribute in a group row. | ||||
ValueHolder getAttr (const String& groupName, | ValueHolder getAttr (const String& groupName, | |||
const String& attrName) const; | const String& attrName, | |||
uInt rownr) const; | ||||
// Get all attributes in a group row. | ||||
Record getAttrRow (const String& groupName, | ||||
uInt rownr) const; | ||||
// Get the unit(s) of an attribute in a group. | // Get the unit(s) of an attribute in a group. | |||
Vector<String> getAttrUnit(const String& groupName, | Vector<String> getAttrUnit(const String& groupName, | |||
const String& attrName) const; | const String& attrName) const; | |||
// Get the measinfo of an attribute in a group. | // Get the measinfo of an attribute in a group. | |||
Vector<String> getAttrMeas(const String& groupName, | Vector<String> getAttrMeas(const String& groupName, | |||
const String& attrName) const; | const String& attrName) const; | |||
// Put the value, unit, and measinfo of an attribute in a group. | // Put the value, unit, and measinfo of an attribute in a group row. | |||
void putAttr (const String& groupName, const String& attrName, | // The attribute or row is added if new. | |||
void putAttr (const String& groupName, const String& attrName, uInt row | ||||
nr, | ||||
const ValueHolder& value, | const ValueHolder& value, | |||
const Vector<String>& units, | const Vector<String>& units, | |||
const Vector<String>& measInfo); | const Vector<String>& measInfo); | |||
// Form a new (virtual) image being a subset of the image. | // Form a new (virtual) image being a subset of the image. | |||
ImageProxy subImage (const IPosition& blc, | ImageProxy subImage (const IPosition& blc, | |||
const IPosition& trc, | const IPosition& trc, | |||
const IPosition& inc, | const IPosition& inc, | |||
Bool dropDegenerate=True); | Bool dropDegenerate=True); | |||
skipping to change at line 349 | skipping to change at line 358 | |||
// Form a concatenated image. | // Form a concatenated image. | |||
// <group> | // <group> | |||
void concatImages (const std::vector<ImageProxy>& images, Int a xis); | void concatImages (const std::vector<ImageProxy>& images, Int a xis); | |||
void concatImagesFloat (const std::vector<ImageProxy>& images, Int a xis); | void concatImagesFloat (const std::vector<ImageProxy>& images, Int a xis); | |||
void concatImagesDouble (const std::vector<ImageProxy>& images, Int a xis); | void concatImagesDouble (const std::vector<ImageProxy>& images, Int a xis); | |||
void concatImagesComplex (const std::vector<ImageProxy>& images, Int a xis); | void concatImagesComplex (const std::vector<ImageProxy>& images, Int a xis); | |||
void concatImagesDComplex (const std::vector<ImageProxy>& images, Int a xis); | void concatImagesDComplex (const std::vector<ImageProxy>& images, Int a xis); | |||
// </group> | // </group> | |||
// Setup the pointers for the various image data types. | // Setup the pointers for the various image data types. | |||
void setup(); | ||||
// Setup the pointers for the various image data types. | ||||
// It takes over the lattice pointer. | ||||
void setup (LatticeBase* lattice); | void setup (LatticeBase* lattice); | |||
// Centre all axes except the Stokes one. | // Centre all axes except the Stokes one. | |||
void centreRefPix (CoordinateSystem& cSys, | void centreRefPix (CoordinateSystem& cSys, | |||
const IPosition& shape) const; | const IPosition& shape) const; | |||
// Put the mask and create it if needed. | // Put the mask and create it if needed. | |||
template<typename T> | template<typename T> | |||
void doPutMask (ImageInterface<T>& image, | void doPutMask (ImageInterface<T>& image, | |||
const ValueHolder& value, | const ValueHolder& value, | |||
End of changes. 5 change blocks. | ||||
5 lines changed or deleted | 19 lines changed or added | |||
ImageUtilities2.tcc | ImageUtilities2.tcc | |||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
//# along with this library; if not, write to the Free Software Foundation, | //# along with this library; if not, write to the Free Software Foundation, | |||
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | |||
//# | //# | |||
//# Correspondence concerning AIPS++ should be addressed as follows: | //# Correspondence concerning AIPS++ should be addressed as follows: | |||
//# Internet email: aips2-request@nrao.edu. | //# Internet email: aips2-request@nrao.edu. | |||
//# Postal address: AIPS++ Project Office | //# Postal address: AIPS++ Project Office | |||
//# National Radio Astronomy Observatory | //# National Radio Astronomy Observatory | |||
//# 520 Edgemont Road | //# 520 Edgemont Road | |||
//# Charlottesville, VA 22903-2475 USA | //# Charlottesville, VA 22903-2475 USA | |||
//# | //# | |||
//# $Id: ImageUtilities2.tcc 21205 2012-03-21 12:55:04Z gervandiepen $ | //# $Id: ImageUtilities2.tcc 21231 2012-04-02 12:08:24Z gervandiepen $ | |||
// | // | |||
#include <images/Images/ImageUtilities.h> | #include <images/Images/ImageUtilities.h> | |||
#include <casa/Arrays/MaskedArray.h> | #include <casa/Arrays/MaskedArray.h> | |||
#include <coordinates/Coordinates/CoordinateSystem.h> | #include <coordinates/Coordinates/CoordinateSystem.h> | |||
#include <coordinates/Coordinates/LinearCoordinate.h> | #include <coordinates/Coordinates/LinearCoordinate.h> | |||
#include <coordinates/Coordinates/SpectralCoordinate.h> | #include <coordinates/Coordinates/SpectralCoordinate.h> | |||
#include <coordinates/Coordinates/TabularCoordinate.h> | #include <coordinates/Coordinates/TabularCoordinate.h> | |||
#include <casa/Exceptions/Error.h> | #include <casa/Exceptions/Error.h> | |||
#include <images/Images/ImageInfo.h> | #include <images/Images/ImageInfo.h> | |||
#include <images/Images/ImageInterface.h> | #include <images/Images/ImageInterface.h> | |||
#include <images/Images/TempImage.h> | #include <images/Images/TempImage.h> | |||
#include <images/Images/RebinImage.h> | #include <images/Images/RebinImage.h> | |||
#include <images/Images/ImageFit1D.h> | #include <images/Images/ImageFit1D.h> | |||
#include <lattices/Lattices/TiledShape.h> | #include <lattices/Lattices/TiledShape.h> | |||
#include <lattices/Lattices/TempLattice.h> | #include <lattices/Lattices/TempLattice.h> | |||
#include <lattices/Lattices/TiledLineStepper.h> | #include <lattices/Lattices/TiledLineStepper.h> | |||
#include <lattices/Lattices/MaskedLatticeIterator.h> | #include <lattices/Lattices/MaskedLatticeIterator.h> | |||
#include <components/SpectralComponents/SpectralElement.h> | #include <components/SpectralComponents/PolynomialSpectralElement.h> | |||
#include <casa/System/ProgressMeter.h> | #include <casa/System/ProgressMeter.h> | |||
#include <casa/Logging/LogIO.h> | #include <casa/Logging/LogIO.h> | |||
#include <casa/Quanta/Unit.h> | #include <casa/Quanta/Unit.h> | |||
#include <casa/Utilities/Assert.h> | #include <casa/Utilities/Assert.h> | |||
namespace casa { //# NAMESPACE CASA - BEGIN | namespace casa { //# NAMESPACE CASA - BEGIN | |||
template <typename T, typename U> | template <typename T, typename U> | |||
void ImageUtilities::copyMiscellaneous (ImageInterface<T>& out, | void ImageUtilities::copyMiscellaneous (ImageInterface<T>& out, | |||
const ImageInterface<U>& in) | const ImageInterface<U>& in) | |||
skipping to change at line 238 | skipping to change at line 238 | |||
ImageFit1D<Float>::AbcissaType abcissaType; | ImageFit1D<Float>::AbcissaType abcissaType; | |||
if ( | if ( | |||
! ImageFit1D<Float>::setAbcissaState( | ! ImageFit1D<Float>::setAbcissaState( | |||
errMsg, abcissaType, csys, xUnit, doppler, axis | errMsg, abcissaType, csys, xUnit, doppler, axis | |||
) | ) | |||
) { | ) { | |||
throw AipsError(errMsg); | throw AipsError(errMsg); | |||
} | } | |||
SpectralElement polyEl(poly); | PolynomialSpectralElement polyEl(poly); | |||
IPosition inTileShape = inImage.niceCursorShape(); | IPosition inTileShape = inImage.niceCursorShape(); | |||
TiledLineStepper stepper (inImage.shape(), inTileShape, axis); | TiledLineStepper stepper (inImage.shape(), inTileShape, axis); | |||
RO_MaskedLatticeIterator<Float> inIter(inImage, stepper); | RO_MaskedLatticeIterator<Float> inIter(inImage, stepper); | |||
Bool ok(False); | Bool ok(False); | |||
uInt nFail = 0; | uInt nFail = 0; | |||
uInt nConv = 0; | uInt nConv = 0; | |||
uInt nProfiles = 0; | uInt nProfiles = 0; | |||
Vector<ImageFit1D<T> > fitters(inShape.product()/inShape[axis]); | Vector<ImageFit1D<T> > fitters(inShape.product()/inShape[axis]); | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
Lorentzian1D.h | Lorentzian1D.h | |||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
//# along with this library; if not, write to the Free Software Foundation, | //# along with this library; if not, write to the Free Software Foundation, | |||
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | |||
//# | //# | |||
//# Correspondence concerning AIPS++ should be addressed as follows: | //# Correspondence concerning AIPS++ should be addressed as follows: | |||
//# Internet email: aips2-request@nrao.edu. | //# Internet email: aips2-request@nrao.edu. | |||
//# Postal address: AIPS++ Project Office | //# Postal address: AIPS++ Project Office | |||
//# National Radio Astronomy Observatory | //# National Radio Astronomy Observatory | |||
//# 520 Edgemont Road | //# 520 Edgemont Road | |||
//# Charlottesville, VA 22903-2475 USA | //# Charlottesville, VA 22903-2475 USA | |||
//# | //# | |||
//# $Id: Lorentzian1D.h 21209 2012-03-23 06:58:05Z gervandiepen $ | //# $Id: Lorentzian1D.h 21241 2012-04-12 13:37:37Z gervandiepen $ | |||
#ifndef SCIMATH_LORENTZIAN1D_H | #ifndef SCIMATH_LORENTZIAN1D_H | |||
#define SCIMATH_LORENTZIAN1D_H | #define SCIMATH_LORENTZIAN1D_H | |||
//# Includes | //# Includes | |||
#include <casa/aips.h> | #include <casa/aips.h> | |||
#include <scimath/Functionals/Lorentzian1DParam.h> | #include <scimath/Functionals/Lorentzian1DParam.h> | |||
#include <scimath/Functionals/Function1D.h> | #include <scimath/Functionals/Function1D.h> | |||
#include <scimath/Mathematics/AutoDiff.h> | #include <scimath/Mathematics/AutoDiff.h> | |||
#include <scimath/Mathematics/AutoDiffMath.h> | #include <scimath/Mathematics/AutoDiffMath.h> | |||
skipping to change at line 57 | skipping to change at line 57 | |||
// demos=""> | // demos=""> | |||
// </reviewed> | // </reviewed> | |||
// <prerequisite> | // <prerequisite> | |||
// <li> <linkto class="Lorentzian1DParam">Lorentzian1DParam</linkto> | // <li> <linkto class="Lorentzian1DParam">Lorentzian1DParam</linkto> | |||
// <li> <linkto class="Function">Function</linkto> | // <li> <linkto class="Function">Function</linkto> | |||
// </prerequisite> | // </prerequisite> | |||
// <etymology> | // <etymology> | |||
// A Lorentzian1D functional is designed exclusively for calculating a | // A Lorentzian1D functional is designed exclusively for calculating a | |||
// Lorentzian (or Normal) distribution in one dimension. Other classes exis | // Lorentzian (or Normal) distribution in one dimension. Future classes can | |||
t | // be used for calculating these functions in two and N dimensions | |||
// for calculating these functions in two | // (Lorentzian2D and LorentzianND). | |||
// (<linkto class=Lorentzian2D>Lorentzian2D</linkto>) and N | ||||
// (<linkto class=LorentzianND>LorentzianND</linkto>) dimensions. | ||||
// </etymology> | // </etymology> | |||
// <synopsis> | // <synopsis> | |||
// A <src>Lorentzian1D</src> is described by a height, center, and width. I ts | // A <src>Lorentzian1D</src> is described by a height, center, and width. I ts | |||
// fundamental operation is evaluating itself at some <src>x</src>. | // fundamental operation is evaluating itself at some <src>x</src>. | |||
// The parameters (height, center and width) may be changed at run time. | // The parameters (height, center and width) may be changed at run time. | |||
// | // | |||
// The width of the Lorentzian (for the constructors or the <src>setWidth | // The width of the Lorentzian (for the constructors or the <src>setWidth | |||
// </src> function) is always specified in terms of the full width at half | // </src> function) is always specified in terms of the full width at half | |||
// maximum (FWHM). It is always positive and attempts to set a non-positive | // maximum (FWHM). It is always positive and attempts to set a non-positive | |||
End of changes. 2 change blocks. | ||||
6 lines changed or deleted | 4 lines changed or added | |||
ProfileFit1D.tcc | ProfileFit1D.tcc | |||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
//# along with this library; if not, write to the Free Software Foundation, | //# along with this library; if not, write to the Free Software Foundation, | |||
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | |||
//# | //# | |||
//# Correspondence concerning AIPS++ should be addressed as follows: | //# Correspondence concerning AIPS++ should be addressed as follows: | |||
//# Internet email: aips2-request@nrao.edu. | //# Internet email: aips2-request@nrao.edu. | |||
//# Postal address: AIPS++ Project Office | //# Postal address: AIPS++ Project Office | |||
//# National Radio Astronomy Observatory | //# National Radio Astronomy Observatory | |||
//# 520 Edgemont Road | //# 520 Edgemont Road | |||
//# Charlottesville, VA 22903-2475 USA | //# Charlottesville, VA 22903-2475 USA | |||
//# | //# | |||
//# $Id: ProfileFit1D.tcc 20652 2009-07-06 05:04:32Z Malte.Marquarding $ | //# $Id: ProfileFit1D.tcc 21229 2012-04-02 12:00:20Z gervandiepen $ | |||
#include <components/SpectralComponents/ProfileFit1D.h> | #include <components/SpectralComponents/ProfileFit1D.h> | |||
#include <casa/Arrays/ArrayLogical.h> | #include <casa/Arrays/ArrayLogical.h> | |||
#include <casa/Exceptions/Error.h> | #include <casa/Exceptions/Error.h> | |||
#include <components/SpectralComponents/SpectralEstimate.h> | #include <components/SpectralComponents/SpectralEstimate.h> | |||
#include <components/SpectralComponents/SpectralElement.h> | #include <components/SpectralComponents/SpectralElement.h> | |||
#include <casa/Utilities/DataType.h> | #include <casa/Utilities/DataType.h> | |||
#include <casa/Utilities/Assert.h> | #include <casa/Utilities/Assert.h> | |||
skipping to change at line 283 | skipping to change at line 283 | |||
if (itsX.nelements()==0) { | if (itsX.nelements()==0) { | |||
itsError = "You must call function setData to set some data first"; | itsError = "You must call function setData to set some data first"; | |||
return False; | return False; | |||
} | } | |||
if (itsList.nelements()==0) { | if (itsList.nelements()==0) { | |||
itsError = "You must call function setElements to set some fit compon ents first"; | itsError = "You must call function setElements to set some fit compon ents first"; | |||
return False; | return False; | |||
} | } | |||
// Set list in fitter | // Set list in fitter | |||
itsFitter.clear(); | itsFitter.clear(); | |||
itsFitter.addFitElement (itsList); | itsFitter.addFitElement (itsList); | |||
// Do the fit with the total mask | // Do the fit with the total mask | |||
Bool converged(False); | Bool converged(False); | |||
if (itsWeight.nelements()==0) { | if (itsWeight.nelements()==0) { | |||
converged = itsFitter.fit (itsY, itsX, makeTotalMask()); | converged = itsFitter.fit (itsY, itsX, makeTotalMask()); | |||
} else { | } else { | |||
converged = itsFitter.fit (itsWeight, itsY, itsX, makeTotalMask()); | converged = itsFitter.fit (itsWeight, itsY, itsX, makeTotalMask()); | |||
} | } | |||
// | ||||
return converged; | return converged; | |||
} | } | |||
template <class T> | template <class T> | |||
const SpectralList& ProfileFit1D<T>::getList (Bool fit) const | const SpectralList& ProfileFit1D<T>::getList (Bool fit) const | |||
{ | { | |||
if (fit) { | if (fit) { | |||
return itsFitter.list(); | return itsFitter.list(); | |||
} else { | } else { | |||
return itsList; | return itsList; | |||
skipping to change at line 389 | skipping to change at line 386 | |||
} | } | |||
// | // | |||
return tmp; | return tmp; | |||
} | } | |||
// Private functions | // Private functions | |||
template <class T> | template <class T> | |||
SpectralList ProfileFit1D<T>::getSubsetList (const SpectralList& list, Int which) const | SpectralList ProfileFit1D<T>::getSubsetList (const SpectralList& list, Int which) const | |||
{ | { | |||
const Int n = list.nelements(); | const Int n = list.nelements(); | |||
// | if (which+1 > n) { | |||
if (which+1 > n) { | throw AipsError("Illegal spectral element index"); | |||
throw (AipsError("Illegal spectral element index")); | } | |||
} | SpectralList listOut; | |||
// | listOut.add(*list[which]); | |||
const SpectralElement el(list[which]); | return listOut; | |||
SpectralList listOut; | ||||
listOut.add(el); | ||||
return listOut; | ||||
} | } | |||
template <class T> | template <class T> | |||
Vector<Bool> ProfileFit1D<T>::makeTotalMask () const | Vector<Bool> ProfileFit1D<T>::makeTotalMask () const | |||
{ | { | |||
Vector<Bool> mask; | Vector<Bool> mask; | |||
if (itsRangeMask.nelements()==0) { | if (itsRangeMask.nelements()==0) { | |||
mask = itsDataMask; | mask = itsDataMask; | |||
} else { | } else { | |||
mask = itsDataMask && itsRangeMask; | mask = itsDataMask && itsRangeMask; | |||
End of changes. 5 change blocks. | ||||
14 lines changed or deleted | 8 lines changed or added | |||
SkyComponent.h | SkyComponent.h | |||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | |||
//# | //# | |||
//# Correspondence concerning AIPS++ should be addressed as follows: | //# Correspondence concerning AIPS++ should be addressed as follows: | |||
//# Internet email: aips2-request@nrao.edu. | //# Internet email: aips2-request@nrao.edu. | |||
//# Postal address: AIPS++ Project Office | //# Postal address: AIPS++ Project Office | |||
//# National Radio Astronomy Observatory | //# National Radio Astronomy Observatory | |||
//# 520 Edgemont Road | //# 520 Edgemont Road | |||
//# Charlottesville, VA 22903-2475 USA | //# Charlottesville, VA 22903-2475 USA | |||
//# | //# | |||
//# | //# | |||
//# $Id: SkyComponent.h 21130 2011-10-18 07:39:05Z gervandiepen $ | //# $Id: SkyComponent.h 21229 2012-04-02 12:00:20Z gervandiepen $ | |||
#ifndef COMPONENTS_SKYCOMPONENT_H | #ifndef COMPONENTS_SKYCOMPONENT_H | |||
#define COMPONENTS_SKYCOMPONENT_H | #define COMPONENTS_SKYCOMPONENT_H | |||
#include <casa/aips.h> | #include <casa/aips.h> | |||
#include <casa/Utilities/CountedPtr.h> | #include <casa/Utilities/CountedPtr.h> | |||
#include <coordinates/Coordinates/CoordinateSystem.h> | #include <coordinates/Coordinates/CoordinateSystem.h> | |||
#include <components/ComponentModels/ComponentType.h> | #include <components/ComponentModels/ComponentType.h> | |||
#include <components/ComponentModels/SkyCompBase.h> | #include <components/ComponentModels/SkyCompBase.h> | |||
#include <measures/Measures/Stokes.h> | #include <measures/Measures/Stokes.h> | |||
skipping to change at line 268 | skipping to change at line 268 | |||
void fromPixel (Double& fluxRatio, const Vector<Double>& parameters, | void fromPixel (Double& fluxRatio, const Vector<Double>& parameters, | |||
const Unit& brightnessUnitIn, | const Unit& brightnessUnitIn, | |||
const Vector<Quantum<Double> >& restoringBeam, | const Vector<Quantum<Double> >& restoringBeam, | |||
const CoordinateSystem& cSys, | const CoordinateSystem& cSys, | |||
ComponentType::Shape componentShape, | ComponentType::Shape componentShape, | |||
Stokes::StokesTypes stokes); | Stokes::StokesTypes stokes); | |||
// </group> | // </group> | |||
// Get a nicely formatted string summarizing the component. | // Get a nicely formatted string summarizing the component. | |||
virtual String summarize(const CoordinateSystem * const coordinates = 0) const; | virtual String summarize(const CoordinateSystem *const &coordinates = 0) const; | |||
// If the <src>coordinates</src> parameter is specified, also return the corresponding world | // If the <src>coordinates</src> parameter is specified, also return the corresponding world | |||
// coordinates. | // coordinates. | |||
String positionToString(const CoordinateSystem * const coordinates = 0) c onst; | String positionToString(const CoordinateSystem *const &coordinates = 0) c onst; | |||
private: | private: | |||
CountedPtr<SkyCompRep> itsCompPtr; | CountedPtr<SkyCompRep> itsCompPtr; | |||
}; | }; | |||
} //# NAMESPACE CASA - END | } //# NAMESPACE CASA - END | |||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
Spectral2Estimate.tcc | Spectral2Estimate.tcc | |||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
//# along with this library; if not, write to the Free Software Foundation, | //# along with this library; if not, write to the Free Software Foundation, | |||
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | |||
//# | //# | |||
//# Correspondence concerning AIPS++ should be addressed as follows: | //# Correspondence concerning AIPS++ should be addressed as follows: | |||
//# Internet email: aips2-request@nrao.edu. | //# Internet email: aips2-request@nrao.edu. | |||
//# Postal address: AIPS++ Project Office | //# Postal address: AIPS++ Project Office | |||
//# National Radio Astronomy Observatory | //# National Radio Astronomy Observatory | |||
//# 520 Edgemont Road | //# 520 Edgemont Road | |||
//# Charlottesville, VA 22903-2475 USA | //# Charlottesville, VA 22903-2475 USA | |||
//# | //# | |||
//# $Id: Spectral2Estimate.tcc 19935 2007-02-27 05:07:40Z Malte.Marquarding $ | //# $Id: Spectral2Estimate.tcc 21229 2012-04-02 12:00:20Z gervandiepen $ | |||
//# Includes | //# Includes | |||
#include <components/SpectralComponents/SpectralEstimate.h> | #include <components/SpectralComponents/SpectralEstimate.h> | |||
#include <casa/BasicMath/Math.h> | #include <casa/BasicMath/Math.h> | |||
#include <casa/BasicSL/Constants.h> | #include <casa/BasicSL/Constants.h> | |||
#include <casa/Utilities/Assert.h> | #include <casa/Utilities/Assert.h> | |||
#include <components/SpectralComponents/CompiledSpectralElement.h> | ||||
#include <components/SpectralComponents/GaussianSpectralElement.h> | ||||
#include <components/SpectralComponents/PolynomialSpectralElement.h> | ||||
#include <memory> | ||||
namespace casa { //#Begin namespace casa | namespace casa { //#Begin namespace casa | |||
//# Member templates | //# Member templates | |||
template <class MT> | template <class MT> | |||
const SpectralList &SpectralEstimate::estimate(const Vector<MT> &prof, | const SpectralList &SpectralEstimate::estimate(const Vector<MT> &prof, | |||
Vector<MT> *der) { | Vector<MT> *der) { | |||
if (prof.nelements() != lprof_p) { | if (prof.nelements() != lprof_p) { | |||
delete [] deriv_p; deriv_p = 0; lprof_p = 0; | delete [] deriv_p; deriv_p = 0; lprof_p = 0; | |||
lprof_p = prof.nelements(); | lprof_p = prof.nelements(); | |||
skipping to change at line 76 | skipping to change at line 81 | |||
if (x.nelements() != y.nelements()) { | if (x.nelements() != y.nelements()) { | |||
throw(AipsError("Abcissa and ordinate vectors must be the same length" )); | throw(AipsError("Abcissa and ordinate vectors must be the same length" )); | |||
} | } | |||
if (x.nelements()==1) { | if (x.nelements()==1) { | |||
throw(AipsError("Not enough elements in vectors")); | throw(AipsError("Not enough elements in vectors")); | |||
} | } | |||
// Get pixel-based estimate (into slist_p) | // Get pixel-based estimate (into slist_p) | |||
estimate(y); | estimate(y); | |||
// Convert | // Convert | |||
for (uInt i=0; i<slist_p.nelements(); i++) { | for (uInt i=0; i<slist_p.nelements(); i++) { | |||
const SpectralElement& elIn = slist_p[i]; | if (slist_p[i]->getType() != SpectralElement::GAUSSIAN) { | |||
SpectralElement elOut = convertElement (x, elIn); | throw AipsError("Non-gaussian spectral types cannot be est | |||
slist_p.set(elOut, i); | imated"); | |||
} | ||||
const GaussianSpectralElement elIn = *dynamic_cast<const GaussianS | ||||
pectralElement *>(slist_p[i]); | ||||
GaussianSpectralElement elOut = convertElement (x, elIn); | ||||
slist_p.set(elOut, i); | ||||
} | } | |||
return slist_p; | return slist_p; | |||
} | } | |||
template <class MT> | template <class MT> | |||
uInt SpectralEstimate::window(const Vector<MT> &prof) { | uInt SpectralEstimate::window(const Vector<MT> &prof) { | |||
windowLow_p =0; | windowLow_p =0; | |||
windowEnd_p = 0; | windowEnd_p = 0; | |||
if (!useWindow_p || rms_p <= 0.0 || lprof_p == 0) { | if (!useWindow_p || rms_p <= 0.0 || lprof_p == 0) { | |||
if (regionEnd_p) { | if (regionEnd_p) { | |||
skipping to change at line 162 | skipping to change at line 170 | |||
} | } | |||
template <class MT> | template <class MT> | |||
void SpectralEstimate::findga(const Vector<MT> &prof) { | void SpectralEstimate::findga(const Vector<MT> &prof) { | |||
Int i(windowLow_p-1); | Int i(windowLow_p-1); | |||
// Window on Gaussian | // Window on Gaussian | |||
Int iclo(windowLow_p); | Int iclo(windowLow_p); | |||
Int ichi(windowLow_p); | Int ichi(windowLow_p); | |||
// Peak counter | // Peak counter | |||
Int nmax = 0; | Int nmax = 0; | |||
SpectralElement tspel; | GaussianSpectralElement tspel; | |||
while (++i < windowEnd_p) { | while (++i < windowEnd_p) { | |||
if (deriv_p[i] > 0.0) { | if (deriv_p[i] > 0.0) { | |||
// At edge? | // At edge? | |||
if (i > windowLow_p && i < windowEnd_p-1) { | if (i > windowLow_p && i < windowEnd_p-1) { | |||
// Peak in 2nd derivative | // Peak in 2nd derivative | |||
if (deriv_p[i-1] < deriv_p[i] && deriv_p[i+1] < deriv_p[i]) nmax++; | if (deriv_p[i-1] < deriv_p[i] && deriv_p[i+1] < deriv_p[i]) nmax++; | |||
// At start | // At start | |||
} else if (i == windowLow_p && deriv_p[i+1] < deriv_p[i]) nmax++; | } else if (i == windowLow_p && deriv_p[i+1] < deriv_p[i]) nmax++; | |||
// At end of window | // At end of window | |||
else if (i == windowEnd_p-1 && deriv_p[i-1] < deriv_p[i]) nmax++; | else if (i == windowEnd_p-1 && deriv_p[i-1] < deriv_p[i]) nmax++; | |||
skipping to change at line 186 | skipping to change at line 193 | |||
// Search for next peak | // Search for next peak | |||
case 1: | case 1: | |||
break; | break; | |||
// Found a Gaussian | // Found a Gaussian | |||
case 2: { | case 2: { | |||
// Some moments | // Some moments | |||
Double m0m(0); | Double m0m(0); | |||
Double m0(0); | Double m0(0); | |||
Double m1(0); | Double m1(0); | |||
Double m2(0); | Double m2(0); | |||
ichi = i; | ichi = i; | |||
// Do Schwarz' calculation | // Do Schwarz' calculation | |||
Double b = deriv_p[iclo]; | Double b = deriv_p[iclo]; | |||
Double a = (deriv_p[ichi] - b) / (ichi-iclo); | Double a = (deriv_p[ichi] - b) / (ichi-iclo); | |||
for (Int ic=iclo; ic<=ichi; ic++) { | for (Int ic=iclo; ic<=ichi; ic++) { | |||
m0m += min(deriv_p[ic], 0.0); | m0m += min(deriv_p[ic], 0.0); | |||
Double wi = deriv_p[ic] - a*(ic-iclo) - b; | Double wi = deriv_p[ic] - a*(ic-iclo) - b; | |||
m0 += wi; | m0 += wi; | |||
m1 += wi*ic; | m1 += wi*ic; | |||
m2 += wi*ic*ic; | m2 += wi*ic*ic; | |||
}; | }; | |||
// determinant | // determinant | |||
Double det = m2*m0 - m1*m1; | Double det = m2*m0 - m1*m1; | |||
if (det > 0.0 && fabs(m0m) > FLT_EPSILON) { | if (det > 0.0 && fabs(m0m) > FLT_EPSILON) { | |||
Double xm = m1/m0; | Double xm = m1/m0; | |||
Double sg = 1.69*sqrt(det) / fabs(m0); | Double sg = 1.69*sqrt(det) / fabs(m0); | |||
// Width above critical? | // Width above critical? | |||
if (sg > sigmin_p) { | if (sg > sigmin_p) { | |||
Int is = Int(1.73*sg+0.5); | Int is = Int(1.73*sg+0.5); | |||
Int im = Int(xm+0.5); | Int im = Int(xm+0.5); | |||
Double yl(0); | Double yl(0); | |||
if ((im-is) >= 0) yl = prof(im-is); | if ((im-is) >= 0) yl = prof(im-is); | |||
Double yh(0); | Double yh(0); | |||
if ((im + is) <= Int(lprof_p-1)) yh = prof(im+is); | if ((im + is) <= Int(lprof_p-1)) yh = prof(im+is); | |||
Double ym = prof(im); | Double ym = prof(im); | |||
skipping to change at line 237 | skipping to change at line 242 | |||
break; | break; | |||
} | } | |||
default: | default: | |||
iclo = i+1; | iclo = i+1; | |||
break; | break; | |||
}; | }; | |||
}; | }; | |||
} | } | |||
template <class MT> | template <class MT> | |||
SpectralElement SpectralEstimate::convertElement (const Vector<MT>& x, | GaussianSpectralElement SpectralEstimate::convertElement (const Vector<MT>& | |||
const SpectralElement& el | x, | |||
) const | const GaussianSpectralEle | |||
ment& el) const | ||||
{ | { | |||
SpectralElement elOut(el); | GaussianSpectralElement elOut = el; | |||
const Int& idxMax = x.nelements()-1; | const Int& idxMax = x.nelements()-1; | |||
// Get current (pars are amp, center, width as the SpectralElement | // Get current (pars are amp, center, width as the SpectralElement | |||
// will always be a Gaussian) | // will always be a Gaussian) | |||
Vector<Double> par, err; | Vector<Double> par, err; | |||
el.get(par); | el.get(par); | |||
el.getError(err); | el.getError(err); | |||
// Center | // Center | |||
skipping to change at line 282 | skipping to change at line 287 | |||
Double dIdx = par[1] - cenIdx; | Double dIdx = par[1] - cenIdx; | |||
par[1] = x[cenIdx] + dIdx*incX; // Interpolate | par[1] = x[cenIdx] + dIdx*incX; // Interpolate | |||
} | } | |||
err[1] = abs(err[1] * incX); | err[1] = abs(err[1] * incX); | |||
// Width | // Width | |||
par[2] = abs(par[2] * incX); | par[2] = abs(par[2] * incX); | |||
err[2] = abs(err[2] * incX); | err[2] = abs(err[2] * incX); | |||
// Set new | ||||
elOut.set(par); | elOut.set(par); | |||
elOut.setError(err); | elOut.setError(err); | |||
// | ||||
return elOut; | return elOut; | |||
} | } | |||
} //# End namespace casa | } //# End namespace casa | |||
End of changes. 10 change blocks. | ||||
15 lines changed or deleted | 20 lines changed or added | |||
SpectralElement.h | SpectralElement.h | |||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | |||
//# | //# | |||
//# Correspondence concerning AIPS++ should be addressed as follows: | //# Correspondence concerning AIPS++ should be addressed as follows: | |||
//# Internet email: aips2-request@nrao.edu. | //# Internet email: aips2-request@nrao.edu. | |||
//# Postal address: AIPS++ Project Office | //# Postal address: AIPS++ Project Office | |||
//# National Radio Astronomy Observatory | //# National Radio Astronomy Observatory | |||
//# 520 Edgemont Road | //# 520 Edgemont Road | |||
//# Charlottesville, VA 22903-2475 USA | //# Charlottesville, VA 22903-2475 USA | |||
//# | //# | |||
//# | //# | |||
//# $Id: SpectralElement.h 20652 2009-07-06 05:04:32Z Malte.Marquarding $ | //# $Id: SpectralElement.h 21229 2012-04-02 12:00:20Z gervandiepen $ | |||
#ifndef COMPONENTS_SPECTRALELEMENT_H | #ifndef COMPONENTS_SPECTRALELEMENT_H | |||
#define COMPONENTS_SPECTRALELEMENT_H | #define COMPONENTS_SPECTRALELEMENT_H | |||
//# Includes | ||||
#include <casa/aips.h> | #include <casa/aips.h> | |||
#include <casa/Arrays/Vector.h> | #include <casa/Arrays/Vector.h> | |||
#include <casa/Utilities/RecordTransformable.h> | #include <casa/Containers/RecordInterface.h> | |||
#include <casa/BasicSL/String.h> | ||||
#include <casa/iosfwd.h> | ||||
namespace casa { //# NAMESPACE CASA - BEGIN | namespace casa { //# NAMESPACE CASA - BEGIN | |||
// <summary> | // <summary> | |||
// Describes (a set of related) spectral lines | // Describes (a set of related) spectral lines | |||
// </summary> | // </summary> | |||
// <use visibility=export> | // <use visibility=export> | |||
// <reviewed reviewer="" date="yyyy/mm/dd" tests="tSpectralFit" demos=""> | // <reviewed reviewer="" date="yyyy/mm/dd" tests="tSpectralFit" demos=""> | |||
// </reviewed> | // </reviewed> | |||
// <prerequisite> | // <prerequisite> | |||
// <li> <linkto module=Functionals>Functionals</linkto> module | // <li> <linkto module=Functionals>Functionals</linkto> module | |||
// <li> <linkto class=RecordInterface>RecordInterface</linkto> class | ||||
// </prerequisite> | // </prerequisite> | |||
// | // | |||
// <etymology> | // <etymology> | |||
// From spectral line and element | // From spectral line and element | |||
// </etymology> | // </etymology> | |||
// | // | |||
// <synopsis> | // <synopsis> | |||
// The SpectralElement class is a container for a spectral line descriptor. | // The SpectralElement class is the abstract base class for classes | |||
// It can contain a single line (like a Gaussian profile), or a set of | // describing spectral components (Gaussian, Polynonomial, etc). | |||
// related lines (like a doublet or so). | ||||
// | // | |||
// The element can be used in the | // The element can be used in the | |||
// <linkto class=SpectralFit>SpectralFit</linkto> class and in the | // <linkto class=SpectralFit>SpectralFit</linkto> class and in the | |||
// <linkto class=SpectralEstimate>SpectralEstimate</linkto> class. | // <linkto class=SpectralEstimate>SpectralEstimate</linkto> class. | |||
// | // | |||
// The default type is a Gaussian, defined as: | ||||
// <srcblock> | ||||
// AMPL.exp[ -(x-CENTER)<sup>2</sup>/2 SIGMA<sup>2</sup>] | ||||
// </srcblock> | ||||
// | ||||
// </synopsis> | // </synopsis> | |||
// | // | |||
// <example> | // <example> | |||
// </example> | // </example> | |||
// | // | |||
// <motivation> | // <motivation> | |||
// To have a container for fitting of spectral profiles to an observed spec trum | // To have a container for fitting of spectral profiles to an observed spec trum | |||
// </motivation> | // </motivation> | |||
// | // | |||
// <todo asof="2001/02/04"> | // <todo asof="2001/02/04"> | |||
// <li> add more profile types | // <li> add more profile types | |||
// </todo> | // </todo> | |||
class SpectralElement : public RecordTransformable { | class SpectralElement { // : public RecordTransformable { | |||
public: | public: | |||
//# Enumerations | //# Enumerations | |||
// Types of spectral lines known | // Types of spectral lines known | |||
enum Types { | enum Types { | |||
// A gaussian profile | // A gaussian profile | |||
GAUSSIAN, | GAUSSIAN, | |||
// A polynomial baseline | // A polynomial baseline | |||
POLYNOMIAL, | POLYNOMIAL, | |||
// Any compiled string functional | // Any compiled string functional | |||
COMPILED, | COMPILED, | |||
N_Types | // Gaussian multiplet | |||
}; | GMULTIPLET, | |||
// Lorentzian | ||||
//# Constants | LORENTZIAN, | |||
// Sigma to FWHM conversion factor | N_Types | |||
static const Double SigmaToFWHM; | }; | |||
//# Constructors | virtual ~SpectralElement(); | |||
// Default constructor creates a default Gaussian element with an amplitu | ||||
de | virtual SpectralElement* clone() const = 0; | |||
// of 1; an integral <src>(sigma=2sqrt(ln2)/pi)</src> of 1; | ||||
// a central frequency of zero. | // Evaluate the value of the element at x | |||
SpectralElement(); | virtual Double operator()(const Double x) const = 0; | |||
// Construct with given type and values | ||||
// <thrown> | virtual Bool operator==(const SpectralElement& other) const; | |||
// <li> AipsError if sigma == 0.0 | ||||
// <li> AipsError if type not GAUSSIAN | // Get parameter n | |||
// </thrown> | // <thrown> | |||
SpectralElement(SpectralElement::Types tp, const Double ampl, | // <li> AipsError if illegal n | |||
const Double center, const Double sigma); | // </thrown> | |||
// Construct an n-degree polynomial | virtual Double operator[](const uInt n) const; | |||
explicit SpectralElement(const uInt n); | ||||
// Construct a compiled string | // Get all the types available as String and codes, and number avail | |||
explicit SpectralElement(const String &str, const Vector<Double> ¶m); | able | |||
// Construct the given tp with the given param | static const String* allTypes(Int &nall, | |||
// <thrown> | const SpectralElement::Types *&typ); | |||
// <li> AipsError if incorrect number of parameters (e.g. not 3 for GAU | // Get a string from the type | |||
SSIAN) | static const String &fromType(SpectralElement::Types tp); | |||
// <li> AipsError if sigma == 0.0 | // Get a type from a (non-case sensitive; minimum match) String | |||
// </thrown> | static Bool toType(SpectralElement::Types &tp, | |||
SpectralElement(SpectralElement::Types tp, const Vector<Double> ¶m); | const String &typName); | |||
// Copy constructor (deep copy) | ||||
// <thrown> | // Get the data for this element | |||
// <li> AipsError if sigma == 0.0 | // <thrown> | |||
// </thrown> | // <li> AipsError if element does not have data | |||
SpectralElement(const SpectralElement &other); | // (e.g. amplitude for POLYNOMIAL) | |||
// </thrown> | ||||
//#Destructor | // <group> | |||
// Destructor | // Get type of this element | |||
~SpectralElement(); | SpectralElement::Types getType() const { return tp_p; } | |||
//# Operators | // Get all parameters | |||
// Assignment (copy semantics) | void get(Vector<Double>& params) const; | |||
// <thrown> | ||||
// <li> AipsError if sigma == 0.0 | Vector<Double> get() const; | |||
// </thrown> | ||||
SpectralElement &operator=(const SpectralElement &other); | // Get error estimates of parameters | |||
// Evaluate the value of the element at x | void getError(Vector<Double> &err) const; | |||
Double operator()(const Double x) const; | Vector<Double> getError() const; | |||
// Get parameter n | ||||
// <thrown> | // Get the order (i.e. the number of parameters) | |||
// <li> AipsError if illegal n | uInt getOrder() const { return par_p.nelements(); }; | |||
// </thrown> | ||||
Double operator[](const uInt n) const; | // Set the error fields | |||
virtual void setError(const Vector<Double> &err); | ||||
//# Member functions | ||||
// Get all the types available as String and codes, and number available | // Set fixed parameters (True) or unset them (False) | |||
static const String* allTypes(Int &nall, | // <thrown> | |||
const SpectralElement::Types *&typ); | // <li> AipsError if incorrect number of parameters (e.g. not 3 fo | |||
// Get a string from the type | r GAUSSIAN) | |||
static const String &fromType(SpectralElement::Types tp); | // </thrown> | |||
// Get a type from a (non-case sensitive; minimum match) String | ||||
static Bool toType(SpectralElement::Types &tp, | // Fix/unfix all in one go | |||
const String &typName); | virtual void fix(const Vector<Bool>& fix); | |||
// Get the data for this element | // Get the fix state[s] | |||
// <thrown> | const Vector<Bool> &fixed() const; | |||
// <li> AipsError if element does not have data | ||||
// (e.g. amplitude for POLYNOMIAL) | // Save to a record. | |||
// </thrown> | virtual Bool toRecord(RecordInterface& out) const; | |||
// <group> | ||||
// Get type of this element | // set parameters | |||
SpectralElement::Types getType() const { return tp_p; } | virtual void set(const Vector<Double>& params); | |||
// Get amplitude | ||||
Double getAmpl() const; | protected: | |||
// Get center value | SpectralElement() {} | |||
Double getCenter() const; | ||||
// Get the width | SpectralElement(const SpectralElement& other); | |||
// <group> | ||||
Double getSigma() const; | SpectralElement &operator=(const SpectralElement& other); | |||
Double getFWHM() const; | ||||
// </group> | void _construct(const Types type, const Vector<Double>& params); | |||
// Get all parameters | ||||
void get(Vector<Double> ¶m) const; | void _set(const Vector<Double>& params); | |||
// Get amplitude error estimate | ||||
Double getAmplErr() const; | void _setType(const Types type); | |||
// Get center value error estimate | ||||
Double getCenterErr() const; | private: | |||
// Get the width error estimate | //#Data | |||
// <group> | // type of element | |||
Double getSigmaErr() const; | Types tp_p; | |||
Double getFWHMErr() const; | ||||
// </group> | // The parameters of the function. I.e. the polynomial coefficients; | |||
// Get error estimates of parameters | // amplitude, center and sigma of a Gaussian. | |||
void getError(Vector<Double> &err) const; | Vector<Double> par_p; | |||
// Get the degree of e.g. polynomial | // The errors of the parameters | |||
uInt getDegree() const; | Vector<Double> err_p; | |||
// Get the string of a compiled functional | // The indication if the parameter has to be fixed (True) or solved | |||
const String &getCompiled() const; | (False). | |||
// </group> | // Solved is the default. | |||
// Get the order (i.e. the number of parameters) | Vector<Bool> fix_p; | |||
uInt getOrder() const { return par_p.nelements(); }; | ||||
// Set data for element | ||||
// <group> | ||||
// Set all data | ||||
// <thrown> | ||||
// <li> AipsError if incorrect number of parameters (e.g. not 3 for GAU | ||||
SSIAN) | ||||
// <li> AipsError if sigma == 0.0 | ||||
// </thrown> | ||||
// <group> | ||||
// Reset a complete element | ||||
// <group> | ||||
template <class MT> | ||||
void set(SpectralElement::Types tp, const Vector<MT> ¶m); | ||||
// </group> | ||||
// Reset the parameter values only (i.e zero errors and nothing fixed) | ||||
// <group> | ||||
template <class MT> | ||||
void set(const Vector<MT> ¶m); | ||||
// </group> | ||||
// </group> | ||||
// Set the error fields | ||||
void setError(const Vector<Double> &err); | ||||
// Set amplitude | ||||
// <thrown> | ||||
// <li> AipsError if non GAUSSIAN | ||||
// </thrown> | ||||
void setAmpl(Double ampl); | ||||
// Set center | ||||
// <thrown> | ||||
// <li> AipsError if non GAUSSIAN | ||||
// </thrown> | ||||
void setCenter(Double center); | ||||
// Set width | ||||
// <thrown> | ||||
// <li> AipsError if non GAUSSIAN | ||||
// <li> AipsError if sigma == 0.0 | ||||
// </thrown> | ||||
// <group> | ||||
void setSigma(Double sigma); | ||||
void setFWHM(Double fwhm); | ||||
// </group> | ||||
// </group> | ||||
// Set degree | ||||
// <thrown> | ||||
// <li> AipsError if non POLYNOMIAL | ||||
// </thrown> | ||||
void setDegree(uInt n); | ||||
// Set a new compiled string | ||||
// <thrown> | ||||
// <li> AipsError if non COMPILED and illegal string | ||||
// </thrown> | ||||
void setCompiled(const String &str); | ||||
// Set fixed parameters (True) or unset them (False) | ||||
// <thrown> | ||||
// <li> AipsError if incorrect number of parameters (e.g. not 3 for GAU | ||||
SSIAN) | ||||
// </thrown> | ||||
// <group> | ||||
void fixAmpl(const Bool fix=True); | ||||
void fixCenter(const Bool fix=True); | ||||
void fixSigma(const Bool fix=True); | ||||
void fixFWHM(const Bool fix=True); | ||||
// Fix/unfix all in one go | ||||
void fix(const Vector<Bool> &fix); | ||||
// </group> | ||||
// Get the fix state[s] | ||||
// <thrown> | ||||
// <li> AipsError if incorrect number of parameters (e.g. not 3 for GAU | ||||
SSIAN) | ||||
// </thrown> | ||||
// <group> | ||||
Bool fixedAmpl() const; | ||||
Bool fixedCenter() const; | ||||
Bool fixedSigma() const; | ||||
Bool fixedFWHM() const; | ||||
const Vector<Bool> &fixed() const; | ||||
// </group> | ||||
// Construct from record. Must hold fields "type" (String) and | ||||
// "parameters" (Vector<Double>). For type=GAUSSIAN, parameters | ||||
// holds amplitude, center and sigma. For type=POLYNOMIAL, | ||||
// parameters(0) holds the degree. | ||||
static SpectralElement* fromRecord(const RecordInterface &container); | ||||
// Create a SpectralElement from a record. | ||||
// An error message is generated, and False | ||||
// returned if an invalid record is given. A valid record will return Tru | ||||
e. | ||||
// A valid record contains the following fields (any additional fields ar | ||||
e | ||||
// ignored): | ||||
// <ul> | ||||
// <li> type = TpString: type of element (gaussian etc; case | ||||
// insensitive) | ||||
// <li> parameters = TpVector(Double): one or more values giving the para | ||||
meters | ||||
// for the type | ||||
// </ul> | ||||
// A SpectralElement can be created from a string. In that case the strin | ||||
g | ||||
// will only indicate the type of element (like gaussian), and will | ||||
// create a default element of that given type. | ||||
// Error messages are postfixed to error. | ||||
// <group> | ||||
virtual Bool fromRecord(String &error, const RecordInterface &in); | ||||
virtual Bool fromString(String &error, const String &in); | ||||
// </group> | ||||
// Save to a record. The return will be False and an error | ||||
// message generated only if the SpectralElement is illegal (could not ha | ||||
ppen) | ||||
// Error messages are postfixed to error. For Gaussian elements, | ||||
// the width is defined as a FWHM in the record interface. | ||||
virtual Bool toRecord(String &error, RecordInterface &out) const; | ||||
// Get the identification of a record | ||||
virtual const String &ident() const; | ||||
private: | ||||
//#Data | ||||
// type of element | ||||
SpectralElement::Types tp_p; | ||||
// A number (like polynomial degree or number of doublet lines) | ||||
uInt n_p; | ||||
// The string value for compiled functional | ||||
String str_p; | ||||
// The parameters of the function. I.e. the polynomial coefficients; | ||||
// amplitude, center and sigma of a Gaussian. | ||||
Vector<Double> par_p; | ||||
// The errors of the parameters | ||||
Vector<Double> err_p; | ||||
// The indication if the parameter has to be fixed (True) or solved (Fals | ||||
e). | ||||
// Solved is the default. | ||||
Vector<Bool> fix_p; | ||||
//# Member functions | ||||
// Check if GAUSSIAN type | ||||
// <thrown> | ||||
// <li> AipsError if non-Gaussian | ||||
// </thrown> | ||||
void checkGauss() const; | ||||
// Check if POLYNOMIAL type | ||||
// <thrown> | ||||
// <li> AipsError if non-polynomial | ||||
// </thrown> | ||||
void checkPoly() const; | ||||
// Check if COMPILED type | ||||
// <thrown> | ||||
// <li> AipsError if non-compiled | ||||
// </thrown> | ||||
void checkCompiled() const; | ||||
// Check if sigma non-equal to zero and positive if a GAUSSIAN; | ||||
// if COMPILED check for correct string | ||||
// <thrown> | ||||
// <li> AipsError if illegal sigm | ||||
// </thrown> | ||||
void check(); | ||||
// Sigma to FWHM | ||||
// Convert from sigma to FWHM and vice versa | ||||
// <group> | ||||
static Double sigmaToFWHM (const Double sigma); | ||||
static Double sigmaFromFWHM (const Double fwhm); | ||||
// </group> | ||||
}; | }; | |||
//# Global functions | ostream &operator<<(ostream& os, const SpectralElement& elem); | |||
// <summary> Global functions </summary> | ||||
// <group name=Output> | Bool near(const SpectralElement& s1, const SpectralElement& s2, const Doubl | |||
// Output declaration | e tol); | |||
ostream &operator<<(ostream &os, const SpectralElement &elem); | ||||
// </group> | Bool nearAbs(const SpectralElement& s1, const SpectralElement& s2, const Do | |||
uble tol); | ||||
} //# NAMESPACE CASA - END | } //# NAMESPACE CASA - END | |||
#ifndef CASACORE_NO_AUTO_TEMPLATES | ||||
#include <components/SpectralComponents/Spectral4Element.tcc> | ||||
#endif //# CASACORE_NO_AUTO_TEMPLATES | ||||
#endif | #endif | |||
End of changes. 10 change blocks. | ||||
304 lines changed or deleted | 123 lines changed or added | |||
SpectralEstimate.h | SpectralEstimate.h | |||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | |||
//# | //# | |||
//# Correspondence concerning AIPS++ should be addressed as follows: | //# Correspondence concerning AIPS++ should be addressed as follows: | |||
//# Internet email: aips2-request@nrao.edu. | //# Internet email: aips2-request@nrao.edu. | |||
//# Postal address: AIPS++ Project Office | //# Postal address: AIPS++ Project Office | |||
//# National Radio Astronomy Observatory | //# National Radio Astronomy Observatory | |||
//# 520 Edgemont Road | //# 520 Edgemont Road | |||
//# Charlottesville, VA 22903-2475 USA | //# Charlottesville, VA 22903-2475 USA | |||
//# | //# | |||
//# | //# | |||
//# $Id: SpectralEstimate.h 20229 2008-01-29 15:19:06Z gervandiepen $ | //# $Id: SpectralEstimate.h 21229 2012-04-02 12:00:20Z gervandiepen $ | |||
#ifndef COMPONENTS_SPECTRALESTIMATE_H | #ifndef COMPONENTS_SPECTRALESTIMATE_H | |||
#define COMPONENTS_SPECTRALESTIMATE_H | #define COMPONENTS_SPECTRALESTIMATE_H | |||
//# Includes | ||||
#include <casa/aips.h> | #include <casa/aips.h> | |||
#include <components/SpectralComponents/SpectralElement.h> | #include <components/SpectralComponents/SpectralElement.h> | |||
#include <components/SpectralComponents/SpectralList.h> | #include <components/SpectralComponents/SpectralList.h> | |||
namespace casa { //# NAMESPACE CASA - BEGIN | namespace casa { //# NAMESPACE CASA - BEGIN | |||
//# Forward Declarations | //# Forward Declarations | |||
class GaussianSpectralElement; | ||||
template <class T> class Vector; | template <class T> class Vector; | |||
// <summary> | // <summary> | |||
// Get an initial estimate for spectral lines | // Get an initial estimate for spectral lines | |||
// </summary> | // </summary> | |||
// <use visibility=export> | // <use visibility=export> | |||
// <reviewed reviewer="" date="yyyy/mm/dd" tests="tSpectralFit" demos=""> | // <reviewed reviewer="" date="yyyy/mm/dd" tests="tSpectralFit" demos=""> | |||
// </reviewed> | // </reviewed> | |||
skipping to change at line 217 | skipping to change at line 217 | |||
template <class MT> | template <class MT> | |||
uInt window(const Vector<MT> &prof); | uInt window(const Vector<MT> &prof); | |||
// Get the second derivatives | // Get the second derivatives | |||
template <class MT> | template <class MT> | |||
void findc2(const Vector<MT> &prof); | void findc2(const Vector<MT> &prof); | |||
// Find the Gaussians | // Find the Gaussians | |||
template <class MT> | template <class MT> | |||
void findga(const Vector<MT> &prof); | void findga(const Vector<MT> &prof); | |||
// Convert the parameters of the components in the list from | // Convert the parameters of the components in the list from | |||
// pixel-based indices to the given abcissa-vector space. | // pixel-based indices to the given abcissa-vector space. | |||
template <class MT> SpectralElement convertElement (const Vector<MT>& abc | template <class MT> GaussianSpectralElement convertElement (const Vector< | |||
issa, | MT>& abcissa, | |||
const SpectralElement | const GaussianSpectra | |||
& el) const; | lElement& el) const; | |||
}; | }; | |||
} //# NAMESPACE CASA - END | } //# NAMESPACE CASA - END | |||
#ifndef CASACORE_NO_AUTO_TEMPLATES | #ifndef CASACORE_NO_AUTO_TEMPLATES | |||
#include <components/SpectralComponents/Spectral2Estimate.tcc> | #include <components/SpectralComponents/Spectral2Estimate.tcc> | |||
#endif //# CASACORE_NO_AUTO_TEMPLATES | #endif //# CASACORE_NO_AUTO_TEMPLATES | |||
#endif | #endif | |||
End of changes. 4 change blocks. | ||||
6 lines changed or deleted | 6 lines changed or added | |||
SpectralFit2.tcc | SpectralFit2.tcc | |||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
//# along with this library; if not, write to the Free Software Foundation, | //# along with this library; if not, write to the Free Software Foundation, | |||
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | |||
//# | //# | |||
//# Correspondence concerning AIPS++ should be addressed as follows: | //# Correspondence concerning AIPS++ should be addressed as follows: | |||
//# Internet email: aips2-request@nrao.edu. | //# Internet email: aips2-request@nrao.edu. | |||
//# Postal address: AIPS++ Project Office | //# Postal address: AIPS++ Project Office | |||
//# National Radio Astronomy Observatory | //# National Radio Astronomy Observatory | |||
//# 520 Edgemont Road | //# 520 Edgemont Road | |||
//# Charlottesville, VA 22903-2475 USA | //# Charlottesville, VA 22903-2475 USA | |||
//# | //# | |||
//# $Id: SpectralFit2.tcc 19935 2007-02-27 05:07:40Z Malte.Marquarding $ | //# $Id: SpectralFit2.tcc 21229 2012-04-02 12:00:20Z gervandiepen $ | |||
//# Includes | //# Includes | |||
#include <components/SpectralComponents/SpectralFit.h> | #include <components/SpectralComponents/SpectralFit.h> | |||
#include <casa/Arrays/Vector.h> | ||||
#include <components/SpectralComponents/SpectralElement.h> | #include <components/SpectralComponents/CompiledSpectralElement.h> | |||
#include <components/SpectralComponents/GaussianSpectralElement.h> | ||||
#include <components/SpectralComponents/LorentzianSpectralElement.h> | ||||
#include <components/SpectralComponents/PolynomialSpectralElement.h> | ||||
#include <scimath/Fitting/NonLinearFitLM.h> | #include <scimath/Fitting/NonLinearFitLM.h> | |||
#include <scimath/Functionals/CompiledFunction.h> | #include <scimath/Functionals/CompiledFunction.h> | |||
#include <scimath/Functionals/CompoundFunction.h> | #include <scimath/Functionals/CompoundFunction.h> | |||
#include <scimath/Functionals/CompoundParam.h> | #include <scimath/Functionals/CompoundParam.h> | |||
#include <scimath/Functionals/Gaussian1D.h> | #include <scimath/Functionals/Gaussian1D.h> | |||
#include <scimath/Functionals/Lorentzian1D.h> | ||||
#include <scimath/Functionals/Polynomial.h> | #include <scimath/Functionals/Polynomial.h> | |||
namespace casa { //# NAMESPACE CASA - BEGIN | namespace casa { //# NAMESPACE CASA - BEGIN | |||
//# Templated member functions | //# Templated member functions | |||
template <class MT> | template <class MT> | |||
Bool SpectralFit::fit(const Vector<MT> &y, | Bool SpectralFit::fit(const Vector<MT> &y, | |||
const Vector<MT> &x, | const Vector<MT> &x, | |||
const Vector<Bool> *mask) { | const Vector<Bool> *mask) { | |||
Vector<MT> sigma(x.nelements()); | Vector<MT> sigma(x.nelements()); | |||
sigma = 1.0; | sigma = 1.0; | |||
return fit(sigma, y, x, mask); | return fit(sigma, y, x, mask); | |||
} | } | |||
template <class MT> | template <class MT> | |||
Bool SpectralFit::fit(const Vector<MT> &sigma, | Bool SpectralFit::fit(const Vector<MT> &sigma, | |||
const Vector<MT> &y, | const Vector<MT> &y, | |||
const Vector<MT> &x, | const Vector<MT> &x, | |||
const Vector<Bool> *mask) { | const Vector<Bool> *mask) { | |||
// The fitter | // The fitter | |||
NonLinearFitLM<MT> fitter; | NonLinearFitLM<MT> fitter; | |||
iter_p = 0; | iter_p = 0; | |||
// The functions to fit | // The functions to fit | |||
Gaussian1D<AutoDiff<MT> > gauss; | CompoundFunction<AutoDiff<MT> > func; | |||
Polynomial<AutoDiff<MT> > poly; | // Initial guess | |||
CompiledFunction<AutoDiff<MT> > comp; | uInt npar(0); | |||
CompoundFunction<AutoDiff<MT> > func; | for (uInt i=0; i<slist_p.nelements(); i++) { | |||
// Initial guess | switch(slist_p[i]->getType()) { | |||
uInt npar(0); | case SpectralElement::GAUSSIAN: { | |||
for (uInt i=0; i<slist_p.nelements(); i++) { | Gaussian1D<AutoDiff<MT> > gauss; | |||
if (slist_p[i].getType() == SpectralElement::GAUSSIAN) { | GaussianSpectralElement *x = dynamic_cast<GaussianSp | |||
gauss[0] = AutoDiff<MT>(slist_p[i].getAmpl(), gauss.nparameters(), 0) | ectralElement *>(slist_p[i]); | |||
; | gauss[0] = AutoDiff<MT>(x->getAmpl(), gauss.nparamet | |||
gauss[1] = AutoDiff<MT>(slist_p[i].getCenter(), gauss.nparameters(), | ers(), 0); | |||
1); | gauss[1] = AutoDiff<MT>(x->getCenter(), gauss.nparam | |||
gauss[2] = AutoDiff<MT>(slist_p[i].getFWHM(), gauss.nparameters(), 2) | eters(), 1); | |||
; | gauss[2] = AutoDiff<MT>(x->getFWHM(), gauss.nparamet | |||
gauss.mask(0) = !slist_p[i].fixedAmpl(); | ers(), 2); | |||
gauss.mask(1) = !slist_p[i].fixedCenter(); | gauss.mask(0) = ! x->fixedAmpl(); | |||
gauss.mask(2) = !slist_p[i].fixedFWHM(); | gauss.mask(1) = ! x->fixedCenter(); | |||
func.addFunction(gauss); | gauss.mask(2) = ! x->fixedFWHM(); | |||
npar += gauss.nparameters(); | func.addFunction(gauss); | |||
} else if (slist_p[i].getType() == SpectralElement::POLYNOMIAL) { | npar += gauss.nparameters(); | |||
npar += slist_p[i].getDegree()+1; | } | |||
Polynomial<AutoDiff<MT> > poly(slist_p[i].getDegree()); | break; | |||
for (uInt j=0; j<poly.nparameters(); ++j) { | case SpectralElement::POLYNOMIAL: { | |||
poly[j] = AutoDiff<MT>(0, poly.nparameters(), j); | PolynomialSpectralElement *x = dynamic_cast<Polynomi | |||
poly.mask(j) = !slist_p[i].fixed()(j); | alSpectralElement *>(slist_p[i]); | |||
}; | ||||
func.addFunction(poly); | npar += x->getDegree()+1; | |||
} else if (slist_p[i].getType() == SpectralElement::COMPILED) { | Polynomial<AutoDiff<MT> > poly(x->getDegree()); | |||
CompiledFunction<AutoDiff<MT> > comp; | for (uInt j=0; j<poly.nparameters(); ++j) { | |||
comp.setFunction(slist_p[i].getCompiled()); | poly[j] = AutoDiff<MT>(0, poly.nparameters() | |||
Vector<Double> param; | , j); | |||
slist_p[i].get(param); | poly.mask(j) = ! x->fixed()(j); | |||
for (uInt j=0; j<comp.nparameters(); ++j) { | }; | |||
comp[j] = AutoDiff<MT>(param[j], comp.nparameters(), j); | func.addFunction(poly); | |||
comp.mask(j) = !slist_p[i].fixed()(j); | } | |||
}; | break; | |||
func.addFunction(comp); | case SpectralElement::COMPILED: | |||
}; | // Allow fall through; these use the same code | |||
}; | case SpectralElement::GMULTIPLET: { | |||
fitter.setFunction(func); | CompiledSpectralElement *x = dynamic_cast<CompiledSp | |||
// Max. number of iterations | ectralElement *>(slist_p[i]); | |||
fitter.setMaxIter(50+ slist_p.nelements()*10); | CompiledFunction<AutoDiff<MT> > comp; | |||
// Convergence criterium | comp.setFunction(x->getFunction()); | |||
fitter.setCriteria(0.001); | Vector<Double> param; | |||
// Fit | x->get(param); | |||
Vector<MT> sol; | for (uInt j=0; j<comp.nparameters(); ++j) { | |||
Vector<MT> err; | comp[j] = AutoDiff<MT>(param[j], comp.nparam | |||
sol = fitter.fit(x, y, sigma, mask); | eters(), j); | |||
err = fitter.errors(); | comp.mask(j) = ! x->fixed()(j); | |||
// Number of iterations | } | |||
iter_p = fitter.currentIteration(); | func.addFunction(comp); | |||
chiSq_p = fitter.getChi2(); | } | |||
uInt j = 0; | break; | |||
Vector<Double> tmp, terr; | case SpectralElement::LORENTZIAN: { | |||
for (uInt i=0; i<slist_p.nelements(); i++) { | LorentzianSpectralElement *x = dynamic_cast<Lorentzi | |||
tmp.resize(slist_p[i].getOrder()); | anSpectralElement *>(slist_p[i]); | |||
terr.resize(slist_p[i].getOrder()); | Lorentzian1D<AutoDiff<MT> > lor; | |||
for (uInt k=0; k<slist_p[i].getOrder(); k++) { | lor[0] = AutoDiff<MT>(x->getAmpl(), lor.nparameters( | |||
if (k==2 && slist_p[i].getType() == SpectralElement::GAUSSIAN) { | ), 0); | |||
tmp(k) = sol(j) / SpectralElement::SigmaToFWHM; | lor[1] = AutoDiff<MT>(x->getCenter(), lor.nparameter | |||
terr(k) = err(j++) / SpectralElement::SigmaToFWHM; | s(), 1); | |||
} else { /// Get rid of / above after changing element contents | lor[2] = AutoDiff<MT>(x->getFWHM(), lor.nparameters( | |||
tmp(k) = sol(j); | ), 2); | |||
terr(k) = err(j++); | lor.mask(0) = ! x->fixedAmpl(); | |||
}; | lor.mask(1) = ! x->fixedCenter(); | |||
}; | lor.mask(2) = ! x->fixedFWHM(); | |||
slist_p[i].set(tmp); | func.addFunction(lor); | |||
slist_p[i].setError(terr); | npar += lor.nparameters(); | |||
}; | } | |||
return fitter.converged(); | break; | |||
default: | ||||
throw AipsError("Unhandled SpectralElement type"); | ||||
} | ||||
} | ||||
fitter.setFunction(func); | ||||
// Max. number of iterations | ||||
fitter.setMaxIter(50+ slist_p.nelements()*10); | ||||
// Convergence criterium | ||||
fitter.setCriteria(0.001); | ||||
// Fit | ||||
Vector<MT> sol; | ||||
Vector<MT> err; | ||||
sol = fitter.fit(x, y, sigma, mask); | ||||
err = fitter.errors(); | ||||
// Number of iterations | ||||
iter_p = fitter.currentIteration(); | ||||
chiSq_p = fitter.getChi2(); | ||||
uInt j = 0; | ||||
Vector<Double> tmp, terr; | ||||
for (uInt i=0; i<slist_p.nelements(); i++) { | ||||
tmp.resize(slist_p[i]->getOrder()); | ||||
terr.resize(slist_p[i]->getOrder()); | ||||
for (uInt k=0; k<slist_p[i]->getOrder(); k++) { | ||||
if (k==2 && slist_p[i]->getType() == SpectralElement | ||||
::GAUSSIAN) { | ||||
tmp(k) = sol(j) / GaussianSpectralElement::S | ||||
igmaToFWHM; | ||||
terr(k) = err(j++) / GaussianSpectralElemen | ||||
t::SigmaToFWHM; | ||||
} else { /// Get rid of / above after changing eleme | ||||
nt contents | ||||
tmp(k) = sol(j); | ||||
terr(k) = err(j++); | ||||
}; | ||||
}; | ||||
slist_p[i]->set(tmp); | ||||
slist_p[i]->setError(terr); | ||||
} | ||||
return fitter.converged(); | ||||
} | } | |||
} //# NAMESPACE CASA - END | } //# NAMESPACE CASA - END | |||
End of changes. 4 change blocks. | ||||
80 lines changed or deleted | 123 lines changed or added | |||
SpectralIndex.h | SpectralIndex.h | |||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
//# along with this library; if not, write to the Free Software Foundation, | //# along with this library; if not, write to the Free Software Foundation, | |||
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | |||
//# | //# | |||
//# Correspondence concerning AIPS++ should be addressed as follows: | //# Correspondence concerning AIPS++ should be addressed as follows: | |||
//# Internet email: aips2-request@nrao.edu. | //# Internet email: aips2-request@nrao.edu. | |||
//# Postal address: AIPS++ Project Office | //# Postal address: AIPS++ Project Office | |||
//# National Radio Astronomy Observatory | //# National Radio Astronomy Observatory | |||
//# 520 Edgemont Road | //# 520 Edgemont Road | |||
//# Charlottesville, VA 22903-2475 USA | //# Charlottesville, VA 22903-2475 USA | |||
//# | //# | |||
//# $Id: SpectralIndex.h 18093 2004-11-30 17:51:10Z ddebonis $ | //# $Id: SpectralIndex.h 21229 2012-04-02 12:00:20Z gervandiepen $ | |||
#ifndef COMPONENTS_SPECTRALINDEX_H | #ifndef COMPONENTS_SPECTRALINDEX_H | |||
#define COMPONENTS_SPECTRALINDEX_H | #define COMPONENTS_SPECTRALINDEX_H | |||
#include <casa/aips.h> | #include <casa/aips.h> | |||
#include <components/ComponentModels/ComponentType.h> | #include <components/ComponentModels/ComponentType.h> | |||
#include <components/ComponentModels/SpectralModel.h> | #include <components/ComponentModels/SpectralModel.h> | |||
namespace casa { //# NAMESPACE CASA - BEGIN | namespace casa { //# NAMESPACE CASA - BEGIN | |||
skipping to change at line 60 | skipping to change at line 60 | |||
// <li> <linkto class="SpectralModel">SpectralModel</linkto> | // <li> <linkto class="SpectralModel">SpectralModel</linkto> | |||
// </prerequisite> | // </prerequisite> | |||
// | // | |||
// <synopsis> | // <synopsis> | |||
// This class models the spectral variation of a component with a spectral | // This class models the spectral variation of a component with a spectral | |||
// index. | // index. | |||
// This class like the other spectral models becomes more useful when used | // This class like the other spectral models becomes more useful when used | |||
// through the <linkto class=SkyComponent>SkyComponent</linkto> class, whic h | // through the <linkto class=SkyComponent>SkyComponent</linkto> class, whic h | |||
// incorperates the flux and spatial variation of the emission, or through the | // incorporates the flux and spatial variation of the emission, or through the | |||
// <linkto class=ComponentList>ComponentList</linkto> class, which handles | // <linkto class=ComponentList>ComponentList</linkto> class, which handles | |||
// groups of SkyComponent objects. | // groups of SkyComponent objects. | |||
// A spectral index is the exponent in a power law model for the variation flux | // A spectral index is the exponent in a power law model for the variation flux | |||
// with frequency. It is mathematically is defined as: | // with frequency. It is mathematically is defined as: | |||
// <srcblock> | // <srcblock> | |||
// (nu / nu_0)^alpha | // (nu / nu_0)^alpha | |||
// </srcblock> | // </srcblock> | |||
// Where: | // Where: | |||
// <dl compact> | // <dl compact> | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
SpectralList.h | SpectralList.h | |||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. | |||
//# | //# | |||
//# Correspondence concerning AIPS++ should be addressed as follows: | //# Correspondence concerning AIPS++ should be addressed as follows: | |||
//# Internet email: aips2-request@nrao.edu. | //# Internet email: aips2-request@nrao.edu. | |||
//# Postal address: AIPS++ Project Office | //# Postal address: AIPS++ Project Office | |||
//# National Radio Astronomy Observatory | //# National Radio Astronomy Observatory | |||
//# 520 Edgemont Road | //# 520 Edgemont Road | |||
//# Charlottesville, VA 22903-2475 USA | //# Charlottesville, VA 22903-2475 USA | |||
//# | //# | |||
//# | //# | |||
//# $Id: SpectralList.h 20229 2008-01-29 15:19:06Z gervandiepen $ | //# $Id: SpectralList.h 21229 2012-04-02 12:00:20Z gervandiepen $ | |||
#ifndef COMPONENTS_SPECTRALLIST_H | #ifndef COMPONENTS_SPECTRALLIST_H | |||
#define COMPONENTS_SPECTRALLIST_H | #define COMPONENTS_SPECTRALLIST_H | |||
//# Includes | //# Includes | |||
#include <casa/aips.h> | #include <casa/aips.h> | |||
#include <casa/Containers/Block.h> | #include <casa/Containers/Block.h> | |||
namespace casa { //# NAMESPACE CASA - BEGIN | namespace casa { //# NAMESPACE CASA - BEGIN | |||
skipping to change at line 108 | skipping to change at line 108 | |||
//# Operators | //# Operators | |||
// Assignment (copy semantics) | // Assignment (copy semantics) | |||
SpectralList &operator=(const SpectralList &other); | SpectralList &operator=(const SpectralList &other); | |||
// Evaluate the value of the sum of the elements at x | // Evaluate the value of the sum of the elements at x | |||
Double operator()(const Double x) const; | Double operator()(const Double x) const; | |||
// Get element n | // Get element n | |||
// <thrown> | // <thrown> | |||
// <li> AipsError if illegal n | // <li> AipsError if illegal n | |||
// </thrown> | // </thrown> | |||
// <group> | // <group> | |||
const SpectralElement &operator[](const uInt n) const; | const SpectralElement* operator[](const uInt n) const; | |||
SpectralElement &operator[](const uInt n); | SpectralElement* operator[](const uInt n); | |||
// </group> | // </group> | |||
//# Member functions | //# Member functions | |||
// Get the number of elements in list | // Get the number of elements in list | |||
uInt nelements() const { return list_p.nelements(); }; | uInt nelements() const { return list_p.nelements(); }; | |||
// Get the profile values for all elements in list. The evaluation | // Get the profile values for all elements in list. The evaluation | |||
// is for the length of the given <src>prof</src>, assuming x values of | // is for the length of the given <src>prof</src>, assuming x values of | |||
// 0,1,... if no x given. | // 0,1,... if no x given. | |||
// <group> | // <group> | |||
skipping to change at line 176 | skipping to change at line 176 | |||
private: | private: | |||
//#Data | //#Data | |||
// Max length allowed of list | // Max length allowed of list | |||
uInt nmax_p; | uInt nmax_p; | |||
// List of elements | // List of elements | |||
PtrBlock<SpectralElement *> list_p; | PtrBlock<SpectralElement *> list_p; | |||
//# Member functions | //# Member functions | |||
// Compare two elements | // Compare two elements | |||
Int compar(const SpectralElement &p1, const SpectralElement &p2); | Int compar(const SpectralElement &p1, const SpectralElement &p2) const; | |||
}; | }; | |||
//# Global functions | //# Global functions | |||
// <summary> Global functions </summary> | // <summary> Global functions </summary> | |||
// <group name=Output> | // <group name=Output> | |||
// Output declaration | // Output declaration | |||
std::ostream &operator<<(std::ostream &os, const SpectralList &lst); | std::ostream &operator<<(std::ostream &os, const SpectralList &lst); | |||
// </group> | // </group> | |||
End of changes. 3 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||