Skip to content

Commit c07e937

Browse files
jungkyoJungGitHub Enterprise
authored andcommitted
Merge pull request #1 from isce-3/develop
sync test
2 parents 5b1a350 + 510df3a commit c07e937

File tree

250 files changed

+13576
-3597
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

250 files changed

+13576
-3597
lines changed

.ci/jenkins/workflow-mintests/Jenkinsfile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,27 @@ pipeline {
129129
echo 'I succeeded!'
130130
}
131131
unstable {
132-
echo 'I am unstable :/'
132+
echo 'I am unstable :/ Emailing PR author and one of the ISCE3 maintainers.'
133+
emailStatus()
133134
}
134135
failure {
135-
echo 'I failed :('
136+
echo 'I failed :( Emailing PR author and one of the ISCE3 maintainers.'
137+
emailStatus()
136138
}
137139
changed {
138140
echo 'Things were different before...'
139141
}
140142
}
141143
}
144+
145+
def emailStatus() {
146+
mail to: '[email protected]',
147+
subject: "ISCE3 build ${currentBuild.result}: ${currentBuild.fullDisplayName}",
148+
body: "Minimum workflow test ${currentBuild.result}: ${env.BUILD_URL}"
149+
emailext(
150+
subject: "ISCE3 build ${currentBuild.result}: ${currentBuild.fullDisplayName}",
151+
body: "Minimum workflow test ${currentBuild.result}: ${env.BUILD_URL}",
152+
recipientProviders: [[$class: 'DevelopersRecipientProvider']]
153+
)
154+
}
155+

VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.3.0-dev
1+
0.4.0-dev

cxx/isce3/Headers.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
set(HEADERS
2+
antenna/detail/WinChirpRgCompPow.h
3+
antenna/detail/WinChirpRgCompPow.icc
24
antenna/forward.h
5+
antenna/ElPatternEst.h
36
antenna/geometryfunc.h
47
antenna/Frame.h
58
antenna/Frame.icc
@@ -133,8 +136,10 @@ matchtemplate/ampcor/dom/SLC.h
133136
matchtemplate/ampcor/dom/SLC.icc
134137
math/Bessel.h
135138
math/ComplexMultiply.h
139+
math/polyfunc.h
136140
math/Sinc.h
137141
math/Sinc.icc
142+
polsar/symmetrize.h
138143
product/forward.h
139144
product/GeoGridParameters.h
140145
product/Metadata.h

cxx/isce3/Sources.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
set(SRCS
2+
antenna/ElPatternEst.cpp
23
antenna/geometryfunc.cpp
34
core/Attitude.cpp
45
core/Baseline.cpp
@@ -47,6 +48,7 @@ geocode/GeocodePolygon.cpp
4748
geometry/geometry.cpp
4849
geometry/RTC.cpp
4950
geometry/Topo.cpp
51+
geometry/TopoLayers.cpp
5052
geometry/metadataCubes.cpp
5153
image/ResampSlc.cpp
5254
io/gdal/Dataset.cpp
@@ -70,6 +72,8 @@ matchtemplate/ampcor/correlators/tgtStats.cpp
7072
matchtemplate/ampcor/dom/Raster.cc
7173
matchtemplate/ampcor/dom/SLC.cc
7274
math/Bessel.cpp
75+
math/polyfunc.cpp
76+
polsar/symmetrize.cpp
7377
product/GeoGridParameters.cpp
7478
product/Product.cpp
7579
product/RadarGridParameters.cpp

cxx/isce3/antenna/ElPatternEst.cpp

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
#include "ElPatternEst.h"
2+
3+
#include <cmath>
4+
5+
#include <isce3/core/Constants.h>
6+
#include <isce3/except/Error.h>
7+
#include <isce3/geometry/geometry.h>
8+
#include <isce3/math/polyfunc.h>
9+
10+
#include "detail/WinChirpRgCompPow.h"
11+
12+
namespace isce3 { namespace antenna {
13+
14+
ElPatternEst::ElPatternEst(double sr_start, const isce3::core::Orbit& orbit,
15+
int polyfit_deg, const isce3::geometry::DEMInterpolator& dem_interp,
16+
double win_ped, const isce3::core::Ellipsoid& ellips,
17+
bool center_scale_pf)
18+
: _sr_start(sr_start), _orbit(orbit), _polyfit_deg(polyfit_deg),
19+
_dem_interp(dem_interp), _win_ped(win_ped), _ellips(ellips),
20+
_center_scale_pf(center_scale_pf)
21+
{
22+
if (!(sr_start > 0.0))
23+
throw isce3::except::InvalidArgument(ISCE_SRCINFO(),
24+
"Requires positive value for starting slant range!");
25+
if (polyfit_deg < 2)
26+
throw isce3::except::InvalidArgument(
27+
ISCE_SRCINFO(), "The degree of poly fit shall be at least 2!");
28+
if (win_ped < 0.0 || win_ped > 1.0)
29+
throw isce3::except::InvalidArgument(ISCE_SRCINFO(),
30+
"The raised-cosine window pedestal shall be within [0, 1]!");
31+
}
32+
33+
typename ElPatternEst::tuple5_t ElPatternEst::powerPattern2way(
34+
const Eigen::Ref<const RowMatrixXcf>& echo_mat, double sr_spacing,
35+
double chirp_rate, double chirp_dur, std::optional<double> az_time,
36+
int size_avg, bool inc_corr)
37+
{
38+
// get calibrated avreaged two-way power pattern
39+
auto [cal_pow, slant_range, look_ang, inc_ang] =
40+
_getCalibPowLinear(echo_mat, sr_spacing, chirp_rate, chirp_dur,
41+
az_time, size_avg, inc_corr);
42+
// convert to dB
43+
cal_pow = 10 * Eigen::log10(cal_pow);
44+
// polyfit pow in dB as a function of look angles in rad with centering and
45+
// scaling!
46+
auto poly1d_obj = isce3::math::polyfitObj(
47+
look_ang, cal_pow, _polyfit_deg, _center_scale_pf);
48+
// return time-series power in dB scale
49+
return {cal_pow, slant_range, look_ang, inc_ang, poly1d_obj};
50+
}
51+
52+
typename ElPatternEst::tuple5_t ElPatternEst::powerPattern1way(
53+
const Eigen::Ref<const RowMatrixXcf>& echo_mat, double sr_spacing,
54+
double chirp_rate, double chirp_dur, std::optional<double> az_time,
55+
int size_avg, bool inc_corr)
56+
{
57+
// get calibrated avreaged one-way power pattern
58+
auto [cal_pow, slant_range, look_ang, inc_ang] =
59+
_getCalibPowLinear(echo_mat, sr_spacing, chirp_rate, chirp_dur,
60+
az_time, size_avg, inc_corr);
61+
// convert sqrt value to dB
62+
cal_pow = 5 * Eigen::log10(cal_pow);
63+
// polyfit pow in dB as a function of look angles in rad with centering and
64+
// scaling!
65+
auto poly1d_obj = isce3::math::polyfitObj(
66+
look_ang, cal_pow, _polyfit_deg, _center_scale_pf);
67+
// return time-series power in dB scale
68+
return {cal_pow, slant_range, look_ang, inc_ang, poly1d_obj};
69+
}
70+
71+
typename ElPatternEst::tuple4_t ElPatternEst::_getCalibPowLinear(
72+
const Eigen::Ref<const RowMatrixXcf>& echo_mat, double sr_spacing,
73+
double chirp_rate, double chirp_dur, std::optional<double> az_time,
74+
int size_avg, bool inc_corr)
75+
76+
{
77+
// get range sampling frequency
78+
const double sample_freq {isce3::core::speed_of_light / (2 * sr_spacing)};
79+
// form the reference weighted unit-energy complex chirp
80+
auto chirp_ref = detail::genRcosWinChirp(
81+
sample_freq, chirp_rate, chirp_dur, _win_ped);
82+
// calculate the mean echo power by averaging over multiple range compressed
83+
// range lines
84+
auto mean_echo_pow = detail::meanRgCompEchoPower(echo_mat, chirp_ref);
85+
// perform averaging over multiple range bins and partially perform relative
86+
// radiometric cal by compensating for 2-way range path loss
87+
auto [cal_avg_pow, sr] = detail::rangeCalibAvgEchoPower(
88+
mean_echo_pow, _sr_start, sr_spacing, size_avg);
89+
// estimate look angle and incidence angles per geometry/orbit at az_time
90+
auto [look_ang, inc_ang] = isce3::geometry::lookIncAngFromSlantRange(
91+
sr, _orbit, az_time, _dem_interp, _ellips);
92+
// as part of relative radiometric cal ,perform incidence angle correction
93+
// if requested
94+
if (inc_corr) {
95+
cal_avg_pow *= Eigen::tan(inc_ang);
96+
if (inc_ang(0) > 0.0)
97+
cal_avg_pow /= std::tan(inc_ang(0));
98+
}
99+
// peak normalize to get relative variation
100+
auto peak_pow {cal_avg_pow.maxCoeff()};
101+
if (peak_pow > 0.0)
102+
cal_avg_pow /= peak_pow;
103+
auto slant_range = Linspace_t(
104+
sr(0), sr_spacing * size_avg, static_cast<int>(sr.size()));
105+
return {cal_avg_pow, slant_range, look_ang, inc_ang};
106+
}
107+
108+
}} // namespace isce3::antenna

cxx/isce3/antenna/ElPatternEst.h

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
#pragma once
2+
3+
#include <tuple>
4+
#include <vector>
5+
6+
#include <Eigen/Dense>
7+
8+
#include <isce3/core/EMatrix.h>
9+
#include <isce3/core/Ellipsoid.h>
10+
#include <isce3/core/Linspace.h>
11+
#include <isce3/core/Orbit.h>
12+
#include <isce3/core/Poly1d.h>
13+
#include <isce3/geometry/DEMInterpolator.h>
14+
15+
namespace isce3 { namespace antenna {
16+
17+
/**
18+
* A class for estimating one-way or two-way elevation (EL) power
19+
* pattern from 2-D raw echo data over quasi-homogenous scene
20+
* and provide approximate look (off-nadir or EL) angle and
21+
* ellipsoidal incidence angle (no local slope).
22+
* The final power in dB scale is fit into N-order polynomials
23+
* as a function of look angle in radians.
24+
* Required relative radiometric calibration from \f$\beta^{0}\f$ to
25+
* \f$\gamma^{0}\f$ is done approximately by using slant ranges and
26+
* ellipsoidal incidence angle.
27+
*/
28+
class ElPatternEst {
29+
// aliases
30+
public:
31+
using RowMatrixXcf = isce3::core::EMatrix2D<std::complex<float>>;
32+
33+
protected:
34+
using Linspace_t = isce3::core::Linspace<double>;
35+
using tuple4_t = std::tuple<Eigen::ArrayXd, isce3::core::Linspace<double>,
36+
Eigen::ArrayXd, Eigen::ArrayXd>;
37+
using tuple5_t = std::tuple<Eigen::ArrayXd, isce3::core::Linspace<double>,
38+
Eigen::ArrayXd, Eigen::ArrayXd, isce3::core::Poly1d>;
39+
40+
public:
41+
// constructors
42+
/**
43+
* A constructor with full input arguments.
44+
* @param[in] sr_start start slant range in (m)
45+
* @param[in] orbit isce3 Orbit object
46+
* @param[in] polyfit_deg (optional) polyfit degree of polynomial
47+
* for polyfitting estimated power patterns. The value must be > 1.
48+
* Default is 6.
49+
* @pram[in] dem_interp (optional) isce3 DEMInterpolator object.
50+
* Default is global 0.0 (m) height (reference ellipsoid).
51+
* Note that simply averaged DEM will be used. No local slope is taken into
52+
* account!
53+
* @param[in] win_ped (optional) Raised-cosine window pedestal. A value
54+
* within [0, 1]. Default is Hann
55+
* window.https://en.wikipedia.org/wiki/Hann_function <a
56+
* href="https://en.wikipedia.org/wiki/Hann_function" target="_blank">See
57+
* raised cosine window</a>.
58+
* @param[in] ellips (optional) isce3 Ellipsoid object. Default is WGS84.
59+
* @param[in] center_scale_pf (optional) whether or not use center and
60+
* scaling in polyfit. Default is false.
61+
* @exception InvalidArgument
62+
*/
63+
ElPatternEst(double sr_start, const isce3::core::Orbit& orbit,
64+
int polyfit_deg = 6,
65+
const isce3::geometry::DEMInterpolator& dem_interp = {},
66+
double win_ped = 0.0, const isce3::core::Ellipsoid& ellips = {},
67+
bool center_scale_pf = false);
68+
69+
/**
70+
* A more concise constructor of key inputs.
71+
* @param[in] sr_start start slant range in (m)
72+
* @param[in] orbit isce3 Orbit object
73+
* @param[in] dem_interp isce3 DEMInterpolator object.
74+
* @exception InvalidArgument
75+
*/
76+
ElPatternEst(double sr_start, const isce3::core::Orbit& orbit,
77+
const isce3::geometry::DEMInterpolator& dem_interp)
78+
: ElPatternEst(sr_start, orbit, 6, dem_interp, 0.0,
79+
isce3::core::Ellipsoid(), false)
80+
{}
81+
82+
// methods
83+
/**
84+
* Estimated averaged two-way time-series power pattern in Elevation from
85+
* 2-D raw echo data uniformly sampled in slant range direction. Uniform
86+
* sampling in azimuth direction is not required! Note that it is assumed
87+
* the data either has no TX gap (bad values) or its TX gap (bad values)
88+
* have been already replaced by meaningful data.
89+
* @param[in] echo_mat raw echo matrix, a row-major Eigen matrix of type
90+
* complex float. The rows represent range lines. The matrix shape is pulses
91+
* (azimuth bins) by range bins.
92+
* @param[in] sr_spacing slant range spacing in (m).
93+
* @param[in] chirp_rate transmit chirp rate in (Hz/sec).
94+
* @param[in] chirp_dur transmit chirp duration in (sec).
95+
* @param[in] az_time (optional) relative azimuth time in seconds w.r.t
96+
* reference epoch time of orbit object. Default is the mid orbit time if
97+
* not specified or if set to {} or std::nullopt.
98+
* @param[in] size_avg (optional) the block size for averaging in slant
99+
* range direction. Default is 8.
100+
* @param[in] inc_corr (optional) whether or not apply correction for
101+
* incidence angles calculated at a certain mean DEM height wrt reference
102+
* ellipsoid w/o taking into account any local slope! Default is true.
103+
* @return eigen vector of times-series range-averaged peak-normalized
104+
* 2-way power pattern in (dB) which is uniformly sampled in slant range
105+
* with new range spacing defined by "sr_spacing * size_avg".
106+
* @return slant ranges in meters in the form of isce3 Linspace object
107+
* @return look angles vector in radians.
108+
* @return ellipsoidal incidence angles vector in radians.
109+
* @return isce3 Poly1d object mapping power in dB as a function
110+
* look angle in radians
111+
* @exception InvalidArgument, RuntimeError
112+
* @see powerPattern1way()
113+
*/
114+
tuple5_t powerPattern2way(const Eigen::Ref<const RowMatrixXcf>& echo_mat,
115+
double sr_spacing, double chirp_rate, double chirp_dur,
116+
std::optional<double> az_time = {}, int size_avg = 8,
117+
bool inc_corr = true);
118+
119+
/**
120+
* Estimated averaged one-way time-series power pattern in Elevation from
121+
* 2-D raw echo data uniformly sampled in slant range direction. Uniform
122+
* sampling in azimuth direction is not required! Note that it is assumed
123+
* the data either has no TX gap (bad values) or its TX gap (bad values)
124+
* have been already replaced by meaningful data.
125+
* @param[in] echo_mat raw echo matrix, a row-major Eigen matrix of type
126+
* complex float. The rows represent range lines. The matrix shape is pulses
127+
* (azimuth bins) by range bins.
128+
* @param[in] sr_spacing slant range spacing in (m).
129+
* @param[in] chirp_rate transmit chirp rate in (Hz/sec).
130+
* @param[in] chirp_dur transmit chirp duration in (sec).
131+
* @param[in] az_time (optional) relative azimuth time in seconds w.r.t
132+
* reference epoch time of orbit object. Default is the mid orbit time if
133+
* not specified or if set to {} or std::nullopt.
134+
* @param[in] size_avg (optional) the block size for averaging in slant
135+
* range direction. Default is 8.
136+
* @param[in] inc_corr (optional) whether or not apply correction for
137+
* incidence angles calculated at a certain mean DEM height wrt reference
138+
* ellipsoid w/o taking into account any local slope! Default is true.
139+
* @return eigen vector of times-series range-averaged peak-normalized
140+
* 1-way power pattern in (dB) which is uniformly sampled in slant range
141+
* with new range spacing defined by "sr_spacing * size_avg".
142+
* @return slant ranges in meters in the form of isce3 Linspace object
143+
* @return look angles vector in radians.
144+
* @return ellipsoidal incidence angles vector in radians.
145+
* @return isce3 Poly1d object mapping power in dB as a function
146+
* look angle in radians
147+
* @exception InvalidArgument, RuntimeError
148+
* @see powerPattern2way()
149+
*/
150+
tuple5_t powerPattern1way(const Eigen::Ref<const RowMatrixXcf>& echo_mat,
151+
double sr_spacing, double chirp_rate, double chirp_dur,
152+
std::optional<double> az_time = {}, int size_avg = 8,
153+
bool inc_corr = true);
154+
155+
/**
156+
* Get raised-cosine window pedestal set at the constructor.
157+
* @return window pedestal used for weighting ref chirp in
158+
* range compression.
159+
*/
160+
double winPed() const { return _win_ped; }
161+
162+
/**
163+
* Get degree of polyfit set at the constructor.
164+
* @return degree of polyfit used for 1-way or 2-way power pattern (dB)
165+
* as a function of look angles (rad).
166+
*/
167+
int polyfitDeg() const { return _polyfit_deg; }
168+
169+
/**
170+
* Check whether the polyfit process is centeralized and scaled.
171+
* @return bool
172+
*/
173+
bool isCenterScalePolyfit() const { return _center_scale_pf; }
174+
175+
private:
176+
/**
177+
* Helper method for public methods "powPat1w" and "powPat2w"
178+
* @return peak-normalized calibrated averaged 2-way power pattern vector
179+
* in linear scale
180+
* @return slant ranges in meters in the form of isce3 Linspace object
181+
* @return look angles vector in radians.
182+
* @return ellipsoidal incidence angles vector in radians.
183+
* look angle in radians
184+
* @see powerPattern2way(), powerPattern1way()
185+
*/
186+
tuple4_t _getCalibPowLinear(const Eigen::Ref<const RowMatrixXcf>& echo_mat,
187+
double sr_spacing, double chirp_rate, double chirp_dur,
188+
std::optional<double> az_time, int size_avg, bool inc_corr);
189+
190+
// members
191+
protected:
192+
// input common parameters
193+
double _sr_start;
194+
isce3::core::Orbit _orbit;
195+
double _polyfit_deg;
196+
isce3::geometry::DEMInterpolator _dem_interp;
197+
double _win_ped;
198+
isce3::core::Ellipsoid _ellips;
199+
bool _center_scale_pf;
200+
};
201+
202+
}} // namespace isce3::antenna

0 commit comments

Comments
 (0)