6#include <isce3/except/Error.h>
7#include <isce3/focus/Chirp.h>
8#include <isce3/focus/RangeComp.h>
10namespace isce3 {
namespace antenna {
namespace detail {
16 static_assert(std::is_floating_point_v<T>,
17 "'genRaisedCosineWin' requires floating-point output/template "
20 throw isce3::except::InvalidArgument(ISCE_SRCINFO(),
21 "Raisedcosine window size must be a positive value!");
22 if (ped < 0.0 || ped > 1.0)
23 throw isce3::except::InvalidArgument(ISCE_SRCINFO(),
24 "The raisedcosine window pedestal shall be a "
25 "value within [0, 1]!");
27 std::vector<T> rc_win(size);
32 const double cos_fact {2.0 * M_PI / (size - 1)};
33 const double scalar {-0.5 * (1.0 - ped)};
34 const double offset {0.5 * (1.0 + ped)};
35 for (
int idx = 0; idx < size; ++idx)
36 rc_win[idx] = scalar * std::cos(cos_fact * idx) + offset;
41 double chirp_slope,
double chirp_dur,
double win_ped,
bool norm)
44 if (!(sample_freq > 0.0))
45 throw isce3::except::InvalidArgument(
46 ISCE_SRCINFO(),
"Sampling frequency must be a positive value!");
47 if (!(chirp_dur > 0.0))
48 throw isce3::except::InvalidArgument(
49 ISCE_SRCINFO(),
"Chirp duration must be a positive value!");
53 isce3::focus::formLinearChirp(chirp_slope, chirp_dur, sample_freq);
54 Eigen::Map<Eigen::VectorXcf> chp_map(chp.data(), chp.size());
58 Eigen::Map<Eigen::VectorXf> rcw_map(rcw.data(), rcw.size());
64 chp_map = chp_map.cwiseProduct(rcw_map);
71 const Eigen::Ref<const RowMatrixXcf>& echo_mat,
72 const std::vector<std::complex<float>>& chirp_ref)
75 if (
static_cast<Eigen::Index
>(chirp_ref.size()) > echo_mat.cols())
76 throw isce3::except::LengthError(ISCE_SRCINFO(),
77 "Chirp ref is longer than range bins or number "
85 const auto nrgbs = rgc_obj.outputSize();
86 const auto nrgls = echo_mat.rows();
88 Eigen::ArrayXd mean_pow = Eigen::ArrayXd::Zero(nrgbs);
90 Eigen::ArrayXcf rgc_line(nrgbs);
92 for (Eigen::Index pulse = 0; pulse < nrgls; ++pulse) {
94 rgc_obj.rangecompress(rgc_line.data(), echo_mat.row(pulse).data());
96 mean_pow += rgc_line.abs2().cast<
double>();
103 const Eigen::Ref<const Eigen::ArrayXd>& echo_pow,
double rg_start,
104 double rg_spacing,
int size_avg)
107 if (!(rg_spacing > 0.0))
108 throw isce3::except::InvalidArgument(
109 ISCE_SRCINFO(),
"Range spacing must be a positive value.");
110 const auto echo_size =
static_cast<int>(echo_pow.size());
111 if (size_avg < 1 || size_avg > echo_size)
112 throw isce3::except::InvalidArgument(ISCE_SRCINFO(),
113 "Block size for averaging must be within [1, echo_size]");
115 const int nrgb {echo_size / size_avg};
117 const double drg {size_avg * rg_spacing};
118 const double rg_first {rg_start + 0.5 * (size_avg - 1) * rg_spacing};
119 const double rg_last {rg_first + (nrgb - 1) * drg};
120 Eigen::ArrayXd sr = Eigen::ArrayXd::LinSpaced(nrgb, rg_first, rg_last);
122 Eigen::ArrayXd cal_pow(nrgb);
124 for (
int idx = 0; idx < nrgb; ++idx) {
126 auto cal_fact = std::pow(sr(idx) / rg_first, 3);
129 echo_pow.segment(idx * size_avg, size_avg).mean() * cal_fact;
131 return {cal_pow, sr};
std::vector< std::complex< float > > genRcosWinChirp(double sample_freq, double chirp_slope, double chirp_dur, double win_ped=0.0, bool norm=true)
Generate a unit-energy raised-cosine-windowed baseband complex analytical chirp.
Definition WinChirpRgCompPow.icc:40
std::vector< T > genRaisedCosineWin(int size, double ped)
Generate a raised-cosine window function with a desired pedestal.
Definition WinChirpRgCompPow.icc:13
std::tuple< Eigen::ArrayXd, Eigen::ArrayXd > rangeCalibAvgEchoPower(const Eigen::Ref< const Eigen::ArrayXd > &echo_pow, double rg_start, double rg_spacing, int size_avg=1)
Path-loss corrected/calibrated averaged/decimated uniformly-sampled echo power as a function of slant...
Definition WinChirpRgCompPow.icc:102
Eigen::ArrayXd meanRgCompEchoPower(const Eigen::Ref< const RowMatrixXcf > &echo_mat, const std::vector< std::complex< float > > &chirp_ref)
Averaged Power of range compressed complex raw echo over multiple range lines as a function of true v...
Definition WinChirpRgCompPow.icc:70
Range compression processor.
Definition RangeComp.h:11
@ Valid
The output contains only the valid discrete convolution of the input with the matched filter.
Definition RangeComp.h:31
base interpolator is an abstract base class
Definition BinarySearchFunc.cpp:5