isce3 0.25.0
Loading...
Searching...
No Matches
Crossmul.icc
1// -*- C++ -*-
2// -*- coding: utf-8 -*-
3//
4// Author: Heresh Fattahi
5// Copyright 2018-
6//
7
8#if !defined(ISCE_SIGNAL_CROSSMUL_ICC)
9#error "Crossmul.icc is an implementation detail of class Crossmul"
10#endif
11
12#include <iostream>
13
14#include <isce3/except/Error.h>
15
21{
22
23 _refDoppler = refSlcDoppler;
24
25 _secDoppler = secSlcDoppler;
26
27}
28
33{
34 // make sure provided range multilook is non-negative
35 if (rangeLooks < 1) {
36 std::string error_msg = "ERROR crossmul range multilook < 1";
37 throw isce3::except::InvalidArgument(ISCE_SRCINFO(), error_msg);
38 }
39
40 _rangeLooks = rangeLooks ;
41 if (_rangeLooks > 1 or _azimuthLooks > 1) {
42 _multiLookEnabled = true;
43 } else {
44 _multiLookEnabled = false;
45 }
46}
47
52{
53 // make sure provided azimuth multilook is non-negative
54 if (azimuthLooks < 1) {
55 std::string error_msg = "ERROR crossmul azimuth multilook < 1";
56 throw isce3::except::InvalidArgument(ISCE_SRCINFO(), error_msg);
57 }
58
59 _azimuthLooks = azimuthLooks ;
60 if (_rangeLooks > 1 or _azimuthLooks > 1) {
61 _multiLookEnabled = true;
62 } else {
63 _multiLookEnabled = false;
64 }
65}
66
75rangeFrequencyShift(std::valarray<std::complex<float>> &refSpectrum,
76 std::valarray<std::complex<float>> &secSpectrum,
77 std::valarray<double> &rangeFrequencies,
78 size_t linesPerBlock,
79 size_t fft_size,
80 double &frequencyShift)
81{
82
83 std::valarray<float> refAvgSpectrum(fft_size);
84 refAvgSpectrum = 0.0;
85 std::valarray<float> secAvgSpectrum(fft_size);
86 secAvgSpectrum = 0.0;
87
88 for (size_t line = 0; line < linesPerBlock; ++line){
89 for (size_t col = 0; col < fft_size; ++col){
90 refAvgSpectrum[col] += std::abs(refSpectrum[line*fft_size + col]);
91 secAvgSpectrum[col] += std::abs(secSpectrum[line*fft_size + col]);
92 }
93 }
94
95 // index of the max of refAvgSpectrum
96 size_t idx1;
97
98 // index of the max of secAvgSpectrum
99 size_t idx2;
100
101 // get the index of the max of refAvgSpectrum
102 getPeakIndex(refAvgSpectrum, idx1);
103
104 // get the index of the max of secAvgSpectrum
105 getPeakIndex(secAvgSpectrum, idx2);
106
107 std::cout << "idx1, idx2: "<< idx1 << " , " << idx2 << std::endl;
108
109 // frequency shift is the difference of the two peaks
110 frequencyShift = rangeFrequencies[idx1] - rangeFrequencies[idx2];
111
112}
113
118getPeakIndex(std::valarray<float> data, size_t &peakIndex)
119{
120 size_t dataLength = data.size();
121 peakIndex = 0;
122 double peak = data[peakIndex];
123 for (size_t i = 1; i< dataLength; ++i){
124 if (std::abs(data[i]) > peak){
125 peak = data[i];
126 peakIndex = i;
127 }
128 }
129}
Data structure to hold a 1D Lookup table.
Definition LUT1d.h:15
void rangeLooks(int)
Set number of range looks.
Definition Crossmul.icc:32
void azimuthLooks(int)
Set number of azimuth looks.
Definition Crossmul.icc:51
int azimuthLooks() const
Get number of azimuth looks.
Definition Crossmul.h:80
void getPeakIndex(std::valarray< float > data, size_t &peakIndex)
estimate the index of the maximum of a vector of data
Definition Crossmul.icc:118
int rangeLooks() const
Get number of range looks.
Definition Crossmul.h:74
void rangeFrequencyShift(std::valarray< std::complex< float > > &refAvgSpectrum, std::valarray< std::complex< float > > &secAvgSpectrum, std::valarray< double > &rangeFrequencies, size_t linesPerBlockData, size_t fft_size, double &frequencyShift)
Compute the avergae frequency shift in range direction between two SLCs.
Definition Crossmul.icc:75
void doppler(isce3::core::LUT1d< double >, isce3::core::LUT1d< double >)
Set doppler LUTs for reference and secondary SLCs.
Definition Crossmul.icc:20
void linesPerBlock(size_t linesPerBlock)
Set linesPerBlock.
Definition Crossmul.h:89

Generated for ISCE3.0 by doxygen 1.13.2.