-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
tjlane
committed
Aug 21, 2024
1 parent
05fb382
commit aca7d8b
Showing
2 changed files
with
106 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from meteor import utils | ||
import reciprocalspaceship as rs | ||
import pytest | ||
|
||
|
||
def test_resolution_limits(random_intensities: rs.DataSet) -> None: | ||
dmax, dmin = utils.resolution_limits(random_intensities) | ||
assert dmax == 10.0 | ||
assert dmin == 1.0 | ||
|
||
|
||
|
||
@pytest.mark.parametrize( | ||
"dmax_limit, dmin_limit", | ||
[ | ||
(None, None), | ||
(None, 2.0), | ||
(8.0, None), | ||
(8.0, 2.0), | ||
] | ||
) | ||
def test_cut_resolution(random_intensities: rs.DataSet, dmax_limit: float, dmin_limit: float) -> None: | ||
|
||
dmax_before_cut, dmin_before_cut = utils.resolution_limits(random_intensities) | ||
if not dmax_limit: | ||
expected_max_dmax = dmax_before_cut | ||
else: | ||
expected_max_dmax = dmax_limit | ||
|
||
if not dmin_limit: | ||
expected_min_dmin = dmin_before_cut | ||
else: | ||
expected_min_dmin = dmin_limit | ||
|
||
random_intensities = utils.cut_resolution(random_intensities, dmax_limit=dmax_limit, dmin_limit=dmin_limit) | ||
assert len(random_intensities) > 0 | ||
|
||
dmax, dmin = utils.resolution_limits(random_intensities) | ||
assert dmax <= expected_max_dmax | ||
assert dmin >= expected_min_dmin |