Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jbeilstenedmands committed Sep 19, 2023
1 parent 1ab7696 commit fb79018
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/util/test_resolution_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ def test_log_inv_fit():
def test_tanh_fit():
x = flex.double(range(0, 100)) * 0.01
f = curve_fitting.tanh(0.5, 1.5)
n_obs = flex.double(100, 100)
yo = f(x)
yf = resolution_analysis.tanh_fit(x, yo)
yf = resolution_analysis.tanh_fit(x, yo, n_obs=n_obs)
assert yo == pytest.approx(yf, abs=1e-5)


Expand All @@ -68,17 +69,18 @@ def merging_stats(dials_data):

def test_resolution_fit(merging_stats):
d_star_sq = flex.double(uctbx.d_as_d_star_sq(b.d_min) for b in merging_stats.bins)
n_obs = None
y_obs = flex.double(b.r_merge for b in merging_stats.bins)
result = resolution_analysis.resolution_fit(
d_star_sq, y_obs, resolution_analysis.log_inv_fit, 0.6
d_star_sq, y_obs, resolution_analysis.log_inv_fit, 0.6, n_obs
)
assert result.d_min == pytest.approx(1.278, abs=1e-3)
assert flex.max(flex.abs(result.y_obs - result.y_fit)) < 0.05


def test_resolution_cc_half(merging_stats):
result = resolution_analysis.resolution_cc_half(merging_stats, limit=0.82)
assert result.d_min == pytest.approx(1.242, abs=1e-3)
assert result.d_min == pytest.approx(1.272, abs=1e-3)
result = resolution_analysis.resolution_cc_half(
merging_stats,
limit=0.82,
Expand Down

0 comments on commit fb79018

Please sign in to comment.