reciprocalspaceship 1.0.1__py3-none-any.whl → 1.0.3__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.
Potentially problematic release.
This version of reciprocalspaceship might be problematic. Click here for more details.
- reciprocalspaceship/VERSION +1 -1
- reciprocalspaceship/__init__.py +9 -2
- reciprocalspaceship/algorithms/scale_merged_intensities.py +8 -7
- reciprocalspaceship/dataset.py +28 -3
- reciprocalspaceship/decorators.py +8 -4
- reciprocalspaceship/dtypes/floating.py +24 -28
- reciprocalspaceship/dtypes/integer.py +38 -37
- reciprocalspaceship/dtypes/internals.py +243 -49
- reciprocalspaceship/io/__init__.py +1 -0
- reciprocalspaceship/io/common.py +48 -0
- reciprocalspaceship/io/crystfel.py +559 -234
- reciprocalspaceship/io/dials.py +330 -0
- reciprocalspaceship/io/dials_mpi.py +44 -0
- reciprocalspaceship/io/mtz.py +4 -5
- reciprocalspaceship/utils/__init__.py +6 -1
- reciprocalspaceship/utils/cell.py +5 -0
- reciprocalspaceship/utils/stats.py +5 -7
- reciprocalspaceship/utils/structurefactors.py +5 -0
- reciprocalspaceship/utils/units.py +14 -4
- {reciprocalspaceship-1.0.1.dist-info → reciprocalspaceship-1.0.3.dist-info}/METADATA +27 -28
- {reciprocalspaceship-1.0.1.dist-info → reciprocalspaceship-1.0.3.dist-info}/RECORD +28 -24
- {reciprocalspaceship-1.0.1.dist-info → reciprocalspaceship-1.0.3.dist-info}/WHEEL +1 -1
- {reciprocalspaceship-1.0.1.dist-info → reciprocalspaceship-1.0.3.dist-info}/entry_points.txt +0 -1
- tests/test_dataseries.py +1 -1
- tests/test_dataset.py +42 -0
- tests/test_dataset_signatures.py +53 -0
- {reciprocalspaceship-1.0.1.dist-info → reciprocalspaceship-1.0.3.dist-info}/LICENSE +0 -0
- {reciprocalspaceship-1.0.1.dist-info → reciprocalspaceship-1.0.3.dist-info}/top_level.txt +0 -0
tests/test_dataseries.py
CHANGED
|
@@ -39,7 +39,7 @@ def test_constructor_expanddim(data, series_name, frame_name, dtype):
|
|
|
39
39
|
|
|
40
40
|
assert isinstance(d, rs.DataSet)
|
|
41
41
|
assert len(d.columns) == 1
|
|
42
|
-
assert isinstance(d.dtypes[0], type(ds.dtype))
|
|
42
|
+
assert isinstance(d.dtypes.iloc[0], type(ds.dtype))
|
|
43
43
|
|
|
44
44
|
# Test hierarchy for column naming
|
|
45
45
|
if frame_name:
|
tests/test_dataset.py
CHANGED
|
@@ -603,6 +603,48 @@ def test_is_isomorphous(data_unmerged, data_fmodel, sg1, sg2, cell1, cell2):
|
|
|
603
603
|
assert not result
|
|
604
604
|
|
|
605
605
|
|
|
606
|
+
@pytest.mark.parametrize("threshold", [5.0, 1.0, 0.5, 0.1])
|
|
607
|
+
def test_is_isomorphous_threshold(threshold):
|
|
608
|
+
"""
|
|
609
|
+
Test that DataSet.is_isorphous(self, other, cell_threshold) method's
|
|
610
|
+
cell_threshold operates on percent difference.
|
|
611
|
+
"""
|
|
612
|
+
epsilon = 1e-12
|
|
613
|
+
cell = np.array([34.0, 45.0, 98.0, 90.0, 90.0, 90.0])
|
|
614
|
+
spacegroup = 19
|
|
615
|
+
|
|
616
|
+
ds = rs.DataSet(cell=cell, spacegroup=spacegroup)
|
|
617
|
+
cell_resize_factor = (200.0 + threshold) / (200.0 - threshold)
|
|
618
|
+
|
|
619
|
+
# Make a cell that should be exactly threshold percent bigger
|
|
620
|
+
other_cell = cell_resize_factor * cell
|
|
621
|
+
too_big_cell = other_cell + epsilon
|
|
622
|
+
big_cell = other_cell - epsilon
|
|
623
|
+
|
|
624
|
+
# Make a cell that should be exactly threshold percent smaller
|
|
625
|
+
other_cell = cell / cell_resize_factor
|
|
626
|
+
too_small_cell = other_cell - epsilon
|
|
627
|
+
small_cell = other_cell + epsilon
|
|
628
|
+
|
|
629
|
+
# Construct data sets
|
|
630
|
+
too_big = rs.DataSet(cell=too_big_cell, spacegroup=spacegroup)
|
|
631
|
+
big = rs.DataSet(cell=big_cell, spacegroup=spacegroup)
|
|
632
|
+
too_small = rs.DataSet(cell=too_small_cell, spacegroup=spacegroup)
|
|
633
|
+
small = rs.DataSet(cell=small_cell, spacegroup=spacegroup)
|
|
634
|
+
|
|
635
|
+
# Cell is barely too big to be isomorphous
|
|
636
|
+
assert not ds.is_isomorphous(too_big, threshold)
|
|
637
|
+
|
|
638
|
+
# Cell is barely too small to be isomorphous
|
|
639
|
+
assert not ds.is_isomorphous(too_small, threshold)
|
|
640
|
+
|
|
641
|
+
# Cell is almost too big to be isomorphous
|
|
642
|
+
assert ds.is_isomorphous(big, threshold)
|
|
643
|
+
|
|
644
|
+
# Cell is almost too small to be isomorphous
|
|
645
|
+
assert ds.is_isomorphous(small, threshold)
|
|
646
|
+
|
|
647
|
+
|
|
606
648
|
def test_to_gemmi_withNans(data_merged):
|
|
607
649
|
"""
|
|
608
650
|
GH144: Test whether DataSet.to_gemmi() works with NaN-containing data.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
from inspect import signature
|
|
2
|
+
|
|
3
|
+
import pandas as pd
|
|
4
|
+
import pytest
|
|
5
|
+
from pandas.testing import assert_frame_equal
|
|
6
|
+
|
|
7
|
+
import reciprocalspaceship as rs
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_reset_index_dataseries():
|
|
11
|
+
"""
|
|
12
|
+
Minimal example from GH#223
|
|
13
|
+
"""
|
|
14
|
+
result = rs.DataSeries(range(10)).reset_index()
|
|
15
|
+
expected = pd.Series(range(10)).reset_index()
|
|
16
|
+
expected = rs.DataSet(expected)
|
|
17
|
+
assert_frame_equal(result, expected)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def test_reset_index_signature(dataset_hkl):
|
|
21
|
+
"""
|
|
22
|
+
Test call signature of rs.DataSet.reset_index() matches call signature of
|
|
23
|
+
pd.DataFrame.reset_index() using default parameters
|
|
24
|
+
"""
|
|
25
|
+
df = pd.DataFrame(dataset_hkl)
|
|
26
|
+
sig = signature(pd.DataFrame.reset_index)
|
|
27
|
+
bsig = sig.bind(df)
|
|
28
|
+
bsig.apply_defaults()
|
|
29
|
+
|
|
30
|
+
expected = df.reset_index(*bsig.args[1:], **bsig.kwargs)
|
|
31
|
+
result = dataset_hkl.reset_index(*bsig.args[1:], **bsig.kwargs)
|
|
32
|
+
result = pd.DataFrame(result)
|
|
33
|
+
|
|
34
|
+
assert_frame_equal(result, expected)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@pytest.mark.parametrize("names", ["H", "K", ["H", "K"]])
|
|
38
|
+
def test_set_index_signature(dataset_hkl, names):
|
|
39
|
+
"""
|
|
40
|
+
Test call signature of rs.DataSet.set_index() matches call signature of
|
|
41
|
+
pd.DataFrame.set_index() using default parameters
|
|
42
|
+
"""
|
|
43
|
+
ds = dataset_hkl.reset_index()
|
|
44
|
+
df = pd.DataFrame(ds)
|
|
45
|
+
sig = signature(pd.DataFrame.set_index)
|
|
46
|
+
bsig = sig.bind(df, names)
|
|
47
|
+
bsig.apply_defaults()
|
|
48
|
+
|
|
49
|
+
expected = df.set_index(*bsig.args[1:], **bsig.kwargs)
|
|
50
|
+
result = ds.set_index(*bsig.args[1:], **bsig.kwargs)
|
|
51
|
+
result = pd.DataFrame(result)
|
|
52
|
+
|
|
53
|
+
assert_frame_equal(result, expected)
|
|
File without changes
|
|
File without changes
|