rs-station / reciprocalspaceship

Tools for exploring reciprocal space
https://rs-station.github.io/reciprocalspaceship/
MIT License
28 stars 12 forks source link

`DataSet.write_mtz()` with unmerged DataSet moves reflections to ASU #110

Closed JBGreisman closed 2 years ago

JBGreisman commented 2 years ago

If a DataSet object contains unmerged reflections, a call to DataSet.write_mtz() currently has the side effect of calling DataSet.hkl_to_asu(inplace=True) on the object:

In [1]: ds = rs.read_mtz("data_unmerged.mtz")

In [2]: ds["BATCH"].head()
Out[2]: 
H    K    L 
19   -11  2    1424
3    18   -1    328
-17  21   17    576
21   26   -7     70
-9   17   11    798
Name: BATCH, dtype: Batch

In [3]: ds.write_mtz("/dev/null")

In [4]: ds["BATCH"].head()
Out[4]: 
H   K   L 
19  11  2    1424
18  3   1     328
21  17  17    576
26  21  7      70
17  9   11    798
Name: BATCH, dtype: Batch

I consider this to be a bug because writing data to a file should not change the underlying object.