USGS

Isis 3.0 Application Source Code Reference

Home

ZeroBufferFit Class Reference

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

#include <ZeroBufferFit.h>

Public Member Functions

 ZeroBufferFit (const HiCalConf &conf)
 Compute second level drift correction (Zf module) More...
 
virtual ~ZeroBufferFit ()
 Destructor. More...
 
void setBin (int bin)
 Set binning/summing mode. More...
 
void setLineTime (double ltime)
 Set scan line time. More...
 
int size () const
 Returns the size of the data buffer. More...
 
int nSize () const
 Returns the size of the fitted buffer. More...
 
int nParms () const
 Number of parameter to be fitted. More...
 
void setabsErr (double absError)
 Sets the absolute error parameter. More...
 
void setrelErr (double relError)
 Sets the relative error parameter. More...
 
double absErr () const
 Returns the current value of the absolute error. More...
 
double relErr () const
 Returns the current value of the relative error. More...
 
HiVector Solve (const HiVector &d)
 Compute non-linear fit to (typically) ZeroBufferSmooth module. More...
 
NLVector guess ()
 Compute the initial guess of the fit. More...
 
int checkIteration (const int Iter, const NLVector &fitcoefs, const NLVector &uncerts, double cplxconj, int Istatus)
 Computes the interation check for convergence. More...
 
NLVector f_x (const NLVector &a)
 Computes the function value at the current iteration. More...
 
NLMatrix df_x (const NLVector &a)
 Computes the first derivative of the function at the current iteration. More...
 
double Chisq () const
 Returns the Chi-Square value of the fit solution. More...
 
int DoF () const
 Returns the Degrees of Freedom. More...
 
HiVector Yfit () const
 Computes the solution vector using current coefficents. More...
 
HiVector Normalize (const HiVector &v)
 Compute normalized solution vector from result. More...
 
 ZeroBufferFit (const HiCalConf &conf)
 
virtual ~ZeroBufferFit ()
 Destructor. More...
 
void setBin (int bin)
 Set binning/summing mode. More...
 
void setLineTime (double ltime)
 Set scan line time. More...
 
int size () const
 Returns the size of the data buffer. More...
 
int nSize () const
 Returns the size of the fitted buffer. More...
 
int nParms () const
 Number of parameter to be fitted. More...
 
void setabsErr (double absError)
 Sets the absolute error parameter. More...
 
void setrelErr (double relError)
 Sets the relative error parameter. More...
 
double absErr () const
 Returns the current value of the absolute error. More...
 
double relErr () const
 Returns the current value of the relative error. More...
 
HiVector Solve (const HiVector &d)
 
NLVector guess ()
 
int checkIteration (const int Iter, const NLVector &fitcoefs, const NLVector &uncerts, double cplxconj, int Istatus)
 Default interation test simply returns input status. More...
 
NLVector f_x (const NLVector &a)
 
NLMatrix df_x (const NLVector &a)
 
double Chisq () const
 Returns the Chi-Square value of the fit solution. More...
 
int DoF () const
 Returns the Degrees of Freedom. More...
 
HiVector Yfit () const
 
HiVector Normalize (const HiVector &v)
 
- Public Member Functions inherited from NonLinearLSQ
 NonLinearLSQ ()
 
virtual ~NonLinearLSQ ()
 Destructor. More...
 
void setMaxIters (int m)
 Sets the maximum number of iterations. More...
 
int maxIters () const
 Maximum number iterations for valid solution. More...
 
int curvefit ()
 
int status () const
 Return status of last fit processing. More...
 
bool success () const
 Determine success from last fit processing. More...
 
bool success (int status) const
 Check status for success of the given condition. More...
 
QString statusstr () const
 Return error message pertaining to last fit procesing. More...
 
QString statusstr (int status) const
 Return error message given status condition. More...
 
NLVector coefs () const
 Return coefficients from last fit processing. More...
 
NLVector uncert () const
 Return uncertainties from last fit processing. More...
 
int nIterations () const
 Return number of iterations from last fit processing. More...
 
 NonLinearLSQ ()
 
virtual ~NonLinearLSQ ()
 Destructor. More...
 
void setMaxIters (int m)
 Sets the maximum number of iterations. More...
 
int maxIters () const
 Maximum number iterations for valid solution. More...
 
int curvefit ()
 
int status () const
 Return status of last fit processing. More...
 
bool success () const
 Determine success from last fit processing. More...
 
bool success (int status) const
 Check status for success of the given condition. More...
 
std::string statusstr () const
 Return error message pertaining to last fit procesing. More...
 
std::string statusstr (int status) const
 Return error message given status condition. More...
 
NLVector coefs () const
 Return coefficients from last fit processing. More...
 
NLVector uncert () const
 Return uncertainties from last fit processing. More...
 
int nIterations () const
 Return number of iterations from last fit processing. More...
 
- Public Member Functions inherited from Module
 Module ()
 
 Module (const QString &name)
 
 Module (const QString &name, const HiHistory &history)
 
 Module (const QString &name, const Module &c)
 
 Module (const Module &c)
 
virtual ~Module ()
 Destructor. More...
 
QString name () const
 Returns name of component. More...
 
QString getcsvFile () const
 Returns expanded name of last CSV file loaded by loadCsv. More...
 
int size () const
 Returns the size (number of elements) of data array. More...
 
virtual void Process (const Module &c)
 Invokes the process method on the Module vector. More...
 
virtual void Process (const HiVector &v)
 Default processing behavior makes a reference copy of data array. More...
 
HiVector loadCsv (const QString &csvBase, const HiCalConf &conf, const DbProfile &prof, const int &elements=0)
 Provide generic loading of CSV file for all modules. More...
 
const HiVectorref () const
 Return data via a const reference. More...
 
double operator() (int index) const
 Return individual element of the data vector. More...
 
const HiHistoryHistory () const
 Return recorded history of events. More...
 
virtual void record (PvlGroup &pvl, const QString keyname="ModuleHistory") const
 Record history in Pvl group object. More...
 
void Dump (const QString &fname) const
 Dumps the component to a specified file. More...
 
 Module ()
 
 Module (const QString &name)
 
 Module (const QString &name, const HiHistory &history)
 
 Module (const QString &name, const Module &c)
 
 Module (const Module &c)
 
virtual ~Module ()
 Destructor. More...
 
QString name () const
 Returns name of component. More...
 
QString getcsvFile () const
 Returns expanded name of last CSV file loaded by loadCsv. More...
 
int size () const
 Returns the size (number of elements) of data array. More...
 
virtual void Process (const Module &c)
 Invokes the process method on the Module vector. More...
 
virtual void Process (const HiVector &v)
 Default processing behavior makes a reference copy of data array. More...
 
HiVector loadCsv (const QString &csvBase, const HiCalConf &conf, const DbProfile &prof, const int &elements=0)
 Provide generic loading of CSV file for all modules. More...
 
const HiVectorref () const
 Return data via a const reference. More...
 
double operator() (int index) const
 Return individual element of the data vector. More...
 
const HiHistoryHistory () const
 Return recorded history of events. More...
 
virtual void record (PvlGroup &pvl, const QString keyname="ModuleHistory") const
 Record history in Pvl group object. More...
 
void Dump (const QString &fname) const
 Dumps the component to a specified file. More...
 

Additional Inherited Members

- Public Types inherited from NonLinearLSQ
typedef TNT::Array1D< double > NLVector
 
typedef TNT::Array2D< double > NLMatrix
 
typedef TNT::Array1D< double > NLVector
 
typedef TNT::Array2D< double > NLMatrix
 
- Protected Types inherited from Module
enum  { DefaultWidth = 10, DefaultPrecision = 6 }
 
enum  { DefaultWidth = 10, DefaultPrecision = 6 }
 
- Protected Member Functions inherited from NonLinearLSQ
void Terminate (const QString &message="")
 
void Abort (const QString &reason="")
 
bool doContinue () const
 
void Terminate (const std::string &message="")
 
void Abort (const std::string &reason="")
 
bool doContinue () const
 
- Protected Member Functions inherited from Module
QString formatDbl (const double &value) const
 Properly format values that could be special pixels. More...
 
QString formatDbl (const double &value) const
 Properly format values that could be special pixels. More...
 
- Protected Attributes inherited from Module
QString _name
 Name of component. More...
 
QString _csvFile
 Fully expanded name of CSV file if present. More...
 
HiVector _data
 Data vector. More...
 
HiHistory _history
 Hierarchial component history. More...
 
int _fmtWidth
 Default field with of double. More...
 
int _fmtPrecision
 Default field with of double. More...
 

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

Definition at line 56 of file ZeroBufferFit.h.

Constructor & Destructor Documentation

ZeroBufferFit ( const HiCalConf &  conf)

Compute second level drift correction (Zf module)

This class provides the second level drift correction that is

Parameters
conf

Definition at line 53 of file ZeroBufferFit.cpp.

virtual ~ZeroBufferFit ( )
inlinevirtual

Destructor.

Definition at line 61 of file ZeroBufferFit.h.

ZeroBufferFit ( const HiCalConf &  conf)
virtual ~ZeroBufferFit ( )
inlinevirtual

Destructor.

Definition at line 61 of file ZeroBufferFit.h.

Member Function Documentation

void setBin ( int  bin)
inline

Set binning/summing mode.

Parameters
binSumming mode of observatio

Definition at line 68 of file ZeroBufferFit.h.

void setLineTime ( double  ltime)
inline

Set scan line time.

Parameters
ltimeScan line time

Definition at line 75 of file ZeroBufferFit.h.

int 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

Definition at line 85 of file ZeroBufferFit.h.

int 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 NonLinearLSQ.

Definition at line 98 of file ZeroBufferFit.h.

int 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 NonLinearLSQ.

Definition at line 108 of file ZeroBufferFit.h.

void setabsErr ( double  absError)
inline

Sets the absolute error parameter.

Definition at line 111 of file ZeroBufferFit.h.

void setrelErr ( double  relError)
inline

Sets the relative error parameter.

Definition at line 113 of file ZeroBufferFit.h.

double absErr ( ) const
inlinevirtual

Returns the current value of the absolute error.

Reimplemented from NonLinearLSQ.

Definition at line 115 of file ZeroBufferFit.h.

double relErr ( ) const
inlinevirtual

Returns the current value of the relative error.

Reimplemented from NonLinearLSQ.

Definition at line 117 of file ZeroBufferFit.h.

HiVector 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

Definition at line 106 of file ZeroBufferFit.cpp.

NonLinearLSQ::NLVector 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 NonLinearLSQ.

Definition at line 177 of file ZeroBufferFit.cpp.

int 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 NonLinearLSQ.

Definition at line 234 of file ZeroBufferFit.cpp.

NonLinearLSQ::NLVector f_x ( const NLVector a)
virtual

Computes the function value at the current iteration.

Implements NonLinearLSQ.

Definition at line 242 of file ZeroBufferFit.cpp.

NonLinearLSQ::NLMatrix df_x ( const NLVector a)
virtual

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

Implements NonLinearLSQ.

Definition at line 260 of file ZeroBufferFit.cpp.

double Chisq ( ) const
inline

Returns the Chi-Square value of the fit solution.

Definition at line 129 of file ZeroBufferFit.h.

int DoF ( ) const
inline

Returns the Degrees of Freedom.

Definition at line 131 of file ZeroBufferFit.h.

HiVector Yfit ( ) const

Computes the solution vector using current coefficents.

Definition at line 281 of file ZeroBufferFit.cpp.

HiVector Normalize ( const HiVector v)

Compute normalized solution vector from result.

Definition at line 297 of file ZeroBufferFit.cpp.

void setBin ( int  bin)
inline

Set binning/summing mode.

Parameters
binSumming mode of observatio

Definition at line 68 of file ZeroBufferFit.h.

void setLineTime ( double  ltime)
inline

Set scan line time.

Parameters
ltimeScan line time

Definition at line 75 of file ZeroBufferFit.h.

int 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

Definition at line 85 of file ZeroBufferFit.h.

int 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 NonLinearLSQ.

Definition at line 98 of file ZeroBufferFit.h.

int 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 NonLinearLSQ.

Definition at line 108 of file ZeroBufferFit.h.

void setabsErr ( double  absError)
inline

Sets the absolute error parameter.

Definition at line 111 of file ZeroBufferFit.h.

void setrelErr ( double  relError)
inline

Sets the relative error parameter.

Definition at line 113 of file ZeroBufferFit.h.

double absErr ( ) const
inlinevirtual

Returns the current value of the absolute error.

Reimplemented from NonLinearLSQ.

Definition at line 115 of file ZeroBufferFit.h.

double relErr ( ) const
inlinevirtual

Returns the current value of the relative error.

Reimplemented from NonLinearLSQ.

Definition at line 117 of file ZeroBufferFit.h.

HiVector Solve ( const HiVector d)
NLVector guess ( )
virtual

Implements NonLinearLSQ.

int checkIteration ( const int  Iter,
const NLVector fitcoefs,
const NLVector uncerts,
double  cplxconj,
int  Istatus 
)
virtual

Default interation test simply returns input status.

Reimplemented from NonLinearLSQ.

NLVector f_x ( const NLVector a)
virtual

Implements NonLinearLSQ.

NLMatrix df_x ( const NLVector a)
virtual

Implements NonLinearLSQ.

double Chisq ( ) const
inline

Returns the Chi-Square value of the fit solution.

Definition at line 129 of file ZeroBufferFit.h.

int DoF ( ) const
inline

Returns the Degrees of Freedom.

Definition at line 131 of file ZeroBufferFit.h.

HiVector Yfit ( ) const
HiVector Normalize ( const HiVector v)

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