From 70b0a9573022d28efaae7754af1ea1c96eb1817f Mon Sep 17 00:00:00 2001 From: Scott Staniewicz Date: Mon, 14 Oct 2024 22:08:24 -0400 Subject: [PATCH] Fix the relative index used to make compressed SLCs (#452) --- src/dolphin/workflows/single.py | 6 +++++- src/dolphin/workflows/wrapped_phase.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/dolphin/workflows/single.py b/src/dolphin/workflows/single.py index 42eb380c..db912053 100644 --- a/src/dolphin/workflows/single.py +++ b/src/dolphin/workflows/single.py @@ -236,12 +236,16 @@ def run_wrapped_phase_single( # Get the mean to set as pixel magnitudes abs_stack = np.abs(cur_data[first_real_slc_idx:, in_trim_rows, in_trim_cols]) cur_data_mean, cur_amp_dispersion, _ = calc_ps_block(abs_stack) + # NOTE: the `ministack.compressed_reference_idx` was set relative to *all* + # input images, real and compressed. + # Since we pass in just the first real idx, we have to subtract that off + ref_index_relative = ministack.compressed_reference_idx - first_real_slc_idx cur_comp_slc = compress( # Get the inner portion of the full-res SLC data cur_data[first_real_slc_idx:, in_trim_rows, in_trim_cols], pl_output.cpx_phase[first_real_slc_idx:, out_trim_rows, out_trim_cols], slc_mean=cur_data_mean, - reference_idx=ministack.compressed_reference_idx, + reference_idx=ref_index_relative, ) # TODO: truncate diff --git a/src/dolphin/workflows/wrapped_phase.py b/src/dolphin/workflows/wrapped_phase.py index 7ff71d0d..de1211c0 100644 --- a/src/dolphin/workflows/wrapped_phase.py +++ b/src/dolphin/workflows/wrapped_phase.py @@ -142,7 +142,7 @@ def run( extra_reference_date = cfg.output_options.extra_reference_date if extra_reference_date: new_compressed_slc_reference_idx = get_nearest_date_idx( - [dtup[0] for dtup in input_dates], extra_reference_date + [date_tup[0] for date_tup in input_dates], extra_reference_date ) else: new_compressed_slc_reference_idx = None