casa
$Rev:20696$
|
Fit every line of pixels parallel to any axis in a Lattice. More...
#include <LatticeFit.h>
Static Public Member Functions | |
static uInt | fitProfiles (Lattice< Float > &outImage, Vector< Float > &fittedParameters, LinearFit< Float > &fitter, const Lattice< Float > &inImage, uInt whichAxis, const Vector< Bool > &fitMask, Bool returnResiduals) |
Fit baseline to lattice. | |
static uInt | fitProfiles (MaskedLattice< Float > *pOutFit, MaskedLattice< Float > *pOutResid, MaskedLattice< Float > &in, Lattice< Float > *pSigma, LinearFit< Float > &fitter, uInt axis, Bool showProgress=False) |
Fit baseline to MaskedLattice. |
Fit every line of pixels parallel to any axis in a Lattice.
For every line in the lattice parallel to axis number whichAxis
(often axis number 2, typically the frequency axis in a spectral line cube) independently fit the functions in fitter at the positions where fitMask
is true.
Suppose one wanted to subtract a linear polynomial from every spectrum (3d axis) in an image. One could do this as follows:
Image<Float> myImage("myimage"); // Get the image uInt nchan = myImage.shape()(2); // 0 relative axis number // Set up the fitter Polynomial<AutoDiff<Float> > linear(1); LinearFitSVD<Float> fitter; fitter.setFunction(linear); Vector<Float> fittedParameters, // Set up a mask indicating what channels we want to fit over. We want // to fit over all channels. Vector<Bool> fitMask(nchan); fitMask = True; // Do the fit. True means subtract the fit from the model. In this case, // We overwrite the input with the output. fitProfiles (myImage, fittedParameters,fitter, myImage, 2, fitMask, True);
Baseline fitting/continuum subtraction are important functions. This function essentially implements the IMLIN algorithm.
Definition at line 96 of file LatticeFit.h.
static uInt casa::LatticeFit::fitProfiles | ( | Lattice< Float > & | outImage, |
Vector< Float > & | fittedParameters, | ||
LinearFit< Float > & | fitter, | ||
const Lattice< Float > & | inImage, | ||
uInt | whichAxis, | ||
const Vector< Bool > & | fitMask, | ||
Bool | returnResiduals | ||
) | [static] |
Fit baseline to lattice.
Presently the fit parameters, other than the last one(s) in fitter, are lost. If returnResiduals
is True, return data-fit, otherwise return the fit. For baseline and continuum subtraction, returnResiduals would normally be True.
static uInt casa::LatticeFit::fitProfiles | ( | MaskedLattice< Float > * | pOutFit, |
MaskedLattice< Float > * | pOutResid, | ||
MaskedLattice< Float > & | in, | ||
Lattice< Float > * | pSigma, | ||
LinearFit< Float > & | fitter, | ||
uInt | axis, | ||
Bool | showProgress = False |
||
) | [static] |
Fit baseline to MaskedLattice.
Fit and residuals can be optionally written (leave pointers at zero to not write out these lattices) You can optionally specify a weights lattice (1.0 if not given).