Exemple #1
0
def _reindex_experiments_reflections(experiments, reflections, space_group, cb_op):
    """Reindex the input data."""
    reindexed_experiments = reindex_experiments(
        experiments, cb_op, space_group=space_group
    )
    reindexed_reflections = flex.reflection_table()
    for i in range(len(reindexed_experiments)):
        reindexed_refl = copy.deepcopy(reflections[i])
        reindexed_refl["miller_index"] = cb_op.apply(reindexed_refl["miller_index"])
        reindexed_reflections.extend(reindexed_refl)
    return reindexed_experiments, [reindexed_reflections]
Exemple #2
0
def test_reindex_experiments():
    # See also https://github.com/cctbx/cctbx_project/issues/424
    cs = sgtbx.space_group_info("I23").any_compatible_crystal_symmetry(
        volume=100000)
    B = scitbx.matrix.sqr(
        cs.unit_cell().fractionalization_matrix()).transpose()
    cryst = Crystal(B, cs.space_group())
    n_scan_points = 10
    A_at_scan_points = [(1, 0, 0, 0, 1, 0, 0, 0, 1)] * n_scan_points
    cryst.set_A_at_scan_points(A_at_scan_points)
    groups = metric_subgroups(cs, max_delta=5)
    for group in groups.result_groups:
        best_subsym = group["best_subsym"]
        cb_op = group["cb_op_inp_best"]
        expts = ExperimentList([Experiment(crystal=cryst)])
        reindexed_expts = reindex_experiments(
            experiments=expts,
            cb_op=cb_op,
            space_group=best_subsym.space_group())
        assert (reindexed_expts[0].crystal.get_crystal_symmetry().
                is_similar_symmetry(best_subsym))
        # Check that the scan-varying A matrices have been copied as well
        assert cryst.num_scan_points == n_scan_points