USGS

Isis 3.0 Application Source Code Reference

Home

GainLineDrift.h

Go to the documentation of this file.
00001 #if !defined(GainLineDrift_h)
00002 #define GainLineDrift_h
00003 /**                                                                       
00004  * @file                                                                  
00005  * $Revision: 1.2 $
00006  * $Date: 2008/05/14 21:07:22 $
00007  * $Id: GainLineDrift.h,v 1.2 2008/05/14 21:07:22 slambright Exp $
00008  * 
00009  *   Unless noted otherwise, the portions of Isis written by the USGS are 
00010  *   public domain. See individual third-party library and package descriptions 
00011  *   for intellectual property information, user agreements, and related  
00012  *   information.                                                         
00013  *                                                                        
00014  *   Although Isis has been used by the USGS, no warranty, expressed or   
00015  *   implied, is made by the USGS as to the accuracy and functioning of such 
00016  *   software and related material nor shall the fact of distribution     
00017  *   constitute any such warranty, and no responsibility is assumed by the
00018  *   USGS in connection therewith.                                        
00019  *                                                                        
00020  *   For additional information, launch                                   
00021  *   $ISISROOT/doc//documents/Disclaimers/Disclaimers.html                
00022  *   in a browser or see the Privacy & Disclaimers page on the Isis website,
00023  *   http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on
00024  *   http://www.usgs.gov/privacy.html.                                    
00025  */                                                                       
00026 #include <cmath>
00027 #include <string>
00028 #include <vector>
00029 
00030 #include "iString.h"
00031 #include "HiCalTypes.h"
00032 #include "HiCalUtil.h"
00033 #include "HiCalConf.h"
00034 #include "Module.h"
00035 #include "Filename.h"
00036 
00037 #include "iException.h"
00038 
00039 namespace Isis {
00040 
00041   /**
00042    * @brief Computes a gain correction for each line (Zg Module)
00043    * 
00044    * This class computes the HiRISE gain component correction for each line. 
00045    * Time dependant line drift correction also governed by parameters in config 
00046    * file and LineGainDrift coefficients matrix file. 
00047    * 
00048    * @ingroup Utility
00049    * 
00050    * @author 2008-01-10 Kris Becker 
00051    * @internal 
00052    *   @history 2010-04-16 Kris Becker Modifed to use standardized CSV file
00053    *            format.
00054    */
00055   class GainLineDrift : public Module {
00056 
00057     public: 
00058       //  Constructors and Destructor
00059       GainLineDrift() : Module("GainLineDrift") { }
00060       GainLineDrift(const HiCalConf &conf) : Module("GainLineDrift") {
00061         init(conf);
00062       }
00063 
00064       /** Destructor */
00065       virtual ~GainLineDrift() { }
00066 
00067     private:
00068       std::string _gdfile;
00069       int _ccd;
00070       int _channel;
00071       HiVector _coefs;
00072 
00073       void init(const HiCalConf &conf) {
00074         _history.clear();
00075         DbProfile prof = conf.getMatrixProfile();
00076         _history.add("Profile["+ prof.Name()+"]");
00077         _ccd = CpmmToCcd(ToInteger(prof("CpmmNumber")));
00078         _channel = ToInteger(prof("ChannelNumber"));
00079 
00080         //  Get parameters from gainVline coefficients file
00081         _coefs = loadCsv("LineGainDrift", conf, prof, 4);
00082         _history.add("Coefs["+ToString(_coefs[0])+ ","+
00083                               ToString(_coefs[1])+ ","+
00084                               ToString(_coefs[2])+ ","+
00085                               ToString(_coefs[3])+ "]");
00086 
00087         int bin = ToInteger(prof("Summing"));
00088         double linetime = ToDouble(prof("ScanExposureDuration"));
00089         HiLineTimeEqn timet(bin, linetime);
00090         int nlines = ToInteger(prof("Lines"));
00091 
00092         HiVector gainV(nlines);
00093         for ( int i = 0 ; i < nlines ; i++ ) {
00094           double lt = timet(i);
00095           gainV[i] = _coefs[0] + (_coefs[1] * lt) + 
00096                      _coefs[2] * exp(_coefs[3] * lt);
00097         }
00098 
00099         _data = gainV;
00100         return;
00101       }
00102 
00103   };
00104 
00105 }     // namespace Isis
00106 #endif
00107