Unverified Commit 342b2168 authored by Kristin's avatar Kristin Committed by GitHub
Browse files

SAR update reference point (#300)

* Add setting of reference height to Sar Sensor Model

* Update SarTests
parent b5bb0f85
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -275,6 +275,24 @@ void UsgsAstroSarSensorModel::replaceModelState(const string& argState){
  m_covariance = stateJson["m_covariance"].get<vector<double>>();
  m_sunPosition = stateJson["m_sunPosition"].get<vector<double>>();
  m_sunVelocity = stateJson["m_sunVelocity"].get<vector<double>>();


  // If sensor model is being created for the first time, this routine will set the reference point
  if (m_referencePointXyz.x == 0 && m_referencePointXyz.y == 0 && m_referencePointXyz.z == 0) {
    MESSAGE_LOG("Updating State")

    double lineCtr = m_nLines / 2.0;
    double sampCtr = m_nSamples / 2.0;
    csm::ImageCoord ip(lineCtr, sampCtr);
    MESSAGE_LOG("updateState: center image coordinate set to {} {}",
                              lineCtr, sampCtr)
    
    double refHeight = 0;
    m_referencePointXyz = imageToGround(ip, refHeight);
    MESSAGE_LOG("updateState: reference point (x, y, z) {} {} {}",
                m_referencePointXyz.x, m_referencePointXyz.y,
                m_referencePointXyz.z)
  }
}

string UsgsAstroSarSensorModel::getModelState() const {
+6 −6
Original line number Diff line number Diff line
@@ -84,12 +84,12 @@ TEST_F(SarSensorModel, computeGroundPartials) {
  csm::EcefCoord groundPt(1737400.0, 0.0, 0.0);
  std::vector<double> partials = sensorModel->computeGroundPartials(groundPt);
  ASSERT_EQ(partials.size(), 6);
  EXPECT_NEAR(partials[0], -0.00023385137104424322, 1e-8);
  EXPECT_NEAR(partials[1], -3.3408269124235446e-05, 1e-8);
  EXPECT_NEAR(partials[2], -1.0 / 7.5, 1e-8);
  EXPECT_NEAR(partials[3], -33.057612335589731, 1e-8);
  EXPECT_NEAR(partials[4], 6.3906252180458977e-05, 1e-8);
  EXPECT_NEAR(partials[5], 0.0077565105242805047, 1e-8);
  EXPECT_NEAR(partials[0], 6.5128150576280552e-09, 1e-8);
  EXPECT_NEAR(partials[1], -5.1810407815840636e-15, 1e-8);
  EXPECT_NEAR(partials[2], -0.13309947654685725, 1e-8);
  EXPECT_NEAR(partials[3], -33.057625791698072, 1e-8);
  EXPECT_NEAR(partials[4], 6.1985123841926308e-05, 1e-8);
  EXPECT_NEAR(partials[5], 0.007743051337209989, 1e-8);
}

TEST_F(SarSensorModel, imageToProximateImagingLocus) {