diff --git a/src/dolphin/phase_link/_core.py b/src/dolphin/phase_link/_core.py index d8832ad6..2b50a000 100644 --- a/src/dolphin/phase_link/_core.py +++ b/src/dolphin/phase_link/_core.py @@ -65,7 +65,7 @@ def run_phase_linking( strides: Strides = DEFAULT_STRIDES, use_evd: bool = False, beta: float = 0.0, - clip_coh_below: float = 0.0, + zero_correlation_threshold: float = 0.0, reference_idx: int = 0, nodata_mask: ArrayLike | None = None, mask_input_ps: bool = False, @@ -97,7 +97,7 @@ def run_phase_linking( the EMI algorithm. beta : float, optional The regularization parameter, by default 0 (no regularization). - clip_coh_below : float, optional + zero_correlation_threshold : float, optional Snap correlation values in the coherence matrix below this value to 0. Default is 0 (no clipping). reference_idx : int, optional @@ -195,7 +195,7 @@ def run_phase_linking( strides=strides, use_evd=use_evd, beta=beta, - clip_coh_below=clip_coh_below, + zero_correlation_threshold=zero_correlation_threshold, reference_idx=reference_idx, neighbor_arrays=neighbor_arrays, calc_average_coh=calc_average_coh, @@ -252,7 +252,7 @@ def run_cpl( strides: Strides, use_evd: bool = False, beta: float = 0, - clip_coh_below: float = 0.0, + zero_correlation_threshold: float = 0.0, reference_idx: int = 0, neighbor_arrays: Optional[np.ndarray] = None, calc_average_coh: bool = False, @@ -278,7 +278,7 @@ def run_cpl( the EMI algorithm. beta : float, optional The regularization parameter, by default 0 (no regularization). - clip_coh_below : float, optional + zero_correlation_threshold : float, optional Snap correlation values in the coherence matrix below this value to 0. Default is 0 (no clipping). reference_idx : int, optional @@ -337,7 +337,7 @@ def run_cpl( C_arrays, use_evd=use_evd, beta=beta, - clip_coh_below=clip_coh_below, + zero_correlation_threshold=zero_correlation_threshold, reference_idx=reference_idx, ) # Get the temporal coherence @@ -374,7 +374,7 @@ def process_coherence_matrices( C_arrays, use_evd: bool = False, beta: float = 0.0, - clip_coh_below: float = 0.0, + zero_correlation_threshold: float = 0.0, reference_idx: int = 0, ) -> tuple[Array, Array, Array]: """Estimate the linked phase for a stack of coherence matrices. @@ -394,7 +394,7 @@ def process_coherence_matrices( The regularization parameter for inverting Gamma = |C| The regularization is applied as (1 - beta) * Gamma + beta * I Default is 0 (no regularization). - clip_coh_below : float, optional + zero_correlation_threshold : float, optional Snap correlation values in the coherence matrix below this value to 0. Default is 0 (no clipping). reference_idx : int, optional @@ -434,8 +434,8 @@ def process_coherence_matrices( if beta > 0: # Perform regularization Gamma = (1 - beta) * Gamma + beta * Id - # Assume correlation below `clip_coh_below` is 0 - Gamma = jnp.where(Gamma < clip_coh_below, 0, Gamma) + # Assume correlation below `zero_correlation_threshold` is 0 + Gamma = jnp.where(Gamma < zero_correlation_threshold, 0, Gamma) # Attempt to invert Gamma cho, is_lower = cho_factor(Gamma) diff --git a/src/dolphin/workflows/config/_common.py b/src/dolphin/workflows/config/_common.py index 6841d5e8..88f267f6 100644 --- a/src/dolphin/workflows/config/_common.py +++ b/src/dolphin/workflows/config/_common.py @@ -106,7 +106,7 @@ class PhaseLinkingOptions(BaseModel, extra="forbid"): ge=0.0, le=1.0, ) - clip_coh_below: float = Field( + zero_correlation_threshold: float = Field( 0.00, description=( "Snap correlation values in the coherence matrix below this value to 0." diff --git a/src/dolphin/workflows/sequential.py b/src/dolphin/workflows/sequential.py index 7fb57d74..42d48d58 100644 --- a/src/dolphin/workflows/sequential.py +++ b/src/dolphin/workflows/sequential.py @@ -45,7 +45,7 @@ def run_wrapped_phase_sequential( shp_nslc: Optional[int] = None, use_evd: bool = False, beta: float = 0.00, - clip_coh_below: float = 0.0, + zero_correlation_threshold: float = 0.0, similarity_nearest_n: int | None = None, compressed_slc_plan: CompressedSlcPlan = CompressedSlcPlan.ALWAYS_FIRST, max_num_compressed: int = 100, @@ -124,7 +124,7 @@ def already_processed(d: Path, search_ext: str = ".tif") -> bool: strides=strides, use_evd=use_evd, beta=beta, - clip_coh_below=clip_coh_below, + zero_correlation_threshold=zero_correlation_threshold, mask_file=mask_file, ps_mask_file=ps_mask_file, amp_mean_file=amp_mean_file, diff --git a/src/dolphin/workflows/single.py b/src/dolphin/workflows/single.py index 49adb67b..ed6549fb 100644 --- a/src/dolphin/workflows/single.py +++ b/src/dolphin/workflows/single.py @@ -44,7 +44,7 @@ def run_wrapped_phase_single( half_window: dict, strides: Optional[dict] = None, beta: float = 0.00, - clip_coh_below: float = 0.0, + zero_correlation_threshold: float = 0.0, use_evd: bool = False, mask_file: Optional[Filename] = None, ps_mask_file: Optional[Filename] = None, @@ -199,7 +199,7 @@ def run_wrapped_phase_single( strides=strides_tup, use_evd=use_evd, beta=beta, - clip_coh_below=clip_coh_below, + zero_correlation_threshold=zero_correlation_threshold, reference_idx=ministack.output_reference_idx, nodata_mask=nodata_mask[in_rows, in_cols], ps_mask=ps_mask[in_rows, in_cols], diff --git a/src/dolphin/workflows/wrapped_phase.py b/src/dolphin/workflows/wrapped_phase.py index 5b42ec17..1ff35654 100644 --- a/src/dolphin/workflows/wrapped_phase.py +++ b/src/dolphin/workflows/wrapped_phase.py @@ -189,7 +189,7 @@ def run( strides=strides, use_evd=cfg.phase_linking.use_evd, beta=cfg.phase_linking.beta, - clip_coh_below=cfg.phase_linking.clip_coh_below, + zero_correlation_threshold=cfg.phase_linking.zero_correlation_threshold, mask_file=mask_filename, ps_mask_file=ps_output, amp_mean_file=cfg.ps_options._amp_mean_file,