Exemplo n.º 1
0
def test_reflection_manager(data):
    from dials.algorithms.integration.parallel_integrator import (
        SimpleBlockList,
        SimpleReflectionManager,
    )

    jobs = SimpleBlockList((0, 60), 20)
    reflections = data.reflections

    manager = SimpleReflectionManager(jobs, reflections, 5)

    def check_job(index):
        r = manager.split(index)
        selection = r.get_flags(r.flags.dont_integrate)
        r1 = r.select(~selection)

        j0, j1 = jobs[index]

        for rr in r1.rows():
            z0, z1 = rr["bbox"][4:6]
            zc = int(math.floor((z0 + z1) / 2.0))
            j = jobs.block_index(zc)
            assert j == index
            assert z0 >= j0 and z1 <= j1

    check_job(0)
    check_job(1)
    check_job(2)
    check_job(3)
    check_job(4)
Exemplo n.º 2
0
def test_job_list():
    from dials.algorithms.integration.parallel_integrator import SimpleBlockList

    jobs = SimpleBlockList((0, 60), 20)

    assert jobs[0] == (0, 20)
    assert jobs[1] == (10, 30)
    assert jobs[2] == (20, 40)
    assert jobs[3] == (30, 50)
    assert jobs[4] == (40, 60)

    for frame in range(0, 15):
        assert jobs.block_index(frame) == 0
    for frame in range(16, 25):
        assert jobs.block_index(frame) == 1
    for frame in range(26, 35):
        assert jobs.block_index(frame) == 2
    for frame in range(36, 45):
        assert jobs.block_index(frame) == 3
    for frame in range(46, 60):
        assert jobs.block_index(frame) == 4