casacore
Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::FrequencyAligner< T > Class Template Reference

More...

#include <FrequencyAligner.h>

Public Member Functions

 FrequencyAligner ()
 Default constructor (object not viable) More...
 
 FrequencyAligner (const SpectralCoordinate &specCoord, uInt nPixels, const MEpoch &refEpoch, const MDirection &dir, const MPosition &pos, MFrequency::Types freqSystem)
 Constructor specifies a SpectralCoordinate (any extra reference conversion frame set in it will be ignored), the number of pixels in the spectra to be aligned, a reference epoch to which all spectra will be aligned, a direction on the sky, a position on the earth (the observatory), and desired frequency system to align in. More...
 
 FrequencyAligner (const FrequencyAligner< T > &other)
 Copy constructor (copy semantics) More...
 
FrequencyAligneroperator= (const FrequencyAligner< T > &other)
 Assignment (copy semantics) More...
 
 ~FrequencyAligner ()
 Destructor. More...
 
void setTolerance (Double tol)
 Set a tolerance (in pixels) to trigger regridding (function align). More...
 
Bool align (Vector< T > &yOut, Vector< Bool > &maskOut, const Vector< T > &yIn, const Vector< Bool > &maskIn, const MEpoch &epoch, Bool useCachedAbcissa, typename InterpolateArray1D< Double, T >::InterpolationMethod method, Bool extrapolate=False)
 Align (via regridding) one spectrum taken at the specified epoch to the reference epoch. More...
 
Bool align (Vector< T > &yOut, Vector< Bool > &maskOut, const Vector< Double > &xIn, const Vector< T > &yIn, const Vector< Bool > &maskIn, const MEpoch &epoch, Bool useCachedAbcissa, typename InterpolateArray1D< Double, T >::InterpolationMethod method, Bool extrapolate=False)
 This function is the same as the previous except that you can specify the input abcissa as well as the data and mask. More...
 
Bool alignMany (Array< T > &yOut, Array< Bool > &maskOut, const Array< T > &yIn, const Array< Bool > &maskIn, uInt axis, const MEpoch &epoch, typename InterpolateArray1D< Double, T >::InterpolationMethod method, Bool extrapolate=False)
 Align many spectra stored in an Array along the specified axis. More...
 
void getReferenceAbcissa (Vector< Double > &xOut) const
 Get the reference abcissa (as a frequency in the axis units set in the SpectralCoordinate) at the reference epoch
More...
 
void getAbcissa (Vector< Double > &xOut) const
 Get the abcissa (as a frequency in the axis units set in the SpectralCoordinate) last cached by function align More...
 
SpectralCoordinate alignedSpectralCoordinate (Bool doLinear=True) const
 Get new aligned SpectralCoordinate. More...
 

Private Member Functions

void copyOther (const FrequencyAligner< T > &other)
 Internal copy. More...
 
void makeMachine (const MEpoch &refEpoch, const MDirection &dir, const MPosition &pos, MFrequency::Types freqSystem, const Unit &unit)
 Create the Conversion machine. More...
 
Double makeAbcissa (Vector< Double > &f, Bool doMaxDiff)
 Generate an abcissa with the machine. More...
 
Bool regrid (Vector< T > &yOut, Vector< Bool > &maskOut, const Vector< Double > &xOut, const Vector< Double > &xIn, const Vector< T > &yIn, const Vector< Bool > &maskIn, typename InterpolateArray1D< Double, T >::InterpolationMethod method, Bool extrapolate, Double maxDiff) const
 Regrid one spectrum. More...
 

Private Attributes

SpectralCoordinate itsSpecCoord
 
MFrequency::Convert itsMachine
 
MFrequency::Ref itsRefOut
 
MFrequency::Types itsFreqSystem
 the conversion machines epoch otherwise More...
 
Vector< DoubleitsRefFreqX
 
Vector< DoubleitsFreqX
 
Double itsDiffTol
 

Detailed Description

template<class T>
class casacore::FrequencyAligner< T >

Aligns spectra in frequency space

Intended use:

Public interface

Review Status

Test programs:
tFrequencyAligner

Prerequisite

Synopsis

Spectra are converted to the specified reference frame and aligned at a specified instant in time.

You should not try to convert from, say, a SpectralCoordinate::TOPO to MFrequency::TOPO as this would be meaningless. This class is designed mainly to convert say from a SpectralCoordinate::TOPO to say, a BARY frame and align.

Motivation

Required for ASAP single-dish package

Definition at line 82 of file FrequencyAligner.h.

Constructor & Destructor Documentation

◆ FrequencyAligner() [1/3]

template<class T >
casacore::FrequencyAligner< T >::FrequencyAligner ( )

Default constructor (object not viable)

◆ FrequencyAligner() [2/3]

template<class T >
casacore::FrequencyAligner< T >::FrequencyAligner ( const SpectralCoordinate specCoord,
uInt  nPixels,
const MEpoch refEpoch,
const MDirection dir,
const MPosition pos,
MFrequency::Types  freqSystem 
)

Constructor specifies a SpectralCoordinate (any extra reference conversion frame set in it will be ignored), the number of pixels in the spectra to be aligned, a reference epoch to which all spectra will be aligned, a direction on the sky, a position on the earth (the observatory), and desired frequency system to align in.


◆ FrequencyAligner() [3/3]

template<class T >
casacore::FrequencyAligner< T >::FrequencyAligner ( const FrequencyAligner< T > &  other)

Copy constructor (copy semantics)

◆ ~FrequencyAligner()

template<class T >
casacore::FrequencyAligner< T >::~FrequencyAligner ( )

Destructor.

Member Function Documentation

◆ align() [1/2]

template<class T >
Bool casacore::FrequencyAligner< T >::align ( Vector< T > &  yOut,
Vector< Bool > &  maskOut,
const Vector< Double > &  xIn,
const Vector< T > &  yIn,
const Vector< Bool > &  maskIn,
const MEpoch epoch,
Bool  useCachedAbcissa,
typename InterpolateArray1D< Double, T >::InterpolationMethod  method,
Bool  extrapolate = False 
)

This function is the same as the previous except that you can specify the input abcissa as well as the data and mask.

The input abcissa must be in the same units as the Construction SpectralCoordinate. The abcissa values must be in the same base reference frame as the Construction SpectralCoordinate. So instead of the abcissa (in the output reference frame) being computed from the Construction SC, you get to specify the abcissa directly. This might be useful if you have more than one set of spectra to align, all in the same Frame, but with different attributes such as reference value/pixel etc. The output spectrum is still regridded to the abcissa at the reference time generated at construction. from the current

◆ align() [2/2]

template<class T >
Bool casacore::FrequencyAligner< T >::align ( Vector< T > &  yOut,
Vector< Bool > &  maskOut,
const Vector< T > &  yIn,
const Vector< Bool > &  maskIn,
const MEpoch epoch,
Bool  useCachedAbcissa,
typename InterpolateArray1D< Double, T >::InterpolationMethod  method,
Bool  extrapolate = False 
)

Align (via regridding) one spectrum taken at the specified epoch to the reference epoch.

Your provide the ordinate and mask (True==Good) for the spectrum. The lengths of these vectors must be the same as nPixels given in the constructor. The output vectors are resized as needed. You can use the last cached abcissa (computed by this function) rather than recompute it if you have more than one spectrum at the same epoch to convert (e.g. different polarizations). If you do this, it is your responsibility to make sure that you have called this function at least once with useCachedAbcissa=False. If extrapolate is True, the regridding process is allowed to extrapolate outside of the abcissa domain. Otherwise masked pixels will result. Returns True if a regrid triggered, else False if just copied (see function setTolerance.

◆ alignedSpectralCoordinate()

template<class T >
SpectralCoordinate casacore::FrequencyAligner< T >::alignedSpectralCoordinate ( Bool  doLinear = True) const

Get new aligned SpectralCoordinate.

It is probably non-linear, but if you would like a linear approximation, use the doLinear argument.

◆ alignMany()

template<class T >
Bool casacore::FrequencyAligner< T >::alignMany ( Array< T > &  yOut,
Array< Bool > &  maskOut,
const Array< T > &  yIn,
const Array< Bool > &  maskIn,
uInt  axis,
const MEpoch epoch,
typename InterpolateArray1D< Double, T >::InterpolationMethod  method,
Bool  extrapolate = False 
)

Align many spectra stored in an Array along the specified axis.

All spectra are aligned to the same frequency abcissa (as described in previous function). If any alignment returns False, then the return value will be False, otherwise True is returned.

◆ copyOther()

template<class T >
void casacore::FrequencyAligner< T >::copyOther ( const FrequencyAligner< T > &  other)
private

Internal copy.

◆ getAbcissa()

template<class T >
void casacore::FrequencyAligner< T >::getAbcissa ( Vector< Double > &  xOut) const

Get the abcissa (as a frequency in the axis units set in the SpectralCoordinate) last cached by function align

◆ getReferenceAbcissa()

template<class T >
void casacore::FrequencyAligner< T >::getReferenceAbcissa ( Vector< Double > &  xOut) const

Get the reference abcissa (as a frequency in the axis units set in the SpectralCoordinate) at the reference epoch

◆ makeAbcissa()

template<class T >
Double casacore::FrequencyAligner< T >::makeAbcissa ( Vector< Double > &  f,
Bool  doMaxDiff 
)
private

Generate an abcissa with the machine.

◆ makeMachine()

template<class T >
void casacore::FrequencyAligner< T >::makeMachine ( const MEpoch refEpoch,
const MDirection dir,
const MPosition pos,
MFrequency::Types  freqSystem,
const Unit unit 
)
private

Create the Conversion machine.

◆ operator=()

template<class T >
FrequencyAligner& casacore::FrequencyAligner< T >::operator= ( const FrequencyAligner< T > &  other)

Assignment (copy semantics)

◆ regrid()

template<class T >
Bool casacore::FrequencyAligner< T >::regrid ( Vector< T > &  yOut,
Vector< Bool > &  maskOut,
const Vector< Double > &  xOut,
const Vector< Double > &  xIn,
const Vector< T > &  yIn,
const Vector< Bool > &  maskIn,
typename InterpolateArray1D< Double, T >::InterpolationMethod  method,
Bool  extrapolate,
Double  maxDiff 
) const
private

Regrid one spectrum.

◆ setTolerance()

template<class T >
void casacore::FrequencyAligner< T >::setTolerance ( Double  tol)
inline

Set a tolerance (in pixels) to trigger regridding (function align).

If the maximum abcissa difference for the current spectrum abcissa compared to the reference abcissa is greater than tol (pixels) then a regrid is triggered. Otherwise the input is just copied to the output when function align is called. Set to 0 to turn this tolerance assessment off. This function may be not really worth using.

Definition at line 113 of file FrequencyAligner.h.

References casacore::abs(), and casacore::FrequencyAligner< T >::itsDiffTol.

Member Data Documentation

◆ itsDiffTol

template<class T >
Double casacore::FrequencyAligner< T >::itsDiffTol
private

Definition at line 180 of file FrequencyAligner.h.

Referenced by casacore::FrequencyAligner< T >::setTolerance().

◆ itsFreqSystem

template<class T >
MFrequency::Types casacore::FrequencyAligner< T >::itsFreqSystem
private

the conversion machines epoch otherwise

Definition at line 175 of file FrequencyAligner.h.

◆ itsFreqX

template<class T >
Vector<Double> casacore::FrequencyAligner< T >::itsFreqX
private

Definition at line 178 of file FrequencyAligner.h.

◆ itsMachine

template<class T >
MFrequency::Convert casacore::FrequencyAligner< T >::itsMachine
private

Definition at line 172 of file FrequencyAligner.h.

◆ itsRefFreqX

template<class T >
Vector<Double> casacore::FrequencyAligner< T >::itsRefFreqX
private

Definition at line 177 of file FrequencyAligner.h.

◆ itsRefOut

template<class T >
MFrequency::Ref casacore::FrequencyAligner< T >::itsRefOut
private

Definition at line 173 of file FrequencyAligner.h.

◆ itsSpecCoord

template<class T >
SpectralCoordinate casacore::FrequencyAligner< T >::itsSpecCoord
private

Definition at line 171 of file FrequencyAligner.h.


The documentation for this class was generated from the following file: