Isis 3 Developer Reference
GainUnitConversion.h
Go to the documentation of this file.
1 #ifndef GainUnitConversion_h
2 #define GainUnitConversion_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 {
40 
54  class GainUnitConversion : public Module {
55 
56  public:
57  // Constructors and Destructor
58  GainUnitConversion() : Module("GainUnitConversion"), _units("DN") { }
59  GainUnitConversion(HiCalConf &conf, const QString &units) :
60  Module("GainUnitConversion"), _units(units) {
61  init(conf);
62  }
63 
65  virtual ~GainUnitConversion() { }
66 
67  private:
68  QString _units;
69 
70  void init(HiCalConf &conf) {
71  _history.clear();
72  DbProfile prof = conf.getMatrixProfile();
73  _history.add("Profile["+ prof.Name()+"]");
74 
75  double sed = ToDouble(prof("ScanExposureDuration")); // units = us
76  if ( IsEqual(_units, "IOF") ) {
77  // Add solar I/F correction parameters
78  double au = conf.sunDistanceAU();
79  _history.add("SunDist[" + ToString(au) + " (AU)]");
80  double suncorr = 1.5 / au;
81  suncorr *= suncorr;
82 
83  double zbin = ToDouble(prof("GainUnitConversionBinFactor"));
84  _history.add("GainUnitConversionBinFactor[" + ToString(zbin) + "]");
85 
86  double ztemp = getTempDepGain(conf, prof);
87  _history.add("ScanExposureDuration[" + ToString(sed) + "]");
88  double ziof = (zbin * ztemp) * (sed * 1.0e-6) * suncorr;
89  _data = HiVector(1, ziof);
90 
91  _history.add("I/F_Factor[" + ToString(ziof) + "]");
92  _history.add("Units[I/F]");
93  }
94  else if ( IsEqual(_units, "DN/US") ) {
95  // Ziof is a divisor in calibration equation
96  double ziof = sed;
97  _data = HiVector(1, ziof);
98  _history.add("ScanExposureDuration[" + ToString(sed) + "]");
99  _history.add("DN/uS_Factor[" + ToString(ziof) + "]");
100  _history.add("Units[DNs/microsecond]");
101  }
102  else {
103  // Units are already in DN
104  double ziof = 1.0;
105  _data = HiVector(1, ziof);
106  _history.add("DN_Factor[" + ToString(ziof) + "]");
107  _history.add("Units[DN]");
108  }
109 
110  return;
111  }
112 
122  double getTempDepGain(const HiCalConf &conf, const DbProfile &prof) {
123  double zgain = ToDouble(prof("FilterGainCorrection"));
124  _history.add("FilterGainCorrection[" + ToString(zgain) + "]");
125 
126  double fpa_py_temp = ToDouble(prof("FpaPositiveYTemperature"));
127  double fpa_my_temp = ToDouble(prof("FpaNegativeYTemperature"));
128  double T = (fpa_py_temp+fpa_my_temp) / 2.0;
129  _history.add("T(AveFpa_YTemp)[" + ToString(T) + "]");
130 
131  double baseT = ToDouble(prof("IoverFbasetemperature"));
132  _history.add("IoverFbasetemperature[" + ToString(baseT) + "]");
133 
134  double QEpcntC = ToDouble(prof("QEpercentincreaseperC"));
135  _history.add("QEpercentincreaseperC[" + ToString(QEpcntC) + "]");
136 
137  double absGainTdi = ToDouble(prof("AbsGain_TDI128"));
138  _history.add("AbsGain_TDI128[" + ToString(absGainTdi) + "]");
139 
140  double QETD = zgain * ( 1.0 + (T - baseT) * QEpcntC * absGainTdi);
141  _history.add("CalFactQETempDep[" + ToString(QETD) + "]");
142  return (QETD);
143  }
144 
145 
146  };
147 
148 } // namespace Isis
149 #endif
HiVector _data
Data vector.
Definition: Module.h:166
void clear()
Definition: HiCalTypes.h:78
HiHistory _history
Hierarchial component history.
Definition: Module.h:167
A DbProfile is a container for access parameters to a database.
Definition: DbProfile.h:65
bool IsEqual(const QString &v1, const QString &v2="TRUE")
Shortened string equality test.
Definition: HiCalUtil.h:272
virtual ~GainUnitConversion()
Destructor.
Definition: GainUnitConversion.h:65
Module manages HiRISE calibration vectors from various sources.
Definition: Module.h:54
Computes units parameters for HiRISE data calibration (Ziof Module)
Definition: GainUnitConversion.h:54
double ToDouble(const T &value)
Helper function to convert values to doubles.
Definition: HiCalUtil.h:248
void add(const QString &event)
Definition: HiCalTypes.h:68
GainUnitConversion(HiCalConf &conf, const QString &units)
Definition: GainUnitConversion.h:59
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
GainUnitConversion()
Definition: GainUnitConversion.h:58
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