Skip to content

Commit

Permalink
stronger testing
Browse files Browse the repository at this point in the history
  • Loading branch information
tjlane committed Aug 22, 2024
1 parent c2dc17b commit 7dd2fb2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion meteor/tv.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def tv_denoise_difference_map(
full_output: bool = False,
difference_map_amplitude_column: str = "DF",
difference_map_phase_column: str = "PHIC",
lambda_values_to_scan: Sequence[float] | None = None,
lambda_values_to_scan: Sequence[float] | np.ndarray | None = None,
) -> rs.DataSet | tuple[rs.DataSet, TvDenoiseResult]:
"""Single-pass TV denoising of a difference map.
Expand Down
28 changes: 28 additions & 0 deletions test/unit/test_tv.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,34 @@ def noisy_map() -> rs.DataSet:
return displaced_single_atom_difference_map_coefficients(noise_sigma=0.03)


@pytest.mark.parametrize(
"lambda_values_to_scan",
[
None,
[
1.0,
],
],
)
@pytest.mark.parametrize("full_output", [False, True])
def test_tv_denoise_difference_map_smoke(
lambda_values_to_scan: None | Sequence[float],
full_output: bool,
noisy_map: rs.DataSet,
) -> None:
output = tv.tv_denoise_difference_map(
difference_map_coefficients=noisy_map,
lambda_values_to_scan=lambda_values_to_scan,
full_output=full_output,
) # type: ignore
if full_output:
assert len(output) == 2
assert isinstance(output[0], rs.DataSet)
assert isinstance(output[1], tv.TvDenoiseResult)
else:
assert isinstance(output, rs.DataSet)


@pytest.mark.parametrize("lambda_values_to_scan", [None, np.logspace(-3, 2, 100)])
def test_tv_denoise_difference_map(
lambda_values_to_scan: None | Sequence[float],
Expand Down

0 comments on commit 7dd2fb2

Please sign in to comment.