Skip to content

Commit 1d9878f

Browse files
authored
Miscellaneous dials_regression --> dials-data test updates (dials#2907)
1 parent de6e5b5 commit 1d9878f

16 files changed

Lines changed: 89 additions & 111 deletions

.conda-envs/linux.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ c-compiler
55
colorlog
66
conda
77
cxx-compiler
8-
dials-data>=2.4.102
8+
dials-data>=2.4.107
99
docutils
1010
eigen
1111
ffbidx

.conda-envs/macos.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ c-compiler
55
colorlog
66
conda
77
cxx-compiler
8-
dials-data>=2.4.102
8+
dials-data>=2.4.107
99
docutils
1010
eigen
1111
flexparser<0.4

.conda-envs/windows.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ c-compiler
55
colorlog
66
conda
77
cxx-compiler
8-
dials-data>=2.4.102
8+
dials-data>=2.4.107
99
docutils
1010
eigen
1111
flexparser<0.4

newsfragments/2907.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Updated miscellaneous tests to use data from ``dials-data`` rather than ``dials_regression``.

tests/algorithms/indexing/test_index.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -503,18 +503,15 @@ def test_index_small_molecule_multi_sequence_4(dials_data, tmp_path):
503503
assert len(result.indexed_reflections) > 1250, len(result.indexed_reflections)
504504

505505

506-
def test_index_small_molecule_multi_sequence_3(
507-
dials_regression: pathlib.Path, tmp_path
508-
):
506+
def test_index_small_molecule_multi_sequence_3(dials_data, tmp_path):
509507
# test for small molecule multi-sequence indexing, 3 sequences with different values
510508
# of goniometer setting rotation (i.e. phi scans)
511-
data_dir = dials_regression / "dials-191"
512-
print(data_dir)
513-
pickle_paths = [
514-
sorted(data_dir.glob(f"*_SWEEP{i + 1}_strong.pickle"))[0] for i in range(3)
509+
data_dir = dials_data("misc_regression", pathlib=True)
510+
refl_paths = [
511+
str(data_dir / f"dials-191_sweep{i + 1}_strong.refl") for i in range(3)
515512
]
516513
sequence_paths = [
517-
sorted(data_dir.glob(f"*_SWEEP{i + 1}_experiments.json"))[0] for i in range(3)
514+
str(data_dir / f"dials-191_sweep{i + 1}_imported.expt") for i in range(3)
518515
]
519516
extra_args = ["filter_ice=False"]
520517
expected_unit_cell = uctbx.unit_cell(
@@ -524,7 +521,7 @@ def test_index_small_molecule_multi_sequence_3(
524521
expected_hall_symbol = " P 1"
525522

526523
result = run_indexing(
527-
pickle_paths,
524+
refl_paths,
528525
sequence_paths,
529526
tmp_path,
530527
extra_args,

tests/algorithms/spot_prediction/test_ray_predictor.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
from __future__ import annotations
22

33
import math
4-
import os
54

65
import pytest
76

87
from scitbx import matrix
98

109

1110
class RayPredictor:
12-
def __init__(self, dials_regression):
11+
def __init__(self, dials_data):
1312
import dxtbx
1413
from iotbx.xds import integrate_hkl, xparm
1514
from rstbx.cftbx.coordinate_frame_converter import coordinate_frame_converter
@@ -21,10 +20,9 @@ def __init__(self, dials_regression):
2120
from dials.util import ioutil
2221

2322
# The XDS files to read from
24-
integrate_filename = os.path.join(
25-
dials_regression, "data", "sim_mx", "INTEGRATE.HKL"
26-
)
27-
gxparm_filename = os.path.join(dials_regression, "data", "sim_mx", "GXPARM.XDS")
23+
data_dir = dials_data("misc_regression", pathlib=True)
24+
integrate_filename = str(data_dir / "sim_mx-INTEGRATE.HKL")
25+
gxparm_filename = str(data_dir / "sim_mx-GXPARM.XDS")
2826

2927
# Read the XDS files
3028
self.integrate_handle = integrate_hkl.reader()
@@ -94,8 +92,8 @@ def __init__(self, dials_regression):
9492

9593

9694
@pytest.fixture(scope="session")
97-
def raypredictor(dials_regression):
98-
return RayPredictor(dials_regression)
95+
def raypredictor(dials_data):
96+
return RayPredictor(dials_data)
9997

10098

10199
def test_miller_index_set(raypredictor):

tests/algorithms/spot_prediction/test_scan_static_reflection_predictor.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
import copy
4-
import os
54

65
import pytest
76

@@ -12,7 +11,7 @@
1211

1312

1413
class Data:
15-
def __init__(self, dials_data, dials_regression):
14+
def __init__(self, dials_data):
1615
self.experiments = ExperimentListFactory.from_json_file(
1716
dials_data("centroid_test_data", pathlib=True) / "experiments.json"
1817
)
@@ -22,10 +21,9 @@ def __init__(self, dials_data, dials_regression):
2221
self.experiments[0].imageset.set_goniometer(self.experiments[0].goniometer)
2322
self.experiments[0].imageset.set_scan(self.experiments[0].scan)
2423

25-
reflection_filename = os.path.join(
26-
dials_regression, "prediction_test_data", "expected_reflections.pickle"
24+
reflection_filename = str(
25+
dials_data("misc_regression", pathlib=True) / "prediction-expected.refl"
2726
)
28-
2927
self.reflections = flex.reflection_table.from_file(reflection_filename)
3028

3129
def predict_new(self, experiment=None, hkl=None, panel=None):
@@ -42,8 +40,8 @@ def predict_new(self, experiment=None, hkl=None, panel=None):
4240

4341

4442
@pytest.fixture(scope="session")
45-
def data(dials_data, dials_regression):
46-
return Data(dials_data, dials_regression)
43+
def data(dials_data):
44+
return Data(dials_data)
4745

4846

4947
def test_number_of_predictions(data):

tests/algorithms/spot_prediction/test_scan_varying_reflection_predictor.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
import copy
4-
import os
54

65
import pytest
76

@@ -11,16 +10,15 @@
1110

1211

1312
class Data:
14-
def __init__(self, dials_regression):
15-
path = os.path.join(
16-
dials_regression,
17-
"prediction_test_data",
18-
"experiments_scan_varying_crystal.json",
19-
)
13+
def __init__(self, dials_data):
14+
data_dir = dials_data("misc_regression", pathlib=True)
15+
path = str(data_dir / "prediction-varying-crystal.expt")
2016

2117
from dxtbx.model.experiment_list import ExperimentListFactory
2218

23-
self.experiments = ExperimentListFactory.from_json_file(path)
19+
self.experiments = ExperimentListFactory.from_json_file(
20+
path, check_format=False
21+
)
2422
assert len(self.experiments) == 1
2523
assert (
2624
self.experiments[0].crystal.num_scan_points
@@ -55,8 +53,8 @@ def _predict_new(self, hkl=None, frame=None, panel=None):
5553

5654

5755
@pytest.fixture(scope="session")
58-
def data(dials_regression):
59-
return Data(dials_regression)
56+
def data(dials_data):
57+
return Data(dials_data)
6058

6159

6260
def test_regression(data):

tests/algorithms/spot_prediction/test_spot_prediction.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
from __future__ import annotations
22

33
import math
4-
import os
54

65
import pytest
76

87
from scitbx import matrix
98

109

1110
class SpotPredictor:
12-
def __init__(self, dials_regression):
11+
def __init__(self, dials_data):
1312
import dxtbx
1413
from iotbx.xds import integrate_hkl, xparm
1514
from rstbx.cftbx.coordinate_frame_converter import coordinate_frame_converter
@@ -22,10 +21,9 @@ def __init__(self, dials_regression):
2221
from dials.util import ioutil
2322

2423
# The XDS files to read from
25-
integrate_filename = os.path.join(
26-
dials_regression, "data", "sim_mx", "INTEGRATE.HKL"
27-
)
28-
gxparm_filename = os.path.join(dials_regression, "data", "sim_mx", "GXPARM.XDS")
24+
data_dir = dials_data("misc_regression", pathlib=True)
25+
integrate_filename = str(data_dir / "sim_mx-INTEGRATE.HKL")
26+
gxparm_filename = str(data_dir / "sim_mx-GXPARM.XDS")
2927

3028
# Read the XDS files
3129
self.integrate_handle = integrate_hkl.reader()
@@ -93,8 +91,8 @@ def __init__(self, dials_regression):
9391

9492

9593
@pytest.fixture(scope="session")
96-
def spotpredictor(dials_regression):
97-
return SpotPredictor(dials_regression)
94+
def spotpredictor(dials_data):
95+
return SpotPredictor(dials_data)
9896

9997

10098
def test_dmin(spotpredictor):

tests/command_line/test_compute_delta_cchalf.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
from __future__ import annotations
44

5-
import os
65
import shutil
76
import subprocess
8-
from pathlib import Path
97

108
import pytest
119

@@ -84,12 +82,11 @@ def test_compute_delta_cchalf_scaled_data_mtz(dials_data, tmp_path):
8482
check_cchalf_result(f)
8583

8684

87-
def test_compute_delta_cchalf(dials_regression: Path):
85+
def test_compute_delta_cchalf(dials_data):
8886
"""Test compute delta cchalf on an integrated mtz."""
8987

90-
filename = os.path.join(
91-
dials_regression, "delta_cchalf_test_data", "test.XDS_ASCII.mtz"
92-
)
88+
data_dir = dials_data("misc_regression", pathlib=True)
89+
filename = str(data_dir / "delta-cchalf-test_XDS_ASCII.mtz")
9390
params = phil_scope.extract()
9491
params.nbins = 1
9592

0 commit comments

Comments
 (0)