Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency gemmi to >=0.5.5, <=0.7.0 #284

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion reciprocalspaceship/utils/cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def compute_dHKL(H, cell):
if inverse.shape[-1] == 1:
inverse = inverse.squeeze(-1)

F = np.array(cell.fractionalization_matrix.tolist()).astype(np.float64)
F = np.array(cell.frac.mat, dtype=np.float64)
dhkls = np.reciprocal(np.linalg.norm((hkls @ F), 2, 1)).astype(np.float32)
return dhkls[inverse]

Expand Down
3 changes: 2 additions & 1 deletion reciprocalspaceship/utils/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def get_reciprocal_grid_size(cell, dmin, sample_rate=3.0, spacegroup=None):

# Use gemmi.Mtz to find valid grid (FFT-friendly and obeys symmetry)
m = gemmi.Mtz()
m.spacegroup = spacegroup
if spacegroup is not None:
m.spacegroup = spacegroup

return m.get_size_for_hkl(min_size=min_size)
2 changes: 1 addition & 1 deletion reciprocalspaceship/utils/structurefactors.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,4 @@ def is_absent(H, spacegroup):
absent : array
Boolean array of length n. absent[i] == True if H[i] is systematically absent in sg.
"""
return spacegroup.operations().systematic_absences(H)
return spacegroup.operations().systematic_absences(np.array(H, dtype=np.int32))
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def getVersionNumber():
project_urls=PROJECT_URLS,
python_requires=">=3.9",
install_requires=[
"gemmi>=0.5.5, <=0.6.7",
"gemmi>=0.7.0, <=0.7.0",
"pandas>=2.2.2, <=2.2.3",
"numpy",
"scipy",
Expand All @@ -90,7 +90,7 @@ def getVersionNumber():
entry_points={
"console_scripts": [
"rs.mtzdump=reciprocalspaceship.commandline.mtzdump:main",
"rs.cifdump=reciprocalspaceship.commandline.cifdump:main"
"rs.cifdump=reciprocalspaceship.commandline.cifdump:main",
]
},
classifiers=[
Expand Down
4 changes: 2 additions & 2 deletions tests/test_dataset_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ def test_to_reciprocal_grid_gemmi(mtz_by_spacegroup, sample_rate, p1, use_sf):
grid_size = dataset.get_reciprocal_grid_size(sample_rate=sample_rate)

if use_sf:
gemmigrid = gemmimtz.get_f_phi_on_grid("FMODEL", "PHIFMODEL", size=grid_size)
expected = np.array(gemmigrid, copy=False)
dataset["sf"] = dataset.to_structurefactor("FMODEL", "PHIFMODEL")
result = dataset.to_reciprocal_grid("sf", grid_size=grid_size)
gemmigrid = gemmimtz.get_f_phi_on_grid("FMODEL", "PHIFMODEL", size=grid_size)
expected = gemmigrid.array

# Requires rtol due to truncations applied in gemmi
assert np.allclose(result, expected, rtol=1e-4)
Expand Down
Loading