Commit 30266cbe authored by Kelvin Rodriguez's avatar Kelvin Rodriguez Committed by Jesse Mapel
Browse files

Austin Sander's "clemhirescal: Adds support for all MCP gain settings for filters A and D" (#3503)

* Added support for all MCP gain settings.

Closes #3190

* Revised comments to better reflect updated logic

* Added history comment.

* Added additional description and link to Robinson paper.

* added issue number
parent 4b8b0b60
Loading
Loading
Loading
Loading
+20 −3
Original line number Diff line number Diff line
@@ -12,11 +12,28 @@
      are four flat images, one for each of the four possible filters.
      Information for this program came from JGR Vol 108, A radiometric
      calibration for the Clementine Hires camera: Robinson, Malaret, White.
      The original paper can be found at https://doi.org/10.1029/2000JE001241

      The equation for the A filter yields k values that are identical to those
      in Table 5 from Robinson et al. (2003), therefore the pixel values in the
      output image are the same as they would be if the k values from Table 5
      were hard coded into the script.
      
      The equation for the D filter yields k values that differ from the
      hard-coded values by less than 1 standard deviation as reported in Table 6
      of Robinson et al. (2003).  The radiance values that result from the
      computed k values differ by no more than .0583% of the radiance values
      computed from the k values published in Table 6.

  </description>
  <history>
    <change name="Mackenzie Boyd" date="2009-08-03">
      Original version
    </change>
    <change name="Austin Sanders" date="2019-11-06">
      Replaced lookup tables with calibration equations.
      See description for more detailed information. Issue #3495
    </change>
  </history>

  <category>
+11 −29
Original line number Diff line number Diff line
@@ -48,43 +48,25 @@ void IsisMain() {
  double dataOffset[] = { -49.172, -41.0799, -32.8988, -24.718, -16.98, -8.0};
  offset = dataOffset[index];

  // Computer the K value to convert to I/F.  The K value per MCP and wavelength
  // were obtained from JGR publication Vol 108, A radiometric calibration for the
  // Clementine HIRES camera: Robinson, Malart, White, page 17
  // Compute the K value to convert to I/F. The functions for K value per MCP
  //  gain state and filter are based on Robinson, M. S., Malaret, E.,
  //  and White, T. ( 2003), A radiometric calibration for the Clementine HIRES
  //  camera, J. Geophys. Res., 108, 5028, doi:10.1029/2000JE001241, E4.
  //  The functions were determined by fitting a line to the data in Table 5 (A filter)
  //  or Table 6 (D filter) of Robinson et al., as described on page 11.
  UserInterface &ui = Application::GetUserInterface();
  if(ui.GetString("KFROM").compare("COMPUTED") == 0) {
    wave = wave.toUpper();
    int MCP = label->findGroup("Instrument", Pvl::Traverse)["MCPGainModeID"];
    // Two possible MCP gains for filter A
    // Linear fit of values in Table 5
    if(wave == "A") {
      if(MCP == 156) {
        abscoef = 0.00105;
        abscoef = ((-5.33333333333333 * pow(10, -5) * MCP) + 0.00937);
    }
      else if(MCP == 159) {
        abscoef = 0.00089;
      }
      else {
        QString message = "Image is not one of supported MCP Gain Mode IDs, enter your own K value";
        throw IException(IException::Unknown, message, _FILEINFO_);
      }
    }
    // Three possiblities for filter D
    // Linear fit of values in Table 6
    else if(wave == "D") {
      if(MCP == 151) {
        abscoef = 0.001655;
      }
      else if(MCP == 154) {
        abscoef = 0.001375;
      }
      else if(MCP == 158) {
        abscoef = 0.00097;
      }
      else {
        QString message = "Image is not one of supported MCP Gain Mode IDs, enter your own K value";
        throw IException(IException::User, message, _FILEINFO_);
      }
        abscoef = ((-9.75301204819275 * pow(10, -5) * MCP) + 0.0163866265);
    }
    // Other filters not supported for preset K value
    // Other filters not supported for calculated K value
    else {
      QString message = "Image is of filter [" + wave + "], not supported type A or D, enter your own K value";
      throw IException(IException::User, message, _FILEINFO_);