Isis Developer Reference
GainTemperature.h
Go to the documentation of this file.
1 #ifndef GainTemperature_h
2 #define GainTemperature_h
3 
10 /* SPDX-License-Identifier: CC0-1.0 */
11 
12 #include <cmath>
13 #include <string>
14 #include <vector>
15 
16 #include "IString.h"
17 #include "HiCalTypes.h"
18 #include "HiCalUtil.h"
19 #include "HiCalConf.h"
20 #include "Module.h"
21 #include "FileName.h"
22 #include "Statistics.h"
23 #include "IException.h"
24 
25 namespace Isis {
48  class GainTemperature : public Module {
49 
50  public:
51  // Constructors and Destructor
52  GainTemperature() : Module("GainTemperature") { }
53  GainTemperature(const HiCalConf &conf) : Module("GainTemperature") {
54  init(conf);
55  }
56 
58  virtual ~GainTemperature() { }
59 
60  private:
61  std::string _fpaFile;
62  double _refTemp; // Reference temperature
63  double _fpaFactor; // Temperature factor
64 
65  void init(const HiCalConf &conf) {
66  _history.clear();
67  DbProfile prof = conf.getMatrixProfile();
68  _history.add("Profile["+ prof.Name()+"]");
69 
70  // Get temperature factor
71  HiVector factor = loadCsv("FpaGain", conf, prof, 1);
72  _fpaFactor = factor[0];
73 
74  // Get temperature parameters
75  _refTemp = toDouble(ConfKey(prof, "FpaReferenceTemperature", toString(21.0)));
76 
77  double fpa_py_temp = ToDouble(prof("FpaPositiveYTemperature"));
78  double fpa_my_temp = ToDouble(prof("FpaNegativeYTemperature"));
79 
80 
81  double FPA_temp = (fpa_py_temp+fpa_my_temp) / 2.0;
82  double _baseT = 1.0 - (_fpaFactor * (FPA_temp - _refTemp));
83 
84  // Create data
85  int nsamps = ToInteger(prof("Samples"));
86  _data = HiVector(nsamps, _baseT);
87 
88  // History
89  _history.add("FpaTemperatureFactor[" + ToString(_fpaFactor) + "]");
90  _history.add("FpaAverageTemperature[" + ToString(FPA_temp) + "]");
91  _history.add("FpaReferenceTemperature[" + ToString(_refTemp) + "]");
92  _history.add("Correction[" + ToString(_baseT) + "]");
93  return;
94  }
95 
96  };
97 
98 } // namespace Isis
99 #endif
Isis::Module::_history
HiHistory _history
Hierarchial component history.
Definition: Module.h:152
Isis::GainTemperature
GaingTemperature Module - Applies temperature-dependant gain correction (column)
Definition: GainTemperature.h:48
Isis::HiHistory::clear
void clear()
Definition: HiCalTypes.h:65
FileName.h
Isis::DbProfile::Name
QString Name() const
Returns the name of this property.
Definition: DbProfile.h:104
Isis::ToString
QString ToString(const T &value)
Helper function to convert values to strings.
Definition: HiCalUtil.h:246
Isis::Module
Module manages HiRISE calibration vectors from various sources.
Definition: Module.h:39
Isis::ConfKey
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:205
Isis::GainTemperature::GainTemperature
GainTemperature(const HiCalConf &conf)
Definition: GainTemperature.h:53
HiCalConf.h
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
IString.h
Isis::Module::_data
HiVector _data
Data vector.
Definition: Module.h:151
Isis::Module::loadCsv
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:101
Isis::ToInteger
int ToInteger(const T &value)
Helper function to convert values to Integers.
Definition: HiCalUtil.h:222
HiCalUtil.h
Isis::GainTemperature::~GainTemperature
virtual ~GainTemperature()
Destructor.
Definition: GainTemperature.h:58
Isis::GainTemperature::GainTemperature
GainTemperature()
Definition: GainTemperature.h:52
Isis::DbProfile
A DbProfile is a container for access parameters to a database.
Definition: DbProfile.h:51
HiCalTypes.h
Isis::HiVector
TNT::Array1D< double > HiVector
1-D Buffer
Definition: HiCalTypes.h:27
Isis::HiHistory::add
void add(const QString &event)
Definition: HiCalTypes.h:55
Isis::ToDouble
double ToDouble(const T &value)
Helper function to convert values to doubles.
Definition: HiCalUtil.h:234
Statistics.h
IException.h
Isis::toDouble
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition: IString.cpp:149
Module.h
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16