Isis Developer Reference
Isis::ZeroBufferFit Class Reference

Computes non-linear lsq fit of HiRISE Drift (Zd module) More...

#include <ZeroBufferFit.h>

Inheritance diagram for Isis::ZeroBufferFit:
Inheritance graph
Collaboration diagram for Isis::ZeroBufferFit:
Collaboration graph

Public Types

typedef TNT::Array1D< double > NLVector
 
typedef TNT::Array2D< double > NLMatrix
 

Public Member Functions

 ZeroBufferFit (const HiCalConf &conf)
 Compute second level drift correction (Zf module)
 
virtual ~ZeroBufferFit ()
 Destructor.
 
void setBin (int bin)
 Set binning/summing mode.
 
void setLineTime (double ltime)
 Set scan line time.
 
int size () const
 Returns the size of the data buffer.
 
int nSize () const
 Returns the size of the fitted buffer.
 
int nParms () const
 Number of parameter to be fitted.
 
void setabsErr (double absError)
 Sets the absolute error parameter.
 
void setrelErr (double relError)
 Sets the relative error parameter

 
double absErr () const
 Returns the current value of the absolute error.
 
double relErr () const
 Returns the current value of the relative error.
 
HiVector Solve (const HiVector &d)
 Compute non-linear fit to (typically) ZeroBufferSmooth module.
 
NLVector guess ()
 Compute the initial guess of the fit.
 
int checkIteration (const int Iter, const NLVector &fitcoefs, const NLVector &uncerts, double cplxconj, int Istatus)
 Computes the interation check for convergence.
 
NLVector f_x (const NLVector &a)
 Computes the function value at the current iteration.
 
NLMatrix df_x (const NLVector &a)
 Computes the first derivative of the function at the current iteration.
 
double Chisq () const
 Returns the Chi-Square value of the fit solution.
 
int DoF () const
 Returns the Degrees of Freedom.
 
HiVector Yfit () const
 Computes the solution vector using current coefficents.
 
HiVector Normalize (const HiVector &v)
 Compute normalized solution vector from result.
 
void setMaxIters (int m)
 Sets the maximum number of iterations.
 
int maxIters () const
 Maximum number iterations for valid solution.
 
int curvefit ()
 
int status () const
 Return status of last fit processing.
 
bool success () const
 Determine success from last fit processing.
 
bool success (int status) const
 Check status for success of the given condition

 
std::string statusstr () const
 Return error message pertaining to last fit procesing.
 
std::string statusstr (int status) const
 Return error message given status condition.
 
NLVector coefs () const
 Return coefficients from last fit processing.
 
NLVector uncert () const
 Return uncertainties from last fit processing.
 
int nIterations () const
 Return number of iterations from last fit processing.
 
QString name () const
 Returns name of component.
 
QString getcsvFile () const
 Returns expanded name of last CSV file loaded by loadCsv.
 
virtual void Process (const Module &c)
 Invokes the process method on the Module vector.
 
virtual void Process (const HiVector &v)
 Default processing behavior makes a reference copy of data array.
 
HiVector loadCsv (const QString &csvBase, const HiCalConf &conf, const DbProfile &prof, const int &elements=0)
 Provide generic loading of CSV file for all modules.
 
const HiVectorref () const
 Return data via a const reference.
 
double operator() (int index) const
 Return individual element of the data vector.
 
const HiHistoryHistory () const
 Return recorded history of events.
 
virtual void record (PvlGroup &pvl, const QString keyname="ModuleHistory") const
 Record history in Pvl group object.
 
void Dump (const QString &fname) const
 Dumps the component to a specified file.
 

Protected Types

enum  { DefaultWidth = 10 , DefaultPrecision = 6 }
 

Protected Member Functions

void Terminate (const std::string &message="")
 
void Abort (const std::string &reason="")
 
bool doContinue () const
 
QString formatDbl (const double &value) const
 Properly format values that could be special pixels.
 

Protected Attributes

QString _name
 Name of component.
 
QString _csvFile
 Fully expanded name of CSV file if present.
 
HiHistory _history
 Hierarchial component history.
 
int _fmtWidth
 Default field with of double.
 
int _fmtPrecision
 Default field with of double.
 

Detailed Description

Computes non-linear lsq fit of HiRISE Drift (Zd module)

This class is best used with individual HiRISE images as the number of lines is critical to proper use. It is best applied by getting the buffer as a reference and applying it during systematic processing.

This class models the drift correction using the Levenberg-Marquardt algorithm.

Author
2007-11-07 Kris Becker

Member Typedef Documentation

◆ NLMatrix

typedef TNT::Array2D<double> Isis::NonLinearLSQ::NLMatrix
inherited

◆ NLVector

typedef TNT::Array1D<double> Isis::NonLinearLSQ::NLVector
inherited

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protectedinherited
Enumerator
DefaultWidth 
DefaultPrecision 

Constructor & Destructor Documentation

◆ ZeroBufferFit()

Isis::ZeroBufferFit::ZeroBufferFit ( const HiCalConf & conf)

◆ ~ZeroBufferFit()

virtual Isis::ZeroBufferFit::~ZeroBufferFit ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ Abort()

void Isis::NonLinearLSQ::Abort ( const std::string & reason = "")
protectedinherited

◆ absErr()

double Isis::ZeroBufferFit::absErr ( ) const
inlinevirtual

Returns the current value of the absolute error.

Reimplemented from Isis::NonLinearLSQ.

◆ checkIteration()

int Isis::ZeroBufferFit::checkIteration ( const int Iter,
const NLVector & fitcoefs,
const NLVector & uncerts,
double cplxconj,
int Istatus )
virtual

Computes the interation check for convergence.

Parameters
IterCurrent iteration
fitcoefsVector of current fit coefficients
uncertsUncertainties
cplxconjComplex conjugate of the current iteration
IstatusState of current iteration
Returns
int Simply passes on the Istatus value

Reimplemented from Isis::NonLinearLSQ.

◆ Chisq()

double Isis::ZeroBufferFit::Chisq ( ) const
inline

Returns the Chi-Square value of the fit solution.

Referenced by Solve().

◆ coefs()

NLVector Isis::NonLinearLSQ::coefs ( ) const
inlineinherited

Return coefficients from last fit processing.

Referenced by Solve().

◆ curvefit()

◆ df_x()

NonLinearLSQ::NLMatrix Isis::ZeroBufferFit::df_x ( const NLVector & a)
virtual

Computes the first derivative of the function at the current iteration.

Implements Isis::NonLinearLSQ.

◆ doContinue()

bool Isis::NonLinearLSQ::doContinue ( ) const
inlineprotectedinherited

◆ DoF()

int Isis::ZeroBufferFit::DoF ( ) const
inline

Returns the Degrees of Freedom.

References nParms(), and nSize().

Referenced by Solve().

◆ Dump()

void Isis::Module::Dump ( const QString & fname) const
inlineinherited

Dumps the component to a specified file.

Parameters
fnameName of file to dump contents to

References _FILEINFO_, and Isis::IException::User.

◆ f_x()

NonLinearLSQ::NLVector Isis::ZeroBufferFit::f_x ( const NLVector & a)
virtual

Computes the function value at the current iteration.

Implements Isis::NonLinearLSQ.

◆ formatDbl()

QString Isis::Module::formatDbl ( const double & value) const
inlineprotectedinherited

Properly format values that could be special pixels.

This method applies ISIS special pixel value conventions to properly print pixel values.

Parameters
[in](double)value Input value to test for specialness and print as requested by caller
[in](int)width Width of field in which to print the value
[in](int)prec Precision used to format the value
Returns
(string) Formatted double value

References Isis::Module::_fmtPrecision, Isis::Module::_fmtWidth, Isis::IsSpecial(), and Isis::PixelToString().

Referenced by Isis::Module::printOn().

◆ getcsvFile()

QString Isis::Module::getcsvFile ( ) const
inlineinherited

Returns expanded name of last CSV file loaded by loadCsv.

References Isis::Module::_csvFile.

◆ guess()

NonLinearLSQ::NLVector Isis::ZeroBufferFit::guess ( )
virtual

Compute the initial guess of the fit.

This method provides the non-linear fit with an initial guess of the solution. It involves a linear fit to the latter half of the data to provide the first two coefficents, the difference of the averages of the residuals at both ends of the data set and 5 times the last line time as the final (fourth) element...a bit involved really.

Returns
NLVector 4-element vector of the initial guess coefficients

Implements Isis::NonLinearLSQ.

References Isis::Module::_history, Isis::HiHistory::add(), and Isis::ToString().

◆ History()

const HiHistory & Isis::Module::History ( ) const
inlineinherited

Return recorded history of events.

References Isis::Module::_history.

◆ loadCsv()

HiVector Isis::Module::loadCsv ( const QString & csvBase,
const HiCalConf & conf,
const DbProfile & prof,
const int & elements = 0 )
inlineinherited

Provide generic loading of CSV file for all modules.

This method provides generalized access to CSV files through the standardized format.

Author
Kris Becker - 4/16/2010
Parameters
cvsBaseName of base keyword for CSV file
confConfiguration parameters
profModule profile parameters
samplesNumber of expect elements to be read from CSV file
Returns
HiVector

References Isis::Module::_csvFile, and Isis::Module::_history.

◆ maxIters()

int Isis::NonLinearLSQ::maxIters ( ) const
inlineinherited

Maximum number iterations for valid solution.

Returns
int Maximum resolutions

Referenced by ZeroBufferFit().

◆ name()

QString Isis::Module::name ( ) const
inlineinherited

Returns name of component.

References Isis::Module::_name.

◆ nIterations()

int Isis::NonLinearLSQ::nIterations ( ) const
inlineinherited

Return number of iterations from last fit processing.

Referenced by Solve().

◆ Normalize()

HiVector Isis::ZeroBufferFit::Normalize ( const HiVector & v)

Compute normalized solution vector from result.

References Isis::Module::_history, Isis::HiHistory::add(), and Isis::ToString().

◆ nParms()

int Isis::ZeroBufferFit::nParms ( ) const
inlinevirtual

Number of parameter to be fitted.

This is the number of parameters that ZeroBufferFit needs to fit. This method is a requirement of the NonLinearLSQ class.

Returns
int Number of parameter to fit

Implements Isis::NonLinearLSQ.

Referenced by DoF().

◆ nSize()

int Isis::ZeroBufferFit::nSize ( ) const
inlinevirtual

Returns the size of the fitted buffer.

Important: This returns the size of the buffer being fitted and not the size of original data buffer. This is a requirement of the NonLinearLSQ class. USE WITH CAUTION!

Returns
int Size of buffer being fitted

Implements Isis::NonLinearLSQ.

Referenced by DoF().

◆ operator()()

double Isis::Module::operator() ( int index) const
inlineinherited

Return individual element of the data vector.

References Isis::Module::_data.

◆ Process() [1/2]

virtual void Isis::Module::Process ( const HiVector & v)
inlinevirtualinherited

Default processing behavior makes a reference copy of data array.

Reimplemented in Isis::LowPassFilter, and Isis::SplineFill.

References Isis::Module::_data.

◆ Process() [2/2]

virtual void Isis::Module::Process ( const Module & c)
inlinevirtualinherited

Invokes the process method on the Module vector.

References Isis::Module::Process().

Referenced by Isis::Module::Process().

◆ record()

virtual void Isis::Module::record ( PvlGroup & pvl,
const QString keyname = "ModuleHistory" ) const
inlinevirtualinherited

Record history in Pvl group object.

References Isis::Module::_history, and Isis::HiHistory::makekey().

◆ ref()

const HiVector & Isis::Module::ref ( ) const
inlineinherited

Return data via a const reference.

References Isis::Module::_data.

◆ relErr()

double Isis::ZeroBufferFit::relErr ( ) const
inlinevirtual

Returns the current value of the relative error.

Reimplemented from Isis::NonLinearLSQ.

◆ setabsErr()

void Isis::ZeroBufferFit::setabsErr ( double absError)
inline

Sets the absolute error parameter.

◆ setBin()

void Isis::ZeroBufferFit::setBin ( int bin)
inline

Set binning/summing mode.

Parameters
binSumming mode of observatio

References Isis::HiLineTimeEqn::setBin().

◆ setLineTime()

void Isis::ZeroBufferFit::setLineTime ( double ltime)
inline

Set scan line time.

Parameters
ltimeScan line time

References Isis::HiLineTimeEqn::setLineTime().

◆ setMaxIters()

void Isis::NonLinearLSQ::setMaxIters ( int m)
inlineinherited

Sets the maximum number of iterations.

Parameters
mUser provides the maximum number iterations

Referenced by ZeroBufferFit().

◆ setrelErr()

void Isis::ZeroBufferFit::setrelErr ( double relError)
inline

Sets the relative error parameter

◆ size()

int Isis::ZeroBufferFit::size ( ) const
inline

Returns the size of the data buffer.

This is the size of the original data buffer.

See also
nSize()
Returns
int Size of the input buffer

◆ Solve()

HiVector Isis::ZeroBufferFit::Solve ( const HiVector & d)

Compute non-linear fit to (typically) ZeroBufferSmooth module.

This method computes a non-linear fit to the result of the ZeroBufferSmooth module. There are several things that can go wrong and some config conditions that dictate behavior of this process.

Should the image be a short exposure (i.e., not many lines) the fit will not succeed so it simply skips this entire module providing the input result (d) as the solution. This wil also occur when the user has selected the skip option for the module.

A fit is attempted on the ZeroBufferSmooth data. The non-linear solution must converge within the specifed number of iterations (MaximumIterations) or a polynomial fit will be used in leui of a valid solution.

Parameters
dZeroBufferSmooth data solution as input to this method
Returns
HiVector Returns result of the processing

References Isis::Module::_history, Isis::HiHistory::add(), Chisq(), Isis::NonLinearLSQ::coefs(), Isis::NonLinearLSQ::curvefit(), DoF(), Isis::NonLinearLSQ::nIterations(), Isis::NonLinearLSQ::statusstr(), Isis::NonLinearLSQ::success(), Isis::ToString(), Isis::NonLinearLSQ::uncert(), and Yfit().

◆ status()

int Isis::NonLinearLSQ::status ( ) const
inlineinherited

Return status of last fit processing.

Referenced by Isis::NonLinearLSQ::statusstr(), and Isis::NonLinearLSQ::success().

◆ statusstr() [1/2]

std::string Isis::NonLinearLSQ::statusstr ( ) const
inlineinherited

Return error message pertaining to last fit procesing.

Referenced by Solve().

◆ statusstr() [2/2]

std::string Isis::NonLinearLSQ::statusstr ( int status) const
inlineinherited

Return error message given status condition.

References Isis::NonLinearLSQ::status().

◆ success() [1/2]

bool Isis::NonLinearLSQ::success ( ) const
inlineinherited

Determine success from last fit processing.

Referenced by Solve().

◆ success() [2/2]

bool Isis::NonLinearLSQ::success ( int status) const
inlineinherited

Check status for success of the given condition

References Isis::NonLinearLSQ::status().

◆ Terminate()

void Isis::NonLinearLSQ::Terminate ( const std::string & message = "")
protectedinherited

◆ uncert()

NLVector Isis::NonLinearLSQ::uncert ( ) const
inlineinherited

Return uncertainties from last fit processing.

Referenced by Solve().

◆ Yfit()

HiVector Isis::ZeroBufferFit::Yfit ( ) const

Computes the solution vector using current coefficents.

Referenced by Solve().

Member Data Documentation

◆ _csvFile

QString Isis::Module::_csvFile
protectedinherited

Fully expanded name of CSV file if present.

Referenced by Isis::Module::getcsvFile(), and Isis::Module::loadCsv().

◆ _fmtPrecision

int Isis::Module::_fmtPrecision
protectedinherited

Default field with of double.

Referenced by Isis::Module::formatDbl().

◆ _fmtWidth

int Isis::Module::_fmtWidth
protectedinherited

Default field with of double.

Referenced by Isis::Module::formatDbl().

◆ _history

◆ _name

QString Isis::Module::_name
protectedinherited

Name of component.

Referenced by Isis::Module::name().


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