Skip to content

Commit

Permalink
Let amp_dispersion_threshold be 0 to select no PS points (#553)
Browse files Browse the repository at this point in the history
* Let `amp_dispersion_threshold` be 0 to select no PS points

* Add test
  • Loading branch information
scottstanie authored Mar 7, 2025
1 parent c5c426b commit f312d83
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/dolphin/workflows/config/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class PsOptions(BaseModel, extra="forbid"):
amp_dispersion_threshold: float = Field(
0.25,
description="Amplitude dispersion threshold to consider a pixel a PS.",
gt=0.0,
ge=0.0,
)


Expand Down
9 changes: 9 additions & 0 deletions tests/test_workflows_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ def test_ps_options_defaults():
assert pso._amp_mean_file == Path("PS/amp_mean.tif")


def test_ps_options_zero_and_negative_threshold():
# Change directory so the creation of the default files doesn't fail
pso = config.PsOptions(amp_dispersion_threshold=0.0)
assert pso.amp_dispersion_threshold == 0

with pytest.raises(pydantic.ValidationError):
config.PsOptions(amp_dispersion_threshold=-0.1)


def test_phase_linking_options_defaults():
opts = config.PhaseLinkingOptions()
assert opts.ministack_size == 15
Expand Down

0 comments on commit f312d83

Please sign in to comment.