-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
49 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,44 @@ | ||
from pathlib import Path | ||
|
||
import gemmi | ||
import numpy as np | ||
import pytest | ||
from numpy import testing as npt | ||
|
||
def test_sf_calc(test_data_dir: Path): ... | ||
from meteor import sfcalc | ||
from meteor.rsmap import Map | ||
from meteor.testing import single_carbon_structure | ||
|
||
RESOLUTION = 1.0 | ||
UNIT_CELL = gemmi.UnitCell(a=10.0, b=10.0, c=10.0, alpha=90, beta=90, gamma=90) | ||
SPACE_GROUP = gemmi.find_spacegroup_by_name("P1") | ||
CARBON1_POSITION = (5.0, 5.0, 5.0) | ||
|
||
|
||
@pytest.fixture | ||
def structure() -> gemmi.Structure: | ||
return single_carbon_structure(CARBON1_POSITION, SPACE_GROUP, UNIT_CELL) | ||
|
||
|
||
def test_sf_calc(structure: gemmi.Structure) -> None: | ||
calc_map: Map = sfcalc.structure_to_calculated_map(structure, high_resolution_limit=RESOLUTION) | ||
assert calc_map.resolution_limits[1] == RESOLUTION | ||
assert calc_map.spacegroup == SPACE_GROUP | ||
assert calc_map.cell == UNIT_CELL | ||
assert not calc_map.has_uncertainties | ||
assert np.any(calc_map.amplitudes != 0.0) | ||
assert np.any(calc_map.phases != 0.0) | ||
|
||
|
||
def test_pdb_to_calculated_map(example_pdb_file: Path) -> None: | ||
calc_map: Map = sfcalc.pdb_to_calculated_map(example_pdb_file, high_resolution_limit=RESOLUTION) | ||
npt.assert_allclose(calc_map.resolution_limits[1], RESOLUTION, atol=1e-5) | ||
|
||
# CRYST1 51.990 62.910 72.030 90.00 90.00 90.00 P 21 21 21 | ||
assert calc_map.spacegroup == gemmi.find_spacegroup_by_name("P 21 21 21") | ||
assert calc_map.cell == gemmi.UnitCell( | ||
a=51.990, b=62.910, c=72.030, alpha=90, beta=90, gamma=90 | ||
) | ||
|
||
assert np.any(calc_map.amplitudes != 0.0) | ||
assert np.any(calc_map.phases != 0.0) |