reciprocalspaceship 1.0.3__py3-none-any.whl → 1.0.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- 1.0.3
1
+ 1.0.4
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env python
2
+ """
3
+ Summarize the contents of a CIF file.
4
+
5
+ Examples
6
+ --------
7
+ In order to summarize contents of file.cif::
8
+
9
+ > rs.cifdump file.cif
10
+
11
+ If you would like to interactively inspect file.cif in an IPython
12
+ shell, use the "--embed" argument::
13
+
14
+ > rs.cifdump file.cif --embed
15
+
16
+ If multiple CIF files are listed, they will be summarized sequentially,
17
+ and can be accessed in an IPython shell as a dictionary called `cifs`::
18
+
19
+ > rs.cifdump file1.cif file2.cif file3.cif --embed
20
+
21
+ Usage Details
22
+ -------------
23
+ """
24
+ import argparse
25
+
26
+ import pandas as pd
27
+
28
+ import reciprocalspaceship as rs
29
+
30
+ # If matplotlib is available, use pylab to setup IPython environment
31
+ try:
32
+ from pylab import *
33
+ except:
34
+ pass
35
+
36
+
37
+ def parse_arguments():
38
+ """Parse commandline arguments"""
39
+
40
+ parser = argparse.ArgumentParser(
41
+ formatter_class=argparse.RawTextHelpFormatter, description=__doc__
42
+ )
43
+
44
+ # Required arguments
45
+ parser.add_argument("cif", nargs="+", help="CIF file(s) to summarize")
46
+
47
+ # Optional arguments
48
+ parser.add_argument(
49
+ "--embed",
50
+ action="store_true",
51
+ help=(
52
+ "CIF file(s) will be summarized, and an IPython " "shell will be started"
53
+ ),
54
+ )
55
+ parser.add_argument(
56
+ "-p",
57
+ "--precision",
58
+ type=int,
59
+ default=3,
60
+ help="Number of significant digits to output for floats",
61
+ )
62
+
63
+ return parser
64
+
65
+
66
+ def summarize(cif, precision):
67
+ """Summarize contents of CIF file"""
68
+ with pd.option_context("display.precision", precision):
69
+ print(f"Spacegroup: {cif.spacegroup.short_name()}")
70
+ print(f"Extended Hermann-Mauguin name: {cif.spacegroup.xhm()}")
71
+ print(
72
+ (
73
+ f"Unit cell dimensions: {cif.cell.a:.3f} {cif.cell.b:.3f} {cif.cell.c:.3f} "
74
+ f"{cif.cell.alpha:.3f} {cif.cell.beta:.3f} {cif.cell.gamma:.3f}"
75
+ )
76
+ )
77
+ print(f"\ncif.head():\n\n{cif.head()}")
78
+ print(f"\ncif.describe():\n\n{cif.describe()}")
79
+ print(f"\ncif.dtypes:\n\n{cif.dtypes}")
80
+ return
81
+
82
+
83
+ def main():
84
+ # Parse commandline arguments
85
+ parser = parse_arguments()
86
+ args = parser.parse_args()
87
+
88
+ if len(args.cif) == 1:
89
+ cif = rs.read_cif(args.cif[0])
90
+ summarize(cif, args.precision)
91
+ else:
92
+ cifs = dict(zip(args.cif, map(rs.read_cif, args.cif)))
93
+ for key, value in cifs.items():
94
+ print(f"CIF file: {key}\n")
95
+ summarize(value, args.precision)
96
+ print(f"{'-'*50}")
97
+
98
+ # Begin IPython shell
99
+ if args.embed:
100
+ from IPython import embed
101
+
102
+ bold = "\033[1m"
103
+ end = "\033[0m"
104
+ if "cifs" in locals():
105
+ header = f"rs.DataSets stored in {bold}cifs{end} dictionary"
106
+ else:
107
+ header = f"rs.DataSet stored as {bold}cif{end}"
108
+ print()
109
+ embed(colors="neutral", header=header)
110
+
111
+ return
112
+
113
+
114
+ if __name__ == "__main__":
115
+ parser = main()
@@ -74,9 +74,13 @@ def summarize(mtz, precision):
74
74
  f"{mtz.cell.alpha:.3f} {mtz.cell.beta:.3f} {mtz.cell.gamma:.3f}"
75
75
  )
76
76
  )
77
- print(f"\nmtz.head():\n\n{mtz.head()}")
78
- print(f"\nmtz.describe():\n\n{mtz.describe()}")
79
- print(f"\nmtz.dtypes:\n\n{mtz.dtypes}")
77
+ if mtz.cell is not None:
78
+ dHKL = mtz.compute_dHKL().dHKL
79
+ print(f"Resolution range: {dHKL.max():.3f} - {dHKL.min():.3f} Å")
80
+ with pd.option_context("display.max_rows", None):
81
+ print(f"\nmtz.head():\n\n{mtz.head()}")
82
+ print(f"\nmtz.describe().T:\n\n{mtz.describe().T}")
83
+ print(f"\nmtz.dtypes:\n\n{mtz.dtypes}")
80
84
  return
81
85
 
82
86
 
@@ -43,6 +43,23 @@ class DataSet(pd.DataFrame):
43
43
  and attributes, please see the `Pandas.DataFrame documentation`_.
44
44
 
45
45
  .. _Pandas.DataFrame documentation: https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html
46
+
47
+ Attributes
48
+ ----------
49
+ acentrics : rs.DataSet
50
+ Access only the acentric reflections in this dataset
51
+ cell : gemmi.UnitCell
52
+ The unit cell
53
+ centrics : rs.DataSet
54
+ Access only the centric reflections in this dataset
55
+ hkls : ndarray, shape=(n_reflections, 3)
56
+ Miller indices in DataSet.
57
+ merged : bool
58
+ Whether this is a merged dataset or unmerged
59
+ spacegroup : gemmi.SpaceGroup
60
+ The space group
61
+ reindexing_ops : list
62
+ Possible reindexing ops consistent with the cell and spacegroup
46
63
  """
47
64
 
48
65
  _metadata = ["_spacegroup", "_cell", "_index_dtypes", "_merged"]
@@ -131,6 +148,38 @@ class DataSet(pd.DataFrame):
131
148
  def merged(self, val):
132
149
  self._merged = val
133
150
 
151
+ @property
152
+ @range_indexed
153
+ def hkls(self):
154
+ """Miller indices"""
155
+ hkl = self[["H", "K", "L"]].to_numpy(dtype=np.int32)
156
+ return hkl
157
+
158
+ def get_hkls(self):
159
+ """Get the Miller indices of the dataset."""
160
+ return self.hkls
161
+
162
+ @hkls.setter
163
+ @range_indexed
164
+ def hkls(self, hkls):
165
+ if isinstance(hkls, DataSet):
166
+ """Convert to numpy if hkls is a dataset"""
167
+ hkls = hkls.hkls
168
+ if isinstance(hkls, np.ndarray):
169
+ h, k, l = hkls[..., 0], hkls[..., 1], hkls[..., 2]
170
+ else:
171
+ """Try coercing to numpy"""
172
+ try:
173
+ hkls = np.array(hkls)
174
+ h, k, l = hkls[..., 0], hkls[..., 1], hkls[..., 2]
175
+ except:
176
+ raise ValueError(
177
+ "Unable to convert hkls to a suitable type. Please ensure hkls is a numpy array or rs.DataSet"
178
+ )
179
+ self["H"] = DataSeries(h, index=self.index, dtype="H")
180
+ self["K"] = DataSeries(k, index=self.index, dtype="H")
181
+ self["L"] = DataSeries(l, index=self.index, dtype="H")
182
+
134
183
  @property
135
184
  def centrics(self):
136
185
  """Access centric reflections in DataSet"""
@@ -1585,24 +1634,6 @@ class DataSet(pd.DataFrame):
1585
1634
  warnings.simplefilter("always")
1586
1635
  warnings.warn(message, DeprecationWarning)
1587
1636
 
1588
- if dmin is not None:
1589
- ds = self.loc[self.compute_dHKL().dHKL >= dmin, [key]]
1590
- else:
1591
- ds = self.loc[:, [key]]
1592
-
1593
- if gridsize is None:
1594
- gridsize = self.get_reciprocal_grid_size(dmin=dmin, sample_rate=sample_rate)
1595
-
1596
- # Set up P1 unit cell
1597
- p1 = ds.expand_to_p1()
1598
- p1 = p1.expand_anomalous()
1599
-
1600
- # Get data and indices
1601
- data = p1[key].to_numpy()
1602
- H = p1.get_hkls()
1603
-
1604
- # Populate grid
1605
- grid = np.zeros(gridsize, dtype=data.dtype)
1606
- grid[H[:, 0], H[:, 1], H[:, 2]] = data
1607
-
1608
- return grid
1637
+ return self.to_reciprocal_grid(
1638
+ key, sample_rate=sample_rate, dmin=dmin, grid_size=gridsize
1639
+ )
@@ -31,7 +31,7 @@ def read_precognition(hklfile, spacegroup=None, cell=None, logfile=None):
31
31
  F = pd.read_csv(
32
32
  hklfile,
33
33
  header=None,
34
- delim_whitespace=True,
34
+ sep="\\s+",
35
35
  names=["H", "K", "L", "F(+)", "SigF(+)", "F(-)", "SigF(-)"],
36
36
  usecols=usecols,
37
37
  )
@@ -49,7 +49,7 @@ def read_precognition(hklfile, spacegroup=None, cell=None, logfile=None):
49
49
  F = pd.read_csv(
50
50
  hklfile,
51
51
  header=None,
52
- delim_whitespace=True,
52
+ sep="\\s+",
53
53
  names=[
54
54
  "H",
55
55
  "K",
@@ -29,7 +29,7 @@ def compute_dHKL(H, cell):
29
29
  if inverse.shape[-1] == 1:
30
30
  inverse = inverse.squeeze(-1)
31
31
 
32
- F = np.array(cell.fractionalization_matrix.tolist()).astype(np.float64)
32
+ F = np.array(cell.frac.mat, dtype=np.float64)
33
33
  dhkls = np.reciprocal(np.linalg.norm((hkls @ F), 2, 1)).astype(np.float32)
34
34
  return dhkls[inverse]
35
35
 
@@ -50,6 +50,7 @@ def get_reciprocal_grid_size(cell, dmin, sample_rate=3.0, spacegroup=None):
50
50
 
51
51
  # Use gemmi.Mtz to find valid grid (FFT-friendly and obeys symmetry)
52
52
  m = gemmi.Mtz()
53
- m.spacegroup = spacegroup
53
+ if spacegroup is not None:
54
+ m.spacegroup = spacegroup
54
55
 
55
56
  return m.get_size_for_hkl(min_size=min_size)
@@ -131,4 +131,4 @@ def is_absent(H, spacegroup):
131
131
  absent : array
132
132
  Boolean array of length n. absent[i] == True if H[i] is systematically absent in sg.
133
133
  """
134
- return spacegroup.operations().systematic_absences(H)
134
+ return spacegroup.operations().systematic_absences(np.array(H, dtype=np.int32))
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: reciprocalspaceship
3
- Version: 1.0.3
3
+ Version: 1.0.4
4
4
  Summary: Tools for exploring reciprocal space
5
5
  Home-page: https://rs-station.github.io/reciprocalspaceship/
6
6
  Author: Kevin M. Dalton, Jack B. Greisman
@@ -19,7 +19,7 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
19
  Classifier: Programming Language :: Python
20
20
  Requires-Python: >=3.9
21
21
  License-File: LICENSE
22
- Requires-Dist: gemmi<=0.6.7,>=0.5.5
22
+ Requires-Dist: gemmi<=0.7.1,>=0.7.0
23
23
  Requires-Dist: pandas<=2.2.3,>=2.2.2
24
24
  Requires-Dist: numpy
25
25
  Requires-Dist: scipy
@@ -31,7 +31,7 @@ Requires-Dist: pytest-cov; extra == "dev"
31
31
  Requires-Dist: pytest-xdist; extra == "dev"
32
32
  Requires-Dist: ray; extra == "dev"
33
33
  Requires-Dist: sphinx; extra == "dev"
34
- Requires-Dist: sphinx-rtd-theme; extra == "dev"
34
+ Requires-Dist: sphinx_rtd_theme; extra == "dev"
35
35
  Requires-Dist: nbsphinx; extra == "dev"
36
36
  Requires-Dist: sphinx-design; extra == "dev"
37
37
  Requires-Dist: sphinxcontrib-autoprogram; extra == "dev"
@@ -49,6 +49,18 @@ Requires-Dist: matplotlib; extra == "examples"
49
49
  Requires-Dist: seaborn; extra == "examples"
50
50
  Requires-Dist: celluloid; extra == "examples"
51
51
  Requires-Dist: scikit-image; extra == "examples"
52
+ Dynamic: author
53
+ Dynamic: author-email
54
+ Dynamic: classifier
55
+ Dynamic: description
56
+ Dynamic: home-page
57
+ Dynamic: license
58
+ Dynamic: license-file
59
+ Dynamic: project-url
60
+ Dynamic: provides-extra
61
+ Dynamic: requires-dist
62
+ Dynamic: requires-python
63
+ Dynamic: summary
52
64
 
53
65
 
54
66
  ``reciprocalspaceship`` provides a ``pandas``-style interface for
@@ -1,15 +1,16 @@
1
- reciprocalspaceship/VERSION,sha256=9eXJU0UyhA_NRbsALmnthcYduidTRQ4mtEi33xSB4k0,6
1
+ reciprocalspaceship/VERSION,sha256=0bd7iPS59nWpAOQUOsdoohIYYjz-FwPKQxYjiMMnG9Y,6
2
2
  reciprocalspaceship/__init__.py,sha256=m6pXLI-HuXwefCfSE2Rs_2McqzuHw5W6yMBXEbceke8,2034
3
3
  reciprocalspaceship/concat.py,sha256=v2eg8-RBiNLYHkkPDeaozh3HvGCaFbmlC15FaeNJMgY,1695
4
4
  reciprocalspaceship/dataseries.py,sha256=ibU1bHMd8zORFxRtDswtvLh_n-miAyBqO0ghLmY29Js,6188
5
- reciprocalspaceship/dataset.py,sha256=6GMIMWVdKzOFhFsgODgvFn2-hrrMRMPw3-oDzlbL0YQ,57698
5
+ reciprocalspaceship/dataset.py,sha256=xLgTcmVuypcyTepu1gnLu3YpBz1KowzNQcCQwNpADDM,58889
6
6
  reciprocalspaceship/decorators.py,sha256=sZAPAV5fk5zUlwzub2VZy-u28XVNXjBpnqwnKjESWgY,5721
7
7
  reciprocalspaceship/algorithms/__init__.py,sha256=r5IYCGswTHXpSs9Q7c6PfEz8_P8d1fEei2SyTkp5aYY,258
8
8
  reciprocalspaceship/algorithms/intensity.py,sha256=iDHaqqrMAe0v-aTVT5jf54JwkNQLSQ7HhezPw6qZndg,2657
9
9
  reciprocalspaceship/algorithms/merge.py,sha256=iwPrDfjtliBwLqEzHbcIfoTkvS_0s2_CszS5IfrEUXI,2154
10
10
  reciprocalspaceship/algorithms/scale_merged_intensities.py,sha256=hNKKISCCDvchail1PZ_0r6sq1Rbgoraqaz1aDCayTYQ,11269
11
11
  reciprocalspaceship/commandline/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- reciprocalspaceship/commandline/mtzdump.py,sha256=JBg_W-CWQ6rbOOVmtK7TsErFXhCBR5pmC5RRSCapEZg,2939
12
+ reciprocalspaceship/commandline/cifdump.py,sha256=X9dU2nTFX-5sPlb6miWo7feMc7BPrTnBJsrbS_fOxmo,2938
13
+ reciprocalspaceship/commandline/mtzdump.py,sha256=ERSk2ORoOTtsdjml-QdxgozS6uzjMvAFWgKv163nVyM,3169
13
14
  reciprocalspaceship/dtypes/__init__.py,sha256=cO0M2F6pO_0jtqx-MlkbzqxLSmK1Ibmon5p_ksWmcbk,1038
14
15
  reciprocalspaceship/dtypes/base.py,sha256=1X56U4jKt_wjVkW930C9gP2Di0RpCMDZsDKNTxYle5I,1052
15
16
  reciprocalspaceship/dtypes/floating.py,sha256=jOQ25GZEE4QromaJA3_oeu0Tkjq1iT4dHCke_7W6TYo,19675
@@ -26,37 +27,37 @@ reciprocalspaceship/io/dials.py,sha256=FQQa3eT9TQw7h43ohyvNI3huViHE-eP9Y4IbRQL5d
26
27
  reciprocalspaceship/io/dials_mpi.py,sha256=wvm-sQqFG7N7bgcnxd5jn94eyKveimA3rvP8ns1B5Jg,1212
27
28
  reciprocalspaceship/io/mtz.py,sha256=_gdlx7Vi6Z0HyFBZFP6Ptmla7Pd_mON2KaGL4Q3N7Ik,8071
28
29
  reciprocalspaceship/io/pickle.py,sha256=clnSTK8T2O_d7midS_E54WHmXEHrL10d386gWx7ztsM,818
29
- reciprocalspaceship/io/precognition.py,sha256=DWRE2erXPVpm9-y5DjIWUHfmv9jZcsqoa47ienp1Sao,3641
30
+ reciprocalspaceship/io/precognition.py,sha256=xHBeKarVABmtm1DaYUOSs2UYsS3CFTDLCAd47jO03nI,3619
30
31
  reciprocalspaceship/stats/__init__.py,sha256=jdAWbpD_CKAn0W0sO_MKSnTu3bZSoLAXgb1_Y6jDMzk,197
31
32
  reciprocalspaceship/stats/completeness.py,sha256=1QM-Ac_V58nTLJoewbOK5CL69qsb0C0sc8L0c59WorQ,6702
32
33
  reciprocalspaceship/utils/__init__.py,sha256=bKJwbkxXa-TX2etIQgIESKkv9kdag1rHL77JLhI-2B8,1714
33
34
  reciprocalspaceship/utils/asu.py,sha256=WwxvIq-_QEF2UvyELuNudVo53daty9wiN-vaOYAUbKI,8680
34
35
  reciprocalspaceship/utils/binning.py,sha256=CHf5z8EsHSg34ZgC-yM_8Gd3D2BB8cqTtHAf7vwfgLo,2786
35
- reciprocalspaceship/utils/cell.py,sha256=aNIaugA3F8CRs9n8Ck0Rjc8YI7qHZcW3lJPE7yvj0dk,2053
36
- reciprocalspaceship/utils/grid.py,sha256=xB7sw1xrhgzFojrVHbC_uVBT3NMTBsvKsCqaRrVfvTQ,1893
36
+ reciprocalspaceship/utils/cell.py,sha256=MCebTyHrPiiy1H0A6OX3KWTrssw2LJ7ziA-anrfZULU,2027
37
+ reciprocalspaceship/utils/grid.py,sha256=MCpQ9wy0XN0U-Q7H3fwGmWlMzO1RiZtBYkIdDWxG7p4,1928
37
38
  reciprocalspaceship/utils/math.py,sha256=m6Iq9u0fjiieftzjQPAEHTN2htBIOwLhBCJdrcIN5Ao,1019
38
39
  reciprocalspaceship/utils/phases.py,sha256=zyiE99bq-TV_4aI6ZhBi4MLAvKwE3Sx1dFqppJL5rkE,2438
39
40
  reciprocalspaceship/utils/rfree.py,sha256=qFgepLOfgdU-cvZIMu8WfzlFExTc4jILff2ro7iu8FQ,3411
40
41
  reciprocalspaceship/utils/stats.py,sha256=p_1R3bTVVAVlDWh-hzcurlT8GOHkJA8ovFuQjD0w5AY,3681
41
- reciprocalspaceship/utils/structurefactors.py,sha256=ZW6CVPn_04dxay0DDnA0-byUrZnGraQ0kItqN1m5F3k,3686
42
+ reciprocalspaceship/utils/structurefactors.py,sha256=ykcog4yTuVrANrEnQxB7La5QQFn-7D38xsK3on_qVa0,3712
42
43
  reciprocalspaceship/utils/symmetry.py,sha256=xsYmEUo0PTH57-kctJdUq_-k14ci5LUGeG5LwzmjjPU,2963
43
44
  reciprocalspaceship/utils/units.py,sha256=ng-2hzZBERYo9bnQDPr-HLr7xPah-JzOthfrpHH816Y,388
45
+ reciprocalspaceship-1.0.4.dist-info/licenses/LICENSE,sha256=E22aZlYy5qJsJCJ94EkO_Vt3COio5UcLg59dZLPam7I,1093
44
46
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
45
47
  tests/conftest.py,sha256=bQZClqzu3lonsI01OdP5X38asMd7F76fAGzlWWYPXAI,3930
46
48
  tests/test_dataseries.py,sha256=go-q5tT8lLq3tlRVnmrwUytK7PlaoKs3CBPjWryGfGg,3309
47
- tests/test_dataset.py,sha256=Ir9cFhrzAtMAnoLZikrkiLqKUbDvCTr3xqdzeaKLH3M,23759
49
+ tests/test_dataset.py,sha256=VTyLNJggHtisRsYpegshbtFTYgOGES6QIAo2faVwnic,25011
48
50
  tests/test_dataset_anomalous.py,sha256=LQb1inSS_oDbVYEIyyx_GBFAkXGlEQYZ-ZhpwMeyMmQ,6963
49
51
  tests/test_dataset_binning.py,sha256=NgD_vy-TUh3vQrUVgysVBSZu75xN66LR6hRu2_qAUTs,3564
50
- tests/test_dataset_grid.py,sha256=S2EswVAbcg08WT9TjLtQ3YF1_zJmEKcucHrN3Lw5EM8,4086
52
+ tests/test_dataset_grid.py,sha256=tVFEUl3YA8XhCJa8tMNXQelakIgm5kStp10VhwTPzkY,4070
51
53
  tests/test_dataset_index.py,sha256=-6sMVgAKkkcYRc7UfLuVEH3p7D83o1S7e7c6MbrOrZo,2842
52
54
  tests/test_dataset_preserve_attributes.py,sha256=gwQQJGsiBZld2KKmLrcMkuc9zesR3FD7GVnPDNRScto,5314
53
55
  tests/test_dataset_signatures.py,sha256=ZbH9JNzqAWJDfVh9gqZVQXx8glmmBUhsbPmQBHe8Cuo,1554
54
56
  tests/test_dataset_symops.py,sha256=PV86tLu1qDACuk-YqjYQszk8Ctb0-h_NsQRnuCDFnOU,10864
55
57
  tests/test_decorators.py,sha256=ExR7mCU0iIqhHo4ho6ywPrZIEaGcsElaI4jtH9o5afE,5331
56
58
  tests/test_summarize_mtz_dtypes.py,sha256=JE0ctXMWii1AV-cmKogF6hjb8NCHrgvxNZ0ZRCHh-Ho,696
57
- reciprocalspaceship-1.0.3.dist-info/LICENSE,sha256=E22aZlYy5qJsJCJ94EkO_Vt3COio5UcLg59dZLPam7I,1093
58
- reciprocalspaceship-1.0.3.dist-info/METADATA,sha256=nvD6MJEEv_RHH-Dx5gj5fIvyHRRoTVUfkZxts37goQ4,3079
59
- reciprocalspaceship-1.0.3.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
60
- reciprocalspaceship-1.0.3.dist-info/entry_points.txt,sha256=Bqjl2J8UrG4UAHHhPbdH5r-xYaOdLCEdyRH6zJ9joDw,76
61
- reciprocalspaceship-1.0.3.dist-info/top_level.txt,sha256=tOo679MsLFS7iwiYZDwnKTuTpJLYVFBk6g9xnnB_s-w,26
62
- reciprocalspaceship-1.0.3.dist-info/RECORD,,
59
+ reciprocalspaceship-1.0.4.dist-info/METADATA,sha256=KhsqyH2rHwyy83eL3383KyLkX0EeoAbuHB11kdjd8VU,3326
60
+ reciprocalspaceship-1.0.4.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
61
+ reciprocalspaceship-1.0.4.dist-info/entry_points.txt,sha256=g-Bn5ZXMuODBSvJWj0PWIv4SVE-ibEplzFeiHH4kMDE,134
62
+ reciprocalspaceship-1.0.4.dist-info/top_level.txt,sha256=tOo679MsLFS7iwiYZDwnKTuTpJLYVFBk6g9xnnB_s-w,26
63
+ reciprocalspaceship-1.0.4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.45.0)
2
+ Generator: setuptools (80.3.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,2 +1,3 @@
1
1
  [console_scripts]
2
+ rs.cifdump = reciprocalspaceship.commandline.cifdump:main
2
3
  rs.mtzdump = reciprocalspaceship.commandline.mtzdump:main
tests/test_dataset.py CHANGED
@@ -711,3 +711,50 @@ def test_select_mtzdtype_ValueError(data_merged, dtype):
711
711
  """
712
712
  with pytest.raises(ValueError):
713
713
  data_merged.select_mtzdtype(dtype)
714
+
715
+
716
+ @pytest.mark.parametrize("merged", [True, False])
717
+ @pytest.mark.parametrize("hkl_type", ["ds", "index", "numpy"])
718
+ @pytest.mark.parametrize("range_index", [True, False])
719
+ def test_hkls_property_setter(
720
+ data_merged, data_unmerged, merged, hkl_type, range_index
721
+ ):
722
+ """
723
+ Test the setter for the .hkls property of rs datasets
724
+ """
725
+ if merged:
726
+ input_ds = data_merged
727
+ else:
728
+ input_ds = data_unmerged
729
+
730
+ hkls = input_ds.copy().reset_index()[["H", "K", "L"]]
731
+
732
+ ds = input_ds.copy()
733
+ if range_index:
734
+ ds = ds.reset_index()
735
+
736
+ # Confirm we're starting with equivalent miller indices
737
+ expected = ds.hkls
738
+ value = hkls
739
+
740
+ # Shuffle the hkls
741
+ hkls = hkls.sample(frac=1.0)
742
+
743
+ # confirm shuffling
744
+ assert not np.array_equal(hkls, ds.hkls)
745
+
746
+ # confirm setter
747
+ if hkl_type == "ds":
748
+ ds.hkls = hkls
749
+ elif hkl_type == "index":
750
+ ds.hkls = hkls.set_index(["H", "K", "L"])
751
+ elif hkl_type == "numpy":
752
+ ds.hkls = hkls.to_numpy()
753
+ expected = ds.hkls
754
+ value = hkls.hkls
755
+ assert np.array_equal(value, expected)
756
+
757
+ # Test that all data remained the same
758
+ for k in input_ds:
759
+ if k not in ["H", "K", "L"]:
760
+ assert np.array_equal(ds[k], input_ds[k])
@@ -22,10 +22,10 @@ def test_to_reciprocal_grid_gemmi(mtz_by_spacegroup, sample_rate, p1, use_sf):
22
22
  grid_size = dataset.get_reciprocal_grid_size(sample_rate=sample_rate)
23
23
 
24
24
  if use_sf:
25
- gemmigrid = gemmimtz.get_f_phi_on_grid("FMODEL", "PHIFMODEL", size=grid_size)
26
- expected = np.array(gemmigrid, copy=False)
27
25
  dataset["sf"] = dataset.to_structurefactor("FMODEL", "PHIFMODEL")
28
26
  result = dataset.to_reciprocal_grid("sf", grid_size=grid_size)
27
+ gemmigrid = gemmimtz.get_f_phi_on_grid("FMODEL", "PHIFMODEL", size=grid_size)
28
+ expected = gemmigrid.array
29
29
 
30
30
  # Requires rtol due to truncations applied in gemmi
31
31
  assert np.allclose(result, expected, rtol=1e-4)