Isis 3 Programmer Reference
ZeroBufferFit.h
Go to the documentation of this file.
1 #ifndef ZeroBufferFit_h
2 #define ZeroBufferFit_h
3 
26 #include <string>
27 #include <vector>
28 
29 #include "HiCalTypes.h"
30 #include "HiCalUtil.h"
31 #include "HiCalConf.h"
32 #include "NonLinearLSQ.h"
33 #include "Module.h"
34 #include "IException.h"
35 
36 namespace Isis {
37 
56  class ZeroBufferFit : public NonLinearLSQ, public Module {
57 
58  public:
59  ZeroBufferFit(const HiCalConf &conf);
61  virtual ~ZeroBufferFit() { }
62 
68  void setBin(int bin) { _timet.setBin(bin); }
69 
75  void setLineTime(double ltime) { _timet.setLineTime(ltime); }
76 
85  inline int size() const { return (_data.dim()); }
86 
98  int nSize() const { return (_b2.dim()); }
99 
108  int nParms() const { return (4); }
109 
111  void setabsErr(double absError) { _absErr = absError; }
113  void setrelErr(double relError) { _relErr = relError; }
115  double absErr() const { return (_absErr); }
117  double relErr() const { return (_relErr); }
118 
119  HiVector Solve(const HiVector &d);
120  NLVector guess();
121  int checkIteration(const int Iter, const NLVector &fitcoefs,
122  const NLVector &uncerts, double cplxconj,
123  int Istatus);
124 
125  NLVector f_x(const NLVector &a);
126  NLMatrix df_x(const NLVector &a);
127 
129  double Chisq() const { return (_chisq); }
131  int DoF() const { return (nSize() - nParms()); }
132 
133  HiVector Yfit() const;
134  HiVector Normalize(const HiVector &v);
135 
136  private:
137  HiLineTimeEqn _timet; // This is the X data set
138  HiVector _data; // Typically will be the HiRISE buffer data
139  HiVector _b2; // Data buffer used in fitting
140  double _absErr; // Absolute error convergence test
141  double _relErr; // Relative error convergence test
142  double _maxLog; // Maximum log value to constrain
143  int _badLines; // Exclude lines at end of buffer
144  int _sWidth; // Width of guestimate filter
145  int _sIters; // Filter interations
146  bool _skipFit; // Skip fitting and pass input through
147  bool _useLinFit; // Use linear fit on failure of LM, else Zf
148  int _minLines; // Minimum number of lines to fit (Default: 100)
149  HiVector _cc; // Parameter of 2-D fit
150  HiVector _guess; // Initial guestimate of solutions
151  HiVector _coefs; // Coefficients of solution
152  HiVector _uncert; // Uncertanties
153  double _chisq; // ChiSq of NonLinear equation
154 
155  HiVector poly_fit(const HiVector &d, const double line0 = 0.0) const;
156  virtual void printOn(std::ostream &o) const;
158  int goodLines(const HiVector &d) const { return (d.dim() - _badLines); }
160  bool gotGoodLines(const HiVector &d) const {
161  return (goodLines(d) >= _minLines);
162  }
163  };
164 
165 } // namespace Isis
166 #endif
167 
168 
void setLineTime(double ltime)
Set scan line time.
Definition: ZeroBufferFit.h:75
HiVector Yfit() const
Computes the solution vector using current coefficents.
Compute HiRISE line times.
Definition: HiCalUtil.h:375
void setBin(int bin)
Set binning/summing mode.
Definition: ZeroBufferFit.h:68
HiVector poly_fit(const HiVector &d, const double line0=0.0) const
Compute a polyonomial fit using multivariate statistics.
int nSize() const
Returns the size of the fitted buffer.
Definition: ZeroBufferFit.h:98
int DoF() const
Returns the Degrees of Freedom.
void setrelErr(double relError)
Sets the relative error parameter.
NonLinearLSQ Computes a fit using a Levenberg-Marquardt algorithm.
Definition: NonLinearLSQ.h:57
HiVector Normalize(const HiVector &v)
Compute normalized solution vector from result.
Computes non-linear lsq fit of HiRISE Drift (Zd module)
Definition: ZeroBufferFit.h:56
int nParms() const
Number of parameter to be fitted.
int size() const
Returns the size of the data buffer.
Definition: ZeroBufferFit.h:85
int checkIteration(const int Iter, const NLVector &fitcoefs, const NLVector &uncerts, double cplxconj, int Istatus)
Computes the interation check for convergence.
double relErr() const
Returns the current value of the relative error.
virtual void printOn(std::ostream &o) const
Provides virtualized dump of data from this module.
ZeroBufferFit(const HiCalConf &conf)
Compute second level drift correction (Zf module)
Module manages HiRISE calibration vectors from various sources.
Definition: Module.h:54
double absErr() const
Returns the current value of the absolute error.
double Chisq() const
Returns the Chi-Square value of the fit solution.
bool gotGoodLines(const HiVector &d) const
Determines if the vector contains any valid lines.
NLMatrix df_x(const NLVector &a)
Computes the first derivative of the function at the current iteration.
void setabsErr(double absError)
Sets the absolute error parameter.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
int goodLines(const HiVector &d) const
Returns the number of good lines in the image.
NLVector f_x(const NLVector &a)
Computes the function value at the current iteration.
NLVector guess()
Compute the initial guess of the fit.
virtual ~ZeroBufferFit()
Destructor.
Definition: ZeroBufferFit.h:61
HiVector Solve(const HiVector &d)
Compute non-linear fit to (typically) ZeroBufferSmooth module.
TNT::Array1D< double > HiVector
1-D Buffer
Definition: HiCalTypes.h:40