Isis 3 Programmer Reference
GainTemperature.h
Go to the documentation of this file.
1 #ifndef GainTemperature_h
2 #define GainTemperature_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 #include "Statistics.h"
37 #include "IException.h"
38 
39 namespace Isis {
62  class GainTemperature : public Module {
63 
64  public:
65  // Constructors and Destructor
66  GainTemperature() : Module("GainTemperature") { }
67  GainTemperature(const HiCalConf &conf) : Module("GainTemperature") {
68  init(conf);
69  }
70 
72  virtual ~GainTemperature() { }
73 
74  private:
75  std::string _fpaFile;
76  double _refTemp; // Reference temperature
77  double _fpaFactor; // Temperature factor
78 
79  void init(const HiCalConf &conf) {
80  _history.clear();
81  DbProfile prof = conf.getMatrixProfile();
82  _history.add("Profile["+ prof.Name()+"]");
83 
84  // Get temperature factor
85  HiVector factor = loadCsv("FpaGain", conf, prof, 1);
86  _fpaFactor = factor[0];
87 
88  // Get temperature parameters
89  _refTemp = toDouble(ConfKey(prof, "FpaReferenceTemperature", toString(21.0)));
90 
91  double fpa_py_temp = ToDouble(prof("FpaPositiveYTemperature"));
92  double fpa_my_temp = ToDouble(prof("FpaNegativeYTemperature"));
93 
94 
95  double FPA_temp = (fpa_py_temp+fpa_my_temp) / 2.0;
96  double _baseT = 1.0 - (_fpaFactor * (FPA_temp - _refTemp));
97 
98  // Create data
99  int nsamps = ToInteger(prof("Samples"));
100  _data = HiVector(nsamps, _baseT);
101 
102  // History
103  _history.add("FpaTemperatureFactor[" + ToString(_fpaFactor) + "]");
104  _history.add("FpaAverageTemperature[" + ToString(FPA_temp) + "]");
105  _history.add("FpaReferenceTemperature[" + ToString(_refTemp) + "]");
106  _history.add("Correction[" + ToString(_baseT) + "]");
107  return;
108  }
109 
110  };
111 
112 } // namespace Isis
113 #endif
HiVector _data
Data vector.
Definition: Module.h:166
HiHistory _history
Hierarchial component history.
Definition: Module.h:167
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
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:226
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition: IString.cpp:164
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
GaingTemperature Module - Applies temperature-dependant gain correction (column)
virtual ~GainTemperature()
Destructor.
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
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
T ConfKey(const DbProfile &conf, const QString &keyname, const T &defval, int index=0)
Find a keyword in a profile using default for non-existant keywords.
Definition: HiCalUtil.h:219
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