casa
5.7.0-16
|
Fits and optionally subtracts the continuum in visibility spectra. More...
#include <VBContinuumSubtractor.h>
Public Member Functions | |
VBContinuumSubtractor () | |
VBContinuumSubtractor (const casacore::Double lofreq, const casacore::Double hifreq) | |
Construct it with the low and high frequencies used for scaling the frequencies in the polynomial. More... | |
~VBContinuumSubtractor () | |
void | init (const casacore::IPosition &shp, const casacore::uInt maxAnt, const casacore::uInt totnumchan, const casacore::Double lof, const casacore::Double hif) |
Set the # of correlations and fitorder from shp, the total number of input channels to look at (including masked ones!), and the low and high scaling frequencies. More... | |
casacore::Bool | initFromVBGA (VisBuffGroupAcc &vbga) |
Set the low and high frequencies, and #s of correlations, antennas, and channels from vbga. More... | |
void | fit (VisBuffGroupAcc &vbga, const casacore::Int fitorder, casacore::MS::PredefinedColumns whichcol, casacore::Cube< casacore::Complex > &coeffs, casacore::Cube< casacore::Bool > &coeffsOK, const casacore::Bool doInit=false, const casacore::Bool doResize=false, const casacore::Bool squawk=true) |
Makes the continuum estimate by fitting a frequency polynomial of order fitorder to the data in vbga. More... | |
casacore::Bool | apply (VisBuffer &vb, const casacore::MS::PredefinedColumns whichcol, const casacore::Cube< casacore::Complex > &coeffs, const casacore::Cube< casacore::Bool > &coeffsOK, const casacore::Bool doSubtraction=true, const casacore::Bool squawk=true) |
Apply the continuum estimate in coeffs (from fit) to vb. More... | |
casacore::Bool | areFreqsInBounds (VisBuffer &vb, const casacore::Bool squawk) const |
Returns whether or not vb's frequencies are within the bounds used for the continuum fit. More... | |
casacore::Bool | areFreqsInBounds (vi::VisBuffer2 &vb, const casacore::Bool squawk) const |
casacore::Int | getOrder () const |
These are provided for the calibration framework so that a VBContinuumSubtractor can be c'ted from a VisBuffGroupAcc, make a continuum fit, write its results to a caltable, destroyed, and then later another one can be c'ted from the caltable and apply the fit to a VisBuffer. More... | |
casacore::Double | getLowFreq () const |
casacore::Double | getHighFreq () const |
casacore::Int | getMaxAntNum () const |
the casacore::MS def'n v.2. More... | |
casacore::uInt | getTotNumChan () const |
The total number of input channels that will be looked at (including masked ones!) More... | |
void | setScalingFreqs (casacore::Double lof, casacore::Double hif) |
Low (lof) and high (hif) frequencies, in Hz, used for renormalizing frequencies in the polynomials. More... | |
void | setNAnt (const casacore::uInt nAnt) |
Set the maximum number of antennas (actually, 1 + the maximum antenna number). More... | |
void | setTotNumChan (const casacore::uInt tnc) |
Set the total number of input channels that will be looked at (including masked ones!) More... | |
void | resize (casacore::Cube< casacore::Complex > &coeffs, casacore::Cube< casacore::Bool > &coeffsOK) const |
A convenience function for prepping coeffs and coeffsOK to hold the polynomial coefficients and their validities. More... | |
casacore::Bool | checkSize (casacore::Cube< casacore::Complex > &coeffs, casacore::Cube< casacore::Bool > &coeffsOK) const |
casacore::Double | calcFreqScale () const |
void | setTVIDebug (bool debug) |
casacore::Bool | apply2 (vi::VisBuffer2 &vb, casacore::Cube< casacore::Complex > &Vout, const casacore::Cube< casacore::Complex > &coeffs, const casacore::Cube< casacore::Bool > &coeffsOK, const casacore::Bool doSubtraction=true, const casacore::Bool squawk=true) |
Static Public Member Functions | |
static void | getMinMaxFreq (VisBuffer &vb, casacore::Double &minfreq, casacore::Double &maxfreq, const casacore::Bool initialize=true) |
Fills minfreq and maxfreq with the minimum and maximum frequencies (in Hz, acc. More... | |
static void | getMinMaxFreq (vi::VisBuffer2 &vb, casacore::Double &minfreq, casacore::Double &maxfreq, const casacore::Bool initialize=true) |
Private Member Functions | |
VBContinuumSubtractor & | operator= (VBContinuumSubtractor &other) |
Disable default copying, and assignment. More... | |
casacore::Bool | doShapesMatch (VisBuffer &vb, casacore::LogIO &os, const casacore::Bool squawk=true) const |
Can the fit be applied to vb? If not and squawk is true, send a severe message to os. More... | |
casacore::Bool | doShapesMatch (vi::VisBuffer2 &vb, casacore::LogIO &os, const casacore::Bool squawk=true) const |
casacore::uInt | hashFunction (const casacore::Int ant1, const casacore::Int ant2) |
Compute baseline (row) index in coeffs_p for (ant1, ant2). More... | |
Private Attributes | |
casacore::Int | fitorder_p |
VisBuffGroupAcc& vbga_p; // Holds the VisBuffers. More... | |
casacore::Double | lofreq_p |
casacore::Double | hifreq_p |
casacore::Double | midfreq_p |
casacore::Double | freqscale_p |
casacore::Int | maxAnt_p |
casacore::uInt | nHashes_p |
used with the fits. More... | |
casacore::uInt | ncorr_p |
casacore::uInt | totnumchan_p |
casacore::PtrBlock < casacore::Vector < casacore::Bool > * > | chanmask_p |
bool | tvi_debug |
Fits and optionally subtracts the continuum in visibility spectra.
Public interface
This class's main aim is to subtract the continuum from VisBuffers.
Spectral line observations often contain continuum emission which is present in all channels (often with a small slope and curvature across the band). This class fits a polynomial to this continuum, and can return the continuum and/or line (continuum-subtracted) estimates as VisBuffers.
This class provides continuum fitting by polynomials with order >= 0, with a convenient interface for use by other classes in synthesis and msvis (i.e. calibration, imaging, and split).
Definition at line 101 of file VBContinuumSubtractor.h.
casa::VBContinuumSubtractor::VBContinuumSubtractor | ( | ) |
casa::VBContinuumSubtractor::VBContinuumSubtractor | ( | const casacore::Double | lofreq, |
const casacore::Double | hifreq | ||
) |
Construct it with the low and high frequencies used for scaling the frequencies in the polynomial.
casa::VBContinuumSubtractor::~VBContinuumSubtractor | ( | ) |
casacore::Bool casa::VBContinuumSubtractor::apply | ( | VisBuffer & | vb, |
const casacore::MS::PredefinedColumns | whichcol, | ||
const casacore::Cube< casacore::Complex > & | coeffs, | ||
const casacore::Cube< casacore::Bool > & | coeffsOK, | ||
const casacore::Bool | doSubtraction = true , |
||
const casacore::Bool | squawk = true |
||
) |
Apply the continuum estimate in coeffs (from fit) to vb.
The affected column of vb is chosen by whichcol, which must be exactly one of casacore::MS::DATA, casacore::MS::MODEL_DATA, or casacore::MS::CORRECTED_DATA lest an exception will be thrown. If doSubtraction is true, vb becomes the line estimate. Otherwise it is replaced with the continuum estimate. Returns false if it detects an error, true otherwise. squawk=true increases the potential number of warnings sent to the logger.
casacore::Bool casa::VBContinuumSubtractor::apply2 | ( | vi::VisBuffer2 & | vb, |
casacore::Cube< casacore::Complex > & | Vout, | ||
const casacore::Cube< casacore::Complex > & | coeffs, | ||
const casacore::Cube< casacore::Bool > & | coeffsOK, | ||
const casacore::Bool | doSubtraction = true , |
||
const casacore::Bool | squawk = true |
||
) |
coeffs | const casacore::MS::PredefinedColumns whichcol, |
casacore::Bool casa::VBContinuumSubtractor::areFreqsInBounds | ( | VisBuffer & | vb, |
const casacore::Bool | squawk | ||
) | const |
Returns whether or not vb's frequencies are within the bounds used for the continuum fit.
If not, and squawk is true, a warning will be sent to the logger. (Extrapolation is allowed, just not recommended.)
casacore::Bool casa::VBContinuumSubtractor::areFreqsInBounds | ( | vi::VisBuffer2 & | vb, |
const casacore::Bool | squawk | ||
) | const |
|
inline |
Definition at line 221 of file VBContinuumSubtractor.h.
References hifreq_p, and midfreq_p.
Referenced by setScalingFreqs().
|
inline |
Definition at line 211 of file VBContinuumSubtractor.h.
References fitorder_p, ncorr_p, nHashes_p, and casacore::Cube< T >::shape().
|
private |
Can the fit be applied to vb? If not and squawk is true, send a severe message to os.
|
private |
void casa::VBContinuumSubtractor::fit | ( | VisBuffGroupAcc & | vbga, |
const casacore::Int | fitorder, | ||
casacore::MS::PredefinedColumns | whichcol, | ||
casacore::Cube< casacore::Complex > & | coeffs, | ||
casacore::Cube< casacore::Bool > & | coeffsOK, | ||
const casacore::Bool | doInit = false , |
||
const casacore::Bool | doResize = false , |
||
const casacore::Bool | squawk = true |
||
) |
Makes the continuum estimate by fitting a frequency polynomial of order fitorder to the data in vbga.
It sets the low and high frequencies used for scaling the frequencies in the polynomial to the min and max frequencies in vbga. casacore::Input: vbga, The data fitorder, e.g. 2 for a + bf + cf**2 doInit, if true call initFromVBGA(vbga) doResize if true set coeffs and coeffsOK to the right shape. Output (these will be resized): coeffs: casacore::Polynomial coefficients for the continuum, indexed by (corr, order, hash(ant1, ant2). coeffsOK: and whether or not they're usable.
|
inline |
Definition at line 179 of file VBContinuumSubtractor.h.
References hifreq_p.
|
inline |
Definition at line 178 of file VBContinuumSubtractor.h.
References lofreq_p.
|
inline |
the casacore::MS def'n v.2.
Definition at line 181 of file VBContinuumSubtractor.h.
References maxAnt_p.
|
static |
Fills minfreq and maxfreq with the minimum and maximum frequencies (in Hz, acc.
to the casacore::MS def'n v.2) of vb (not the continuum fit!). If you want to get the extreme frequencies over a set of VisBuffers, set initialize to false and initialize minfreq and maxfreq yourself to DBL_MAX and -1.0, respectively.
|
static |
|
inline |
These are provided for the calibration framework so that a VBContinuumSubtractor can be c'ted from a VisBuffGroupAcc, make a continuum fit, write its results to a caltable, destroyed, and then later another one can be c'ted from the caltable and apply the fit to a VisBuffer.
Obviously it'd be safer and faster to use the same VBContinuumSubtractor for fitting and application, but the rest of CASA isn't ready for that yet (3/7/2011).
Definition at line 176 of file VBContinuumSubtractor.h.
References fitorder_p.
|
inline |
The total number of input channels that will be looked at (including masked ones!)
Definition at line 185 of file VBContinuumSubtractor.h.
References totnumchan_p.
|
inlineprivate |
Compute baseline (row) index in coeffs_p for (ant1, ant2).
It ASSUMES that ant1 and ant2 are both <= maxAnt_p.
Definition at line 248 of file VBContinuumSubtractor.h.
References maxAnt_p.
void casa::VBContinuumSubtractor::init | ( | const casacore::IPosition & | shp, |
const casacore::uInt | maxAnt, | ||
const casacore::uInt | totnumchan, | ||
const casacore::Double | lof, | ||
const casacore::Double | hif | ||
) |
Set the # of correlations and fitorder from shp, the total number of input channels to look at (including masked ones!), and the low and high scaling frequencies.
casacore::Bool casa::VBContinuumSubtractor::initFromVBGA | ( | VisBuffGroupAcc & | vbga | ) |
Set the low and high frequencies, and #s of correlations, antennas, and channels from vbga.
Returns false if vbga is empty.
|
private |
Disable default copying, and assignment.
void casa::VBContinuumSubtractor::resize | ( | casacore::Cube< casacore::Complex > & | coeffs, |
casacore::Cube< casacore::Bool > & | coeffsOK | ||
) | const |
A convenience function for prepping coeffs and coeffsOK to hold the polynomial coefficients and their validities.
|
inline |
Set the maximum number of antennas (actually, 1 + the maximum antenna number).
Definition at line 198 of file VBContinuumSubtractor.h.
|
inline |
Low (lof) and high (hif) frequencies, in Hz, used for renormalizing frequencies in the polynomials.
Definition at line 189 of file VBContinuumSubtractor.h.
References calcFreqScale(), freqscale_p, hifreq_p, lofreq_p, and midfreq_p.
|
inline |
Set the total number of input channels that will be looked at (including masked ones!)
Definition at line 205 of file VBContinuumSubtractor.h.
References totnumchan_p.
|
inline |
Definition at line 225 of file VBContinuumSubtractor.h.
|
private |
Definition at line 266 of file VBContinuumSubtractor.h.
|
private |
VisBuffGroupAcc& vbga_p; // Holds the VisBuffers.
Definition at line 254 of file VBContinuumSubtractor.h.
Referenced by checkSize(), and getOrder().
|
private |
Definition at line 259 of file VBContinuumSubtractor.h.
Referenced by setScalingFreqs().
|
private |
Definition at line 257 of file VBContinuumSubtractor.h.
Referenced by calcFreqScale(), getHighFreq(), and setScalingFreqs().
|
private |
Definition at line 256 of file VBContinuumSubtractor.h.
Referenced by getLowFreq(), and setScalingFreqs().
|
private |
Definition at line 260 of file VBContinuumSubtractor.h.
Referenced by getMaxAntNum(), hashFunction(), and setNAnt().
|
private |
Definition at line 258 of file VBContinuumSubtractor.h.
Referenced by calcFreqScale(), and setScalingFreqs().
|
private |
Definition at line 263 of file VBContinuumSubtractor.h.
Referenced by checkSize().
|
private |
used with the fits.
-1 if not ready.
Definition at line 262 of file VBContinuumSubtractor.h.
Referenced by checkSize(), and setNAnt().
|
private |
Definition at line 264 of file VBContinuumSubtractor.h.
Referenced by getTotNumChan(), and setTotNumChan().
|
private |
Definition at line 268 of file VBContinuumSubtractor.h.
Referenced by setTVIDebug().