reciprocalspaceship 1.0.0__tar.gz → 1.0.2__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 (79) hide show
  1. {reciprocalspaceship-1.0.0/reciprocalspaceship.egg-info → reciprocalspaceship-1.0.2}/PKG-INFO +2 -5
  2. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/README.md +2 -2
  3. reciprocalspaceship-1.0.2/reciprocalspaceship/VERSION +1 -0
  4. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/__init__.py +1 -0
  5. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/algorithms/scale_merged_intensities.py +8 -7
  6. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/commandline/mtzdump.py +0 -1
  7. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/dataset.py +7 -1
  8. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/decorators.py +2 -2
  9. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/dtypes/__init__.py +16 -14
  10. reciprocalspaceship-1.0.2/reciprocalspaceship/dtypes/base.py +37 -0
  11. reciprocalspaceship-1.0.2/reciprocalspaceship/dtypes/floating.py +691 -0
  12. reciprocalspaceship-1.0.2/reciprocalspaceship/dtypes/integer.py +537 -0
  13. reciprocalspaceship-1.0.2/reciprocalspaceship/dtypes/internals.py +1365 -0
  14. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/io/__init__.py +7 -1
  15. reciprocalspaceship-1.0.2/reciprocalspaceship/io/crystfel.py +604 -0
  16. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/io/mtz.py +25 -0
  17. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/stats/completeness.py +0 -1
  18. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/utils/__init__.py +6 -1
  19. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/utils/asu.py +6 -0
  20. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/utils/cell.py +5 -0
  21. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/utils/stats.py +5 -7
  22. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/utils/structurefactors.py +5 -0
  23. reciprocalspaceship-1.0.2/reciprocalspaceship/utils/units.py +19 -0
  24. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2/reciprocalspaceship.egg-info}/PKG-INFO +2 -5
  25. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship.egg-info/SOURCES.txt +3 -11
  26. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship.egg-info/entry_points.txt +0 -1
  27. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship.egg-info/requires.txt +4 -3
  28. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/setup.py +5 -5
  29. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/tests/test_dataseries.py +1 -1
  30. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/tests/test_dataset_preserve_attributes.py +3 -9
  31. reciprocalspaceship-1.0.0/reciprocalspaceship/VERSION +0 -1
  32. reciprocalspaceship-1.0.0/reciprocalspaceship/dtypes/anomalousdifference.py +0 -25
  33. reciprocalspaceship-1.0.0/reciprocalspaceship/dtypes/base.py +0 -282
  34. reciprocalspaceship-1.0.0/reciprocalspaceship/dtypes/batch.py +0 -25
  35. reciprocalspaceship-1.0.0/reciprocalspaceship/dtypes/hklindex.py +0 -23
  36. reciprocalspaceship-1.0.0/reciprocalspaceship/dtypes/intensity.py +0 -47
  37. reciprocalspaceship-1.0.0/reciprocalspaceship/dtypes/m_isym.py +0 -25
  38. reciprocalspaceship-1.0.0/reciprocalspaceship/dtypes/mtzint.py +0 -23
  39. reciprocalspaceship-1.0.0/reciprocalspaceship/dtypes/mtzreal.py +0 -25
  40. reciprocalspaceship-1.0.0/reciprocalspaceship/dtypes/phase.py +0 -50
  41. reciprocalspaceship-1.0.0/reciprocalspaceship/dtypes/stddev.py +0 -69
  42. reciprocalspaceship-1.0.0/reciprocalspaceship/dtypes/structurefactor.py +0 -72
  43. reciprocalspaceship-1.0.0/reciprocalspaceship/dtypes/weight.py +0 -25
  44. reciprocalspaceship-1.0.0/reciprocalspaceship/io/crystfel.py +0 -270
  45. reciprocalspaceship-1.0.0/reciprocalspaceship/utils/units.py +0 -9
  46. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/LICENSE +0 -0
  47. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/MANIFEST.in +0 -0
  48. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/algorithms/__init__.py +0 -0
  49. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/algorithms/intensity.py +0 -0
  50. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/algorithms/merge.py +0 -0
  51. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/commandline/__init__.py +0 -0
  52. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/concat.py +0 -0
  53. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/dataseries.py +0 -0
  54. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/dtypes/inference.py +0 -0
  55. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/dtypes/summarize.py +0 -0
  56. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/io/ccp4map.py +0 -0
  57. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/io/csv.py +0 -0
  58. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/io/pickle.py +0 -0
  59. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/io/precognition.py +0 -0
  60. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/stats/__init__.py +0 -0
  61. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/utils/binning.py +0 -0
  62. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/utils/grid.py +0 -0
  63. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/utils/math.py +0 -0
  64. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/utils/phases.py +0 -0
  65. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/utils/rfree.py +0 -0
  66. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship/utils/symmetry.py +0 -0
  67. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship.egg-info/dependency_links.txt +0 -0
  68. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/reciprocalspaceship.egg-info/top_level.txt +0 -0
  69. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/setup.cfg +0 -0
  70. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/tests/__init__.py +0 -0
  71. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/tests/conftest.py +0 -0
  72. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/tests/test_dataset.py +0 -0
  73. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/tests/test_dataset_anomalous.py +0 -0
  74. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/tests/test_dataset_binning.py +0 -0
  75. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/tests/test_dataset_grid.py +0 -0
  76. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/tests/test_dataset_index.py +0 -0
  77. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/tests/test_dataset_symops.py +0 -0
  78. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/tests/test_decorators.py +0 -0
  79. {reciprocalspaceship-1.0.0 → reciprocalspaceship-1.0.2}/tests/test_summarize_mtz_dtypes.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: reciprocalspaceship
3
- Version: 1.0.0
3
+ Version: 1.0.2
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
@@ -9,7 +9,6 @@ License: MIT
9
9
  Project-URL: Bug Tracker, https://github.com/rs-station/reciprocalspaceship/issues
10
10
  Project-URL: Documentation, https://rs-station.github.io/reciprocalspaceship/
11
11
  Project-URL: Source Code, https://github.com/rs-station/reciprocalspaceship
12
- Platform: UNKNOWN
13
12
  Classifier: Development Status :: 3 - Alpha
14
13
  Classifier: Intended Audience :: Developers
15
14
  Classifier: Intended Audience :: Science/Research
@@ -18,7 +17,7 @@ Classifier: Topic :: Scientific/Engineering :: Chemistry
18
17
  Classifier: Topic :: Scientific/Engineering :: Physics
19
18
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
19
  Classifier: Programming Language :: Python
21
- Requires-Python: >3.7
20
+ Requires-Python: >=3.9
22
21
  Provides-Extra: dev
23
22
  Provides-Extra: examples
24
23
  License-File: LICENSE
@@ -42,5 +41,3 @@ Features of this library include:
42
41
  use space groups, unit cell parameters, and crystallographic symmetry
43
42
  operations.
44
43
  - Support for reading and writing MTZ reflection files.
45
-
46
-
@@ -1,10 +1,10 @@
1
- # 1 /:rocket: = reciprocalspaceship
1
+ # 1 / 🚀 = reciprocalspaceship
2
2
  ![Build](https://github.com/rs-station/reciprocalspaceship/workflows/Build/badge.svg)
3
3
  [![Documentation](https://github.com/rs-station/reciprocalspaceship/workflows/Documentation/badge.svg)](https://rs-station.github.io/reciprocalspaceship)
4
4
  [![PyPI](https://img.shields.io/pypi/v/reciprocalspaceship?color=blue)](https://pypi.org/project/reciprocalspaceship/)
5
5
  [![Anaconda-Server Badge](https://anaconda.org/conda-forge/reciprocalspaceship/badges/version.svg)](https://anaconda.org/conda-forge/reciprocalspaceship)
6
6
  [![codecov](https://codecov.io/gh/rs-station/reciprocalspaceship/branch/main/graph/badge.svg)](https://codecov.io/gh/rs-station/reciprocalspaceship)
7
- [![apm](https://img.shields.io/apm/l/vim-mode.svg)](https://github.com/rs-station/reciprocalspaceship/blob/main/LICENSE)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/rs-station/reciprocalspaceship/blob/main/LICENSE)
8
8
  [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/rs-station/reciprocalspaceship/main?filepath=docs%2Fexamples)
9
9
  [![DOI](https://img.shields.io/badge/DOI-10.1107%2FS160057672100755X-blue)](https://doi.org/10.1107/S160057672100755X)
10
10
 
@@ -37,6 +37,7 @@ from reciprocalspaceship.dtypes import StructureFactorAmplitudeDtype # F
37
37
  from reciprocalspaceship.dtypes import WeightDtype # W
38
38
  from reciprocalspaceship.dtypes import summarize_mtz_dtypes
39
39
  from reciprocalspaceship.io import (
40
+ read_cif,
40
41
  read_crystfel,
41
42
  read_csv,
42
43
  read_mtz,
@@ -185,6 +185,7 @@ def scale_merged_intensities(
185
185
  mean_intensity_method="isotropic",
186
186
  bins=100,
187
187
  bw=2.0,
188
+ minimum_sigma=-np.inf,
188
189
  ):
189
190
  """
190
191
  Scales merged intensities using Bayesian statistics in order to
@@ -240,6 +241,9 @@ def scale_merged_intensities(
240
241
  parameter controls the distance that each reflection impacts in
241
242
  reciprocal space. Only affects output if mean_intensity_method is
242
243
  \"anisotropic\".
244
+ minimum_sigma : float
245
+ Minimum value imposed on Sigma (default: -np.inf, that is: no minimum).
246
+
243
247
 
244
248
  Returns
245
249
  -------
@@ -281,14 +285,11 @@ def scale_merged_intensities(
281
285
  I, Sig = ds[intensity_key].to_numpy(), ds[sigma_key].to_numpy()
282
286
  if mean_intensity_method == "isotropic":
283
287
  dHKL = ds["dHKL"].to_numpy(dtype=np.float64)
284
- Sigma = (
285
- mean_intensity_by_resolution(I / multiplicity, dHKL, bins) * multiplicity
286
- )
288
+ Sigma = mean_intensity_by_resolution(I / multiplicity, dHKL, bins)
287
289
  elif mean_intensity_method == "anisotropic":
288
- Sigma = (
289
- mean_intensity_by_miller_index(I / multiplicity, ds.get_hkls(), bw)
290
- * multiplicity
291
- )
290
+ Sigma = mean_intensity_by_miller_index(I / multiplicity, ds.get_hkls(), bw)
291
+ Sigma = np.clip(Sigma, a_min=minimum_sigma, a_max=np.inf)
292
+ Sigma = Sigma * multiplicity
292
293
 
293
294
  # Initialize outputs
294
295
  ds[outputI] = 0.0
@@ -81,7 +81,6 @@ def summarize(mtz, precision):
81
81
 
82
82
 
83
83
  def main():
84
-
85
84
  # Parse commandline arguments
86
85
  parser = parse_arguments()
87
86
  args = parser.parse_args()
@@ -12,7 +12,8 @@ from reciprocalspaceship.decorators import (
12
12
  range_indexed,
13
13
  spacegroupify,
14
14
  )
15
- from reciprocalspaceship.dtypes.base import MTZDtype, MTZInt32Dtype
15
+ from reciprocalspaceship.dtypes.base import MTZDtype
16
+ from reciprocalspaceship.dtypes.integer import MTZInt32Dtype
16
17
  from reciprocalspaceship.utils import (
17
18
  apply_to_hkl,
18
19
  assign_with_binedges,
@@ -1233,6 +1234,11 @@ class DataSet(pd.DataFrame):
1233
1234
  # Compute new HKLs and phase shifts
1234
1235
  hkls = dataset.get_hkls()
1235
1236
  compressed_hkls, inverse = np.unique(hkls, axis=0, return_inverse=True)
1237
+
1238
+ # The behavior of np.unique changed with v2.0. This block maintains v1 compatibility
1239
+ if inverse.shape[-1] == 1:
1240
+ inverse = inverse.squeeze(-1)
1241
+
1236
1242
  asu_hkls, isym, phi_coeff, phi_shift = hkl_to_asu(
1237
1243
  compressed_hkls, dataset.spacegroup, return_phase_shifts=True
1238
1244
  )
@@ -100,7 +100,7 @@ def spacegroupify(func=None, *sg_args):
100
100
  for arg in sg_args:
101
101
  if arg in bargs.arguments:
102
102
  bargs.arguments[arg] = _convert_spacegroup(bargs.arguments[arg])
103
- return f(**bargs.arguments)
103
+ return f(*bargs.args, **bargs.kwargs)
104
104
 
105
105
  return wrapped
106
106
 
@@ -155,7 +155,7 @@ def cellify(func=None, *cell_args):
155
155
  for arg in cell_args:
156
156
  if arg in bargs.arguments:
157
157
  bargs.arguments[arg] = _convert_unitcell(bargs.arguments[arg])
158
- return f(**bargs.arguments)
158
+ return f(*bargs.args, **bargs.kwargs)
159
159
 
160
160
  return wrapped
161
161
 
@@ -1,22 +1,24 @@
1
- from reciprocalspaceship.dtypes.anomalousdifference import AnomalousDifferenceDtype
2
- from reciprocalspaceship.dtypes.batch import BatchDtype
3
- from reciprocalspaceship.dtypes.hklindex import HKLIndexDtype
4
- from reciprocalspaceship.dtypes.intensity import FriedelIntensityDtype, IntensityDtype
5
- from reciprocalspaceship.dtypes.m_isym import M_IsymDtype
6
- from reciprocalspaceship.dtypes.mtzint import MTZIntDtype
7
- from reciprocalspaceship.dtypes.mtzreal import MTZRealDtype
8
- from reciprocalspaceship.dtypes.phase import HendricksonLattmanDtype, PhaseDtype
9
- from reciprocalspaceship.dtypes.stddev import (
1
+ from reciprocalspaceship.dtypes.floating import (
2
+ AnomalousDifferenceDtype,
3
+ FriedelIntensityDtype,
4
+ FriedelStructureFactorAmplitudeDtype,
5
+ HendricksonLattmanDtype,
6
+ IntensityDtype,
7
+ MTZRealDtype,
8
+ NormalizedStructureFactorAmplitudeDtype,
9
+ PhaseDtype,
10
10
  StandardDeviationDtype,
11
11
  StandardDeviationFriedelIDtype,
12
12
  StandardDeviationFriedelSFDtype,
13
- )
14
- from reciprocalspaceship.dtypes.structurefactor import (
15
- FriedelStructureFactorAmplitudeDtype,
16
- NormalizedStructureFactorAmplitudeDtype,
17
13
  StructureFactorAmplitudeDtype,
14
+ WeightDtype,
15
+ )
16
+ from reciprocalspaceship.dtypes.integer import (
17
+ BatchDtype,
18
+ HKLIndexDtype,
19
+ M_IsymDtype,
20
+ MTZIntDtype,
18
21
  )
19
- from reciprocalspaceship.dtypes.weight import WeightDtype
20
22
 
21
23
  # ExtensionDtypes are appended to the end of the Dtype registry.
22
24
  # Since we want to overwrite a few of the one-letter strings, we need
@@ -0,0 +1,37 @@
1
+ from reciprocalspaceship.dtypes.internals import NumericArray, NumericDtype
2
+
3
+
4
+ class MTZDtype(NumericDtype):
5
+ """Base ExtensionDtype for implementing persistent MTZ data types"""
6
+
7
+ def __repr__(self) -> str:
8
+ return f"{self.name}"
9
+
10
+ @property
11
+ def _is_numeric(self) -> bool:
12
+ return True
13
+
14
+ @classmethod
15
+ def construct_array_type(cls):
16
+ """
17
+ Return the array type associated with this dtype.
18
+
19
+ Returns
20
+ -------
21
+ type
22
+ """
23
+ return NotImplementedError
24
+
25
+ @classmethod
26
+ def construct_from_string(cls, string):
27
+ if not isinstance(string, str):
28
+ raise TypeError(
29
+ f"'construct_from_string' expects a string, got {type(string)}"
30
+ )
31
+ elif string != cls.name and string != cls.mtztype:
32
+ raise TypeError(f"Cannot construct a '{cls.__name__}' from '{string}'")
33
+ return cls()
34
+
35
+ def is_friedel_dtype(self):
36
+ """Returns whether MTZ dtype represents a Friedel dtype"""
37
+ raise NotImplementedError