Isis 3 Programmer Reference
GainLineDrift.h
Go to the documentation of this file.
1 #ifndef GainLineDrift_h
2 #define GainLineDrift_h
3 
26 #include <cmath>
27 #include <string>
28 #include <vector>
29 
30 #include "IString.h"
31 #include "HiCalTypes.h"
32 #include "HiCalUtil.h"
33 #include "HiCalConf.h"
34 #include "Module.h"
35 #include "FileName.h"
36 
37 #include "IException.h"
38 
39 namespace Isis {
54  class GainLineDrift : public Module {
55 
56  public:
57  // Constructors and Destructor
58  GainLineDrift() : Module("GainLineDrift") { }
59  GainLineDrift(const HiCalConf &conf) : Module("GainLineDrift") {
60  init(conf);
61  }
62 
64  virtual ~GainLineDrift() { }
65 
66  private:
67  std::string _gdfile;
68  int _ccd;
69  int _channel;
70  HiVector _coefs;
71 
72  void init(const HiCalConf &conf) {
73  _history.clear();
74  DbProfile prof = conf.getMatrixProfile();
75  _history.add("Profile["+ prof.Name()+"]");
76  _ccd = CpmmToCcd(ToInteger(prof("CpmmNumber")));
77  _channel = ToInteger(prof("ChannelNumber"));
78 
79  // Get parameters from gainVline coefficients file
80  _coefs = loadCsv("LineGainDrift", conf, prof, 4);
81  _history.add("Coefs["+ToString(_coefs[0])+ ","+
82  ToString(_coefs[1])+ ","+
83  ToString(_coefs[2])+ ","+
84  ToString(_coefs[3])+ "]");
85 
86  int bin = ToInteger(prof("Summing"));
87  double linetime = ToDouble(prof("ScanExposureDuration"));
88  HiLineTimeEqn timet(bin, linetime);
89  int nlines = ToInteger(prof("Lines"));
90 
91  HiVector gainV(nlines);
92  for ( int i = 0 ; i < nlines ; i++ ) {
93  double lt = timet(i);
94  gainV[i] = _coefs[0] + (_coefs[1] * lt) +
95  _coefs[2] * exp(_coefs[3] * lt);
96  }
97 
98  _data = gainV;
99  return;
100  }
101 
102  };
103 
104 } // namespace Isis
105 #endif
int CpmmToCcd(int cpmm)
Convert HiRISE Cpmm number to Ccd number.
Definition: HiCalUtil.h:85
Compute HiRISE line times.
Definition: HiCalUtil.h:375
HiVector _data
Data vector.
Definition: Module.h:166
HiHistory _history
Hierarchial component history.
Definition: Module.h:167
virtual ~GainLineDrift()
Destructor.
Definition: GainLineDrift.h:64
HiVector loadCsv(const QString &csvBase, const HiCalConf &conf, const DbProfile &prof, const int &elements=0)
Provide generic loading of CSV file for all modules.
Definition: Module.h:116
A DbProfile is a container for access parameters to a database.
Definition: DbProfile.h:65
int ToInteger(const T &value)
Helper function to convert values to Integers.
Definition: HiCalUtil.h:236
Module manages HiRISE calibration vectors from various sources.
Definition: Module.h:54
double ToDouble(const T &value)
Helper function to convert values to doubles.
Definition: HiCalUtil.h:248
Computes a gain correction for each line (Zg Module)
Definition: GainLineDrift.h:54
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
QString Name() const
Returns the name of this property.
Definition: DbProfile.h:118
QString ToString(const T &value)
Helper function to convert values to strings.
Definition: HiCalUtil.h:260
TNT::Array1D< double > HiVector
1-D Buffer
Definition: HiCalTypes.h:40