reciprocalspaceship 1.0.3__tar.gz → 1.0.5__tar.gz

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.

Potentially problematic release.


This version of reciprocalspaceship might be problematic. Click here for more details.

Files changed (70) hide show
  1. {reciprocalspaceship-1.0.3/reciprocalspaceship.egg-info → reciprocalspaceship-1.0.5}/PKG-INFO +45 -3
  2. reciprocalspaceship-1.0.5/reciprocalspaceship/VERSION +1 -0
  3. reciprocalspaceship-1.0.5/reciprocalspaceship/commandline/cifdump.py +115 -0
  4. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/commandline/mtzdump.py +7 -3
  5. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/dataset.py +52 -21
  6. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/io/precognition.py +2 -2
  7. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/utils/cell.py +1 -1
  8. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/utils/grid.py +2 -1
  9. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/utils/structurefactors.py +1 -1
  10. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5/reciprocalspaceship.egg-info}/PKG-INFO +45 -3
  11. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship.egg-info/SOURCES.txt +1 -0
  12. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship.egg-info/entry_points.txt +1 -0
  13. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship.egg-info/requires.txt +4 -1
  14. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/setup.py +5 -2
  15. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/tests/test_dataset.py +47 -0
  16. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/tests/test_dataset_grid.py +2 -2
  17. reciprocalspaceship-1.0.3/reciprocalspaceship/VERSION +0 -1
  18. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/LICENSE +0 -0
  19. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/MANIFEST.in +0 -0
  20. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/README.md +0 -0
  21. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/__init__.py +0 -0
  22. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/algorithms/__init__.py +0 -0
  23. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/algorithms/intensity.py +0 -0
  24. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/algorithms/merge.py +0 -0
  25. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/algorithms/scale_merged_intensities.py +0 -0
  26. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/commandline/__init__.py +0 -0
  27. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/concat.py +0 -0
  28. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/dataseries.py +0 -0
  29. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/decorators.py +0 -0
  30. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/dtypes/__init__.py +0 -0
  31. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/dtypes/base.py +0 -0
  32. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/dtypes/floating.py +0 -0
  33. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/dtypes/inference.py +0 -0
  34. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/dtypes/integer.py +0 -0
  35. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/dtypes/internals.py +0 -0
  36. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/dtypes/summarize.py +0 -0
  37. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/io/__init__.py +0 -0
  38. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/io/ccp4map.py +0 -0
  39. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/io/common.py +0 -0
  40. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/io/crystfel.py +0 -0
  41. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/io/csv.py +0 -0
  42. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/io/dials.py +0 -0
  43. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/io/dials_mpi.py +0 -0
  44. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/io/mtz.py +0 -0
  45. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/io/pickle.py +0 -0
  46. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/stats/__init__.py +0 -0
  47. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/stats/completeness.py +0 -0
  48. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/utils/__init__.py +0 -0
  49. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/utils/asu.py +0 -0
  50. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/utils/binning.py +0 -0
  51. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/utils/math.py +0 -0
  52. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/utils/phases.py +0 -0
  53. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/utils/rfree.py +0 -0
  54. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/utils/stats.py +0 -0
  55. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/utils/symmetry.py +0 -0
  56. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship/utils/units.py +0 -0
  57. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship.egg-info/dependency_links.txt +0 -0
  58. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/reciprocalspaceship.egg-info/top_level.txt +0 -0
  59. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/setup.cfg +0 -0
  60. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/tests/__init__.py +0 -0
  61. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/tests/conftest.py +0 -0
  62. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/tests/test_dataseries.py +0 -0
  63. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/tests/test_dataset_anomalous.py +0 -0
  64. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/tests/test_dataset_binning.py +0 -0
  65. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/tests/test_dataset_index.py +0 -0
  66. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/tests/test_dataset_preserve_attributes.py +0 -0
  67. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/tests/test_dataset_signatures.py +0 -0
  68. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/tests/test_dataset_symops.py +0 -0
  69. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/tests/test_decorators.py +0 -0
  70. {reciprocalspaceship-1.0.3 → reciprocalspaceship-1.0.5}/tests/test_summarize_mtz_dtypes.py +0 -0
@@ -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.5
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
@@ -18,9 +18,51 @@ Classifier: Topic :: Scientific/Engineering :: Physics
18
18
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
19
  Classifier: Programming Language :: Python
20
20
  Requires-Python: >=3.9
21
+ License-File: LICENSE
22
+ Requires-Dist: gemmi<=0.7.1,>=0.7.0
23
+ Requires-Dist: pandas<=2.2.3,>=2.2.2
24
+ Requires-Dist: numpy
25
+ Requires-Dist: scipy
26
+ Requires-Dist: ipython
27
+ Requires-Dist: msgpack
28
+ Requires-Dist: setuptools
21
29
  Provides-Extra: dev
30
+ Requires-Dist: pytest; extra == "dev"
31
+ Requires-Dist: pytest-cov; extra == "dev"
32
+ Requires-Dist: pytest-xdist; extra == "dev"
33
+ Requires-Dist: ray; extra == "dev"
34
+ Provides-Extra: doc
35
+ Requires-Dist: sphinx; extra == "doc"
36
+ Requires-Dist: sphinx_rtd_theme; extra == "doc"
37
+ Requires-Dist: nbsphinx; extra == "doc"
38
+ Requires-Dist: sphinx-design; extra == "doc"
39
+ Requires-Dist: sphinxcontrib-autoprogram; extra == "doc"
40
+ Requires-Dist: autodocsumm; extra == "doc"
41
+ Requires-Dist: jupyter; extra == "doc"
42
+ Requires-Dist: tqdm; extra == "doc"
43
+ Requires-Dist: matplotlib; extra == "doc"
44
+ Requires-Dist: seaborn; extra == "doc"
45
+ Requires-Dist: celluloid; extra == "doc"
46
+ Requires-Dist: scikit-image; extra == "doc"
22
47
  Provides-Extra: examples
23
- License-File: LICENSE
48
+ Requires-Dist: jupyter; extra == "examples"
49
+ Requires-Dist: tqdm; extra == "examples"
50
+ Requires-Dist: matplotlib; extra == "examples"
51
+ Requires-Dist: seaborn; extra == "examples"
52
+ Requires-Dist: celluloid; extra == "examples"
53
+ Requires-Dist: scikit-image; extra == "examples"
54
+ Dynamic: author
55
+ Dynamic: author-email
56
+ Dynamic: classifier
57
+ Dynamic: description
58
+ Dynamic: home-page
59
+ Dynamic: license
60
+ Dynamic: license-file
61
+ Dynamic: project-url
62
+ Dynamic: provides-extra
63
+ Dynamic: requires-dist
64
+ Dynamic: requires-python
65
+ Dynamic: summary
24
66
 
25
67
 
26
68
  ``reciprocalspaceship`` provides a ``pandas``-style interface for
@@ -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.5
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
@@ -18,9 +18,51 @@ Classifier: Topic :: Scientific/Engineering :: Physics
18
18
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
19
  Classifier: Programming Language :: Python
20
20
  Requires-Python: >=3.9
21
+ License-File: LICENSE
22
+ Requires-Dist: gemmi<=0.7.1,>=0.7.0
23
+ Requires-Dist: pandas<=2.2.3,>=2.2.2
24
+ Requires-Dist: numpy
25
+ Requires-Dist: scipy
26
+ Requires-Dist: ipython
27
+ Requires-Dist: msgpack
28
+ Requires-Dist: setuptools
21
29
  Provides-Extra: dev
30
+ Requires-Dist: pytest; extra == "dev"
31
+ Requires-Dist: pytest-cov; extra == "dev"
32
+ Requires-Dist: pytest-xdist; extra == "dev"
33
+ Requires-Dist: ray; extra == "dev"
34
+ Provides-Extra: doc
35
+ Requires-Dist: sphinx; extra == "doc"
36
+ Requires-Dist: sphinx_rtd_theme; extra == "doc"
37
+ Requires-Dist: nbsphinx; extra == "doc"
38
+ Requires-Dist: sphinx-design; extra == "doc"
39
+ Requires-Dist: sphinxcontrib-autoprogram; extra == "doc"
40
+ Requires-Dist: autodocsumm; extra == "doc"
41
+ Requires-Dist: jupyter; extra == "doc"
42
+ Requires-Dist: tqdm; extra == "doc"
43
+ Requires-Dist: matplotlib; extra == "doc"
44
+ Requires-Dist: seaborn; extra == "doc"
45
+ Requires-Dist: celluloid; extra == "doc"
46
+ Requires-Dist: scikit-image; extra == "doc"
22
47
  Provides-Extra: examples
23
- License-File: LICENSE
48
+ Requires-Dist: jupyter; extra == "examples"
49
+ Requires-Dist: tqdm; extra == "examples"
50
+ Requires-Dist: matplotlib; extra == "examples"
51
+ Requires-Dist: seaborn; extra == "examples"
52
+ Requires-Dist: celluloid; extra == "examples"
53
+ Requires-Dist: scikit-image; extra == "examples"
54
+ Dynamic: author
55
+ Dynamic: author-email
56
+ Dynamic: classifier
57
+ Dynamic: description
58
+ Dynamic: home-page
59
+ Dynamic: license
60
+ Dynamic: license-file
61
+ Dynamic: project-url
62
+ Dynamic: provides-extra
63
+ Dynamic: requires-dist
64
+ Dynamic: requires-python
65
+ Dynamic: summary
24
66
 
25
67
 
26
68
  ``reciprocalspaceship`` provides a ``pandas``-style interface for
@@ -20,6 +20,7 @@ reciprocalspaceship/algorithms/intensity.py
20
20
  reciprocalspaceship/algorithms/merge.py
21
21
  reciprocalspaceship/algorithms/scale_merged_intensities.py
22
22
  reciprocalspaceship/commandline/__init__.py
23
+ reciprocalspaceship/commandline/cifdump.py
23
24
  reciprocalspaceship/commandline/mtzdump.py
24
25
  reciprocalspaceship/dtypes/__init__.py
25
26
  reciprocalspaceship/dtypes/base.py
@@ -1,2 +1,3 @@
1
1
  [console_scripts]
2
+ rs.cifdump = reciprocalspaceship.commandline.cifdump:main
2
3
  rs.mtzdump = reciprocalspaceship.commandline.mtzdump:main
@@ -1,15 +1,18 @@
1
- gemmi<=0.6.7,>=0.5.5
1
+ gemmi<=0.7.1,>=0.7.0
2
2
  pandas<=2.2.3,>=2.2.2
3
3
  numpy
4
4
  scipy
5
5
  ipython
6
6
  msgpack
7
+ setuptools
7
8
 
8
9
  [dev]
9
10
  pytest
10
11
  pytest-cov
11
12
  pytest-xdist
12
13
  ray
14
+
15
+ [doc]
13
16
  sphinx
14
17
  sphinx_rtd_theme
15
18
  nbsphinx
@@ -74,22 +74,25 @@ setup(
74
74
  project_urls=PROJECT_URLS,
75
75
  python_requires=">=3.9",
76
76
  install_requires=[
77
- "gemmi>=0.5.5, <=0.6.7",
77
+ "gemmi>=0.7.0, <=0.7.1",
78
78
  "pandas>=2.2.2, <=2.2.3",
79
79
  "numpy",
80
80
  "scipy",
81
81
  "ipython",
82
82
  "msgpack",
83
+ "setuptools",
83
84
  ],
84
85
  setup_requires=["pytest-runner"],
85
86
  tests_require=tests_require,
86
87
  extras_require={
87
- "dev": tests_require + docs_require + examples_require,
88
+ "dev": tests_require,
89
+ "doc" : docs_require + examples_require,
88
90
  "examples": examples_require,
89
91
  },
90
92
  entry_points={
91
93
  "console_scripts": [
92
94
  "rs.mtzdump=reciprocalspaceship.commandline.mtzdump:main",
95
+ "rs.cifdump=reciprocalspaceship.commandline.cifdump:main",
93
96
  ]
94
97
  },
95
98
  classifiers=[
@@ -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)
@@ -1 +0,0 @@
1
- 1.0.3