Skip to content

Commit

Permalink
rename to zero_correlation_threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
scottstanie committed Oct 28, 2024
1 parent 83a662e commit 8f3fe75
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
20 changes: 10 additions & 10 deletions src/dolphin/phase_link/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/dolphin/workflows/config/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
4 changes: 2 additions & 2 deletions src/dolphin/workflows/sequential.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/dolphin/workflows/single.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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],
Expand Down
2 changes: 1 addition & 1 deletion src/dolphin/workflows/wrapped_phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 8f3fe75

Please sign in to comment.