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.
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);
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).
Member Description
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. 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 fitProfiles (MaskedLattice<Float>* pOutFit, MaskedLattice<Float>* pOutResid, MaskedLattice<Float>& in, Lattice<Float>* pSigma, LinearFit<Float>& fitter, uInt axis, Bool showProgress=False)