-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skip nodata values of interferograms when interpolating (#476)
* Skip nodata values of interferograms when interpolating Currently the outside, nodata values will all fall below the threshold, leading to the most possible pixels summed for the area we dont care about. * Move interpolation test to separate test module
- Loading branch information
1 parent
1db99f1
commit f2a3043
Showing
5 changed files
with
49 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import numpy as np | ||
|
||
from dolphin import interpolation | ||
|
||
|
||
def test_interpolate(): | ||
x, y = np.meshgrid(np.arange(200), np.arange(100)) | ||
# simulate a simple phase ramp | ||
phase = 0.003 * x + 0.002 * y | ||
# interferogram with the simulated phase ramp and with a constant amplitude | ||
ifg = np.exp(1j * phase) | ||
corr = np.ones(ifg.shape) | ||
# mask out the ifg/corr at a given pixel for example at pixel 50,40 | ||
# index of the pixel of interest | ||
x_idx = 50 | ||
y_idx = 40 | ||
corr[y_idx, x_idx] = 0 | ||
|
||
interpolated_ifg = np.zeros((100, 200), dtype=np.complex64) | ||
interpolation.interpolate( | ||
ifg, | ||
weights=corr, | ||
weight_cutoff=0.5, | ||
num_neighbors=20, | ||
alpha=0.75, | ||
max_radius=51, | ||
min_radius=0, | ||
) | ||
# expected phase based on the model above used for simulation | ||
expected_phase = 0.003 * x_idx + 0.002 * y_idx | ||
phase_error = np.angle( | ||
interpolated_ifg[y_idx, x_idx] * np.exp(-1j * expected_phase) | ||
) | ||
assert np.allclose(phase_error, 0.0, atol=1e-3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters