Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions newsfragments/862.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update dials-data uses for the new always-pathlib dials-data.
4 changes: 1 addition & 3 deletions tests/command_line/test_average.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ def test_average(dials_data, tmp_path, use_mpi):
if use_mpi:
pytest.importorskip("mpi4py")

data = (
dials_data("image_examples", pathlib=True) / "SACLA-MPCCD-run266702-0-subset.h5"
)
data = dials_data("image_examples") / "SACLA-MPCCD-run266702-0-subset.h5"
if use_mpi:
command = "mpirun"
mpargs = "-n 2 dxtbx.image_average --mpi=True".split()
Expand Down
4 changes: 2 additions & 2 deletions tests/command_line/test_dlsnxs2cbf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

@pytest.mark.xfail(reason="Broken for old data while collecting new data")
def test_dlsnxs2cbf(dials_data, tmp_path, capsys):
screen = dials_data("thaumatin_eiger_screen", pathlib=True)
screen = dials_data("thaumatin_eiger_screen")
master = screen / "Therm_6_1_master.h5"
run([str(master), "junk_%04d.cbf"])

Expand Down Expand Up @@ -48,7 +48,7 @@ def test_dlsnxs2cbf(dials_data, tmp_path, capsys):
@pytest.mark.parametrize("remove_axis", ["phi", "chi"], ids=["no phi", "no chi"])
def test_dlsnxs2cbf_deleted_axis(dials_data, tmp_path, remove_axis):
"""Check that a master file without φ or χ axes processes OK."""
screen = dials_data("thaumatin_eiger_screen", pathlib=True)
screen = dials_data("thaumatin_eiger_screen")
master = "Therm_6_1_master.h5"
links = (path.name for path in screen.glob("*") if path.name != master)
try:
Expand Down
2 changes: 1 addition & 1 deletion tests/command_line/test_plot_detector_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


def test_plot_models_noninteractive_to_pdf(dials_data, tmp_path):
ssx = dials_data("cunir_serial_processed", pathlib=True)
ssx = dials_data("cunir_serial_processed")
expts = str(ssx / "imported_no_ref_5.expt")
subprocess.run(
[shutil.which("dxtbx.plot_detector_models"), expts, "pdf_file=plot_test.pdf"],
Expand Down
2 changes: 1 addition & 1 deletion tests/command_line/test_print_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


def test_print_header(dials_data, capsys):
screen = dials_data("thaumatin_eiger_screen", pathlib=True)
screen = dials_data("thaumatin_eiger_screen")
master = screen / "Therm_6_1_master.h5"
print_header.run([str(master)])

Expand Down
2 changes: 1 addition & 1 deletion tests/command_line/test_show_mask_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


def test_show_mask_info(dials_data, capsys):
data = dials_data("image_examples", pathlib=True) / "dectris_eiger_master.h5"
data = dials_data("image_examples") / "dectris_eiger_master.h5"

show_mask_info.run([str(data)])
captured = capsys.readouterr()
Expand Down
4 changes: 1 addition & 3 deletions tests/format/test_FormatCBFFullPilatusDLS6MSN126.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@


def test_DLS_I03_smargon(dials_data):
filename = (
dials_data("image_examples", pathlib=True) / "DLS_I03_smargon_0001.cbf.gz"
)
filename = dials_data("image_examples") / "DLS_I03_smargon_0001.cbf.gz"
assert FormatCBFFullPilatusDLS6MSN126.understand(filename)
expts = ExperimentListFactory.from_filenames(
[filename], format_kwargs={"dynamic_shadowing": True}
Expand Down
4 changes: 1 addition & 3 deletions tests/format/test_FormatCBFMiniEigerDLS16MSN160.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@


def test_dlsnxs2cbf_therm(dials_data):
filename = (
dials_data("image_examples", pathlib=True) / "dlsnxs2cbf_therm_0001.cbf.gz"
)
filename = dials_data("image_examples") / "dlsnxs2cbf_therm_0001.cbf.gz"

assert FormatCBFMiniEigerDLS16MSN160.understand(filename)
expts = ExperimentListFactory.from_filenames(
Expand Down
4 changes: 2 additions & 2 deletions tests/format/test_FormatCBFMiniPilatus.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


def test_single_panel(dials_data, tmpdir):
filename = dials_data("x4wide", pathlib=True) / "X4_wide_M1S4_2_0001.cbf"
filename = dials_data("x4wide") / "X4_wide_M1S4_2_0001.cbf"

assert FormatCBFMiniPilatus.understand(filename)
expts = ExperimentListFactory.from_filenames([filename])
Expand All @@ -17,7 +17,7 @@ def test_single_panel(dials_data, tmpdir):


def test_multi_panel(dials_data, tmpdir):
filename = dials_data("x4wide", pathlib=True) / "X4_wide_M1S4_2_0001.cbf"
filename = dials_data("x4wide") / "X4_wide_M1S4_2_0001.cbf"

assert FormatCBFMiniPilatus.understand(filename)
expts = ExperimentListFactory.from_filenames(
Expand Down
4 changes: 1 addition & 3 deletions tests/format/test_FormatCBFMiniPilatusDLS12M.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ def test_bad_pixel_mask(timestamp, multi_panel, masked_pixel_count, dials_data,
)
mocked_timestamp.return_value = timestamp

image_path = str(
dials_data("image_examples", pathlib=True) / "DLS_I23-germ_13KeV_0001.cbf.bz2"
)
image_path = str(dials_data("image_examples") / "DLS_I23-germ_13KeV_0001.cbf.bz2")
experiments = ExperimentListFactory.from_filenames(
[image_path], format_kwargs={"multi_panel": multi_panel}
)
Expand Down
2 changes: 1 addition & 1 deletion tests/format/test_FormatHDF5EigerNearlyNexus.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_biomax_vertical_goniometer_at_diamond(tmpdir):


def test_semi_synthetic_dectris_eiger_nearly_nexus(dials_data, tmpdir):
master_h5 = dials_data("image_examples", pathlib=True) / "dectris_eiger_master.h5"
master_h5 = dials_data("image_examples") / "dectris_eiger_master.h5"

if not os.access(master_h5, os.R_OK):
pytest.skip("Test images not available")
Expand Down
2 changes: 1 addition & 1 deletion tests/format/test_FormatHDF5EigerNearlyNexusSPring8.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

def test_spring8_ccp4_2018_zenodo_1443110_data03(dials_data):
master_h5 = (
dials_data("spring8_ccp4_2018", pathlib=True)
dials_data("spring8_ccp4_2018")
/ "ccp4school2018_bl41xu"
/ "05"
/ "data03"
Expand Down
22 changes: 5 additions & 17 deletions tests/format/test_FormatHDF5SaclaMPCCD.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@


def test_static_mask(dials_data):
master_h5 = (
dials_data("image_examples", pathlib=True)
/ "SACLA-MPCCD-Phase3-21528-5images.h5"
)
master_h5 = dials_data("image_examples") / "SACLA-MPCCD-Phase3-21528-5images.h5"
assert FormatHDF5SaclaMPCCD.understand(master_h5)

expts_from_filename = ExperimentListFactory.from_filenames([master_h5])
Expand All @@ -35,10 +32,7 @@ def test_static_mask(dials_data):


def test_MPCCD_Phase3_21528(dials_data):
master_h5 = (
dials_data("image_examples", pathlib=True)
/ "SACLA-MPCCD-Phase3-21528-5images.h5"
)
master_h5 = dials_data("image_examples") / "SACLA-MPCCD-Phase3-21528-5images.h5"
assert FormatHDF5SaclaMPCCD.understand(master_h5)
expts = ExperimentListFactory.from_filenames([master_h5])
imageset = expts[0].imageset
Expand Down Expand Up @@ -81,10 +75,7 @@ def test_MPCCD_RECONST_MODE(dials_data, monkeypatch):
else:
monkeypatch.delenv("MPCCD_RECONST_MODE", raising=False)

master_h5 = (
dials_data("image_examples", pathlib=True)
/ "SACLA-MPCCD-Phase3-21528-5images.h5"
)
master_h5 = dials_data("image_examples") / "SACLA-MPCCD-Phase3-21528-5images.h5"
expts = ExperimentListFactory.from_filenames([master_h5])
imageset = expts[0].imageset
# Horrible hack to work around format_instance caching
Expand All @@ -107,10 +98,7 @@ def test_MPCCD_RECONST_MODE(dials_data, monkeypatch):


def test_combine_with_user_static_mask(dials_data, tmpdir):
master_h5 = (
dials_data("image_examples", pathlib=True)
/ "SACLA-MPCCD-Phase3-21528-5images.h5"
)
master_h5 = dials_data("image_examples") / "SACLA-MPCCD-Phase3-21528-5images.h5"
assert FormatHDF5SaclaMPCCD.understand(master_h5)

expts_from_filename = ExperimentListFactory.from_filenames([master_h5])
Expand Down Expand Up @@ -154,7 +142,7 @@ def test_HDF5_format_caching(dials_data, clear_cache):
xfail: see https://github.com/cctbx/dxtbx/issues/245
"""
img_file = "SACLA-MPCCD-Phase3-21528-5images.h5"
master_h5 = dials_data("image_examples", pathlib=True) / img_file
master_h5 = dials_data("image_examples") / img_file

expts1 = ExperimentListFactory.from_filenames([master_h5])
expts1[0].imageset.get_mask(0)
Expand Down
2 changes: 1 addition & 1 deletion tests/format/test_FormatISISSXD.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@pytest.fixture(scope="session")
def nacl(dials_data):
location = dials_data("isis_sxd_example_data", pathlib=True)
location = dials_data("isis_sxd_example_data")
nacl_filename = join(location, "sxd_nacl_run.nxs")
return nacl_filename

Expand Down
4 changes: 1 addition & 3 deletions tests/format/test_FormatNXmxDLS16M.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,7 @@ def test_grid_scan_i04():
raises=AssertionError, reason="https://github.com/cctbx/dxtbx/issues/13"
)
def test_screening(dials_data):
master_h5 = (
dials_data("thaumatin_eiger_screen", pathlib=True) / "Therm_6_1_master.h5"
)
master_h5 = dials_data("thaumatin_eiger_screen") / "Therm_6_1_master.h5"
assert FormatNXmxDLS16M.understand(master_h5)

expts = ExperimentListFactory.from_filenames([master_h5])
Expand Down
2 changes: 1 addition & 1 deletion tests/format/test_FormatPYunspecified.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


def test_static_mask(dials_data):
data_dir = dials_data("image_examples", pathlib=True)
data_dir = dials_data("image_examples")
filename = str(
data_dir / "LCLS_CXI-shot-s00-2011-12-02T21_07Z29.723_00569.pickle",
)
Expand Down
2 changes: 1 addition & 1 deletion tests/format/test_FormatSMVADSC.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


def test_noninteger_pedestal(dials_data, tmpdir):
data_dir = dials_data("image_examples", pathlib=True)
data_dir = dials_data("image_examples")
filename = str(data_dir / "APS_14BMC-q315_1_001.img.bz2")
# Read this file in as data
with bz2.open(filename, "rb") as f:
Expand Down
2 changes: 1 addition & 1 deletion tests/format/test_cbf_mini_as_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
],
)
def test_cbf_writer(image_file, dials_data, tmp_path):
data_dir = dials_data("image_examples", pathlib=True)
data_dir = dials_data("image_examples")
filename = str(data_dir / image_file)
imageset = ExperimentListFactory.from_filenames([filename])[0].imageset
output_file = tmp_path / "image_0001.cbf"
Expand Down
2 changes: 1 addition & 1 deletion tests/format/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


def test_reading_refl_failure(dials_data):
test_data = dials_data("centroid_test_data", pathlib=True)
test_data = dials_data("centroid_test_data")

assert Registry.get_format_class_for_file(test_data / "indexed.refl") is None
# Check .expt while here
Expand Down
2 changes: 1 addition & 1 deletion tests/format/test_nexus.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def nexus_file(tmp_path_factory) -> Path:


def test_data_factory_nxs(dials_data):
nxs_file = dials_data("vmxi_thaumatin", pathlib=True) / "image_15799.nxs"
nxs_file = dials_data("vmxi_thaumatin") / "image_15799.nxs"
with h5py.File(nxs_file) as fh:
data = fh["/entry/data"]
data_factory = nexus.DataFactory(nexus.NXdata(data))
Expand Down
2 changes: 1 addition & 1 deletion tests/imagelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import dials_data.download

df = dials_data.download.DataFetcher()
data_dir = df("image_examples", pathlib=True)
data_dir = df("image_examples")
image_examples = []
for f in data_dir.iterdir():
ext = os.path.splitext(f)[1]
Expand Down
3 changes: 1 addition & 2 deletions tests/masking/test_masking.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ def _construct_shadow_masker(goniometer):
@pytest.fixture
def dls_i23_experiment(dials_data):
experiments_file = str(
dials_data("shadow_test_data", pathlib=True)
/ "DLS_I23_Kappa-data_1_0400.cbf.gz"
dials_data("shadow_test_data") / "DLS_I23_Kappa-data_1_0400.cbf.gz"
)
experiments = ExperimentListFactory.from_filenames([experiments_file])
return experiments[0]
Expand Down
2 changes: 1 addition & 1 deletion tests/model/test_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def test_get_detector_projection_2d_axes():
def test_get_panel_projection_2d_from_axes(dials_data):
# Get test data
pytest.importorskip("h5py")
filename = dials_data("image_examples", pathlib=True) / "dectris_eiger_master.h5"
filename = dials_data("image_examples") / "dectris_eiger_master.h5"
experiment = ExperimentListFactory.from_filenames([filename])[0]
detector = experiment.detector

Expand Down
Loading