def test_not_screw_axes(): """Test cases where a screw axis is not present.""" reflection_table = flex.reflection_table() reflection_table["miller_index"] = flex.miller_index( [(0, 0, j) for j in range(1, 9)] ) reflection_table["variance"] = flex.double(8, 1.0) reflection_table["intensity"] = flex.double(8, 5.0) score_41 = ScrewAxis41c().score_axis(reflection_table) score_42 = ScrewAxis42c().score_axis(reflection_table) assert score_41 < 0.01 assert score_42 < 0.01 # Example of weak pseudosymmetry reflection_table["intensity"] = flex.double( [3.0, 100.0, 3.0, 100.0, 3.0, 100.0, 3.0, 100.0] ) score_41 = ScrewAxis41c().score_axis(reflection_table) score_42 = ScrewAxis42c().score_axis(reflection_table) assert score_41 < 0.01 assert score_42 < 0.01 # All data too weak reflection_table["intensity"] = flex.double(8, 0.5) score_41 = ScrewAxis41c().score_axis(reflection_table) score_42 = ScrewAxis42c().score_axis(reflection_table) assert score_41 < 0.01 assert score_42 < 0.01 # No data for absent reflections reflection_table["miller_index"] = flex.miller_index( [(0, 0, i) for i in range(1, 17, 2)] ) score_41 = ScrewAxis41c().score_axis(reflection_table) score_42 = ScrewAxis42c().score_axis(reflection_table) assert score_41 < 0.01 assert score_42 < 0.01 # No data for present reflections reflection_table["miller_index"] = flex.miller_index( [(0, 0, i) for i in range(2, 18, 2)] ) score_41 = ScrewAxis41c().score_axis(reflection_table) score_42 = ScrewAxis42c().score_axis(reflection_table) assert score_41 < 0.01 assert score_42 < 0.01
def test_screw_axes_example_data(): """Test some example data where we know the answer""" refls = make_test_data_LCY_21c() score = ScrewAxis21c().score_axis(refls) assert score > 0.95 refls = make_test_data_thermo_61c() score = ScrewAxis61c().score_axis(refls) assert score > 0.95 refls = make_test_data_thaumatin_41c() score_41 = ScrewAxis41c().score_axis(refls) score_42 = ScrewAxis42c().score_axis(refls) assert score_41 > 0.99 assert score_42 > 0.99 # both should score highly