diff --git a/reciprocalspaceship/io/dials.py b/reciprocalspaceship/io/dials.py index 56918f55..b3b075aa 100644 --- a/reciprocalspaceship/io/dials.py +++ b/reciprocalspaceship/io/dials.py @@ -181,9 +181,9 @@ def _read_dials_stills_ray(fnames, unitcell, spacegroup, numjobs=10, extra_cols= def dials_to_mtz_dtypes(ds, inplace=True): """ - Coerce the dtypes in ds into ones that can be written to an mtz file. + Coerce the dtypes in ds into ones that can be written to an mtz file. This will downcast doubles to single precision. If "variance" columns - are present, they will be converted to "sigma" and assigned + are present, they will be converted to "sigma" and assigned StandardDeviationDtype. Parameters @@ -226,7 +226,7 @@ def read_dials_stills( """ Read reflections from still images processed by DIALS from fnames and return them as a DataSet. By default, this function will not convert the data from - dials into an MTZ compatible format. + dials into an MTZ compatible format. Parameters ---------- diff --git a/tests/io/test_dials.py b/tests/io/test_dials.py index 8541b2d9..e042cc59 100644 --- a/tests/io/test_dials.py +++ b/tests/io/test_dials.py @@ -101,6 +101,7 @@ def make_refls(unit_cell, sg, seed=8675309, file_prefix=""): ds0.set_index(["H", "K", "L"], inplace=True, drop=True) return ds0, pack_names + def test_dials_mtz_conversion(): unit_cell = 78, 78, 235, 90, 90, 120 sg = "P 65 2 2" @@ -109,16 +110,23 @@ def test_dials_mtz_conversion(): prefix = tdir + "/" ds0, pack_names = make_refls(unit_cell, sg, file_prefix=prefix) ds = read_dials_stills( - pack_names, unit_cell, sg, parallel_backend=None, numjobs=1, verbose=False, mtz_dtypes=True + pack_names, + unit_cell, + sg, + parallel_backend=None, + numjobs=1, + verbose=False, + mtz_dtypes=True, ) - mtzout = tdir + '/ds.mtz' + mtzout = tdir + "/ds.mtz" ds.write_mtz(mtzout) assert os.path.exists(mtzout) test_ds = rs.read_mtz(mtzout).reset_index() for k in ds: assert np.allclose(ds[k], test_ds[k]) + @pytest.mark.parametrize("parallel_backend", ["mpi", "ray"]) @pytest.mark.parametrize("mtz_dtypes", [True, False]) def test_dials_reader(parallel_backend, mtz_dtypes, verbose=False): @@ -134,7 +142,13 @@ def test_dials_reader(parallel_backend, mtz_dtypes, verbose=False): ds0, pack_names = make_refls(unit_cell, sg, file_prefix=prefix) # read without parallelization ds1 = read_dials_stills( - pack_names, unit_cell, sg, parallel_backend=None, numjobs=1, verbose=verbose, mtz_dtypes=mtz_dtypes + pack_names, + unit_cell, + sg, + parallel_backend=None, + numjobs=1, + verbose=verbose, + mtz_dtypes=mtz_dtypes, ) gemmi_unit_cell = gemmi.UnitCell(*unit_cell) gemmi_sg = gemmi.SpaceGroup(sg)