Skip to content

Commit 7f0f599

Browse files
rad-eng-59GitHub Enterprise
authored andcommitted
Fix issue 876 (#891)
* Change return type from `auto` to `Eigen` in "edge_method_cost_func.cpp" * Use "round" in calculating the number of angles for Linspace
1 parent 65cc0e4 commit 7f0f599

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

cxx/isce3/antenna/EdgeMethodCostFunc.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,8 @@ std::tuple<double, double, bool, int> rollAngleOffsetFromEdge(
137137
"Near-range look angle shall be smaller than "
138138
"far one by at least one prec!");
139139

140-
const auto ang_size =
141-
static_cast<int>((look_ang_far - look_ang_near) / look_ang_prec) +
142-
1;
140+
const auto ang_size = static_cast<int>(
141+
std::round((look_ang_far - look_ang_near) / look_ang_prec) + 1);
143142
auto look_ang = isce3::core::Linspace<double>::from_interval(
144143
look_ang_near, look_ang_far, ang_size);
145144

cxx/isce3/antenna/ElNullAnalyses.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ tuple_ant genAntennaPairCoefs(
9090
auto el_space = std::min(*el_res_max, el_ang_step);
9191
auto el_start = idx_peak_left * el_ang_step + el_ang_start;
9292
auto el_stop = idx_peak_right * el_ang_step + el_ang_start;
93-
auto num_idx =
94-
static_cast<Eigen::Index>((el_stop - el_start) / el_space + 1);
93+
auto num_idx = static_cast<Eigen::Index>(
94+
std::round((el_stop - el_start) / el_space) + 1);
9595

9696
Eigen::ArrayXd el_vec =
9797
Eigen::ArrayXd::LinSpaced(num_idx, el_start, el_stop);

tests/cxx/isce3/antenna/edge_method_cost_func.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct EdgeMethodCostFuncTest : public ::testing::Test {
4444
// add roll offset (perturbed)
4545
auto lka_ant_rad = lka_edge_rad + roll * md2r;
4646
// add a gain offset
47-
auto gain_ant = polyvals(pf_ref, lka_ant_rad) + gain_ofs;
47+
Eigen::ArrayXd gain_ant = polyvals(pf_ref, lka_ant_rad) + gain_ofs;
4848
pf_ant_vec.push_back(
4949
isce3::math::polyfitObj(lka_edge_rad, gain_ant, 3, false));
5050
}
@@ -105,9 +105,9 @@ struct EdgeMethodCostFuncTest : public ::testing::Test {
105105
const double max_lka_edge_deg {34.0};
106106
const double prec_lka_edge_deg {1e-3};
107107
const int num_lka_edge {
108-
static_cast<int>(
109-
(max_lka_edge_deg - min_lka_edge_deg) / prec_lka_edge_deg) +
110-
1};
108+
static_cast<int>(std::round((max_lka_edge_deg - min_lka_edge_deg) /
109+
prec_lka_edge_deg) +
110+
1)};
111111

112112
// gain offset in (dB) between relative EL power patterns extracted from
113113
// antenna and echo. the roll offset estimation is insensitive to this gain
@@ -125,8 +125,8 @@ struct EdgeMethodCostFuncTest : public ::testing::Test {
125125
// Build a 6-order polyminals of a relative antenna gain from gain (dB)
126126
// versus look angles (rad) to be used as a reference for building both
127127
// antenna and echo data
128-
// These points are extracted from a realitic EL power pattern of ALOS1 beam
129-
// #7.
128+
// These points are extracted from a realistic EL power pattern of ALOS1
129+
// beam #7.
130130
std::vector<double> gain {
131131
-2.2, -1.2, -0.55, -0.2, 0.0, -0.2, -0.5, -1.0, -2.0};
132132
std::vector<double> lka_deg {

0 commit comments

Comments
 (0)