Exemplo n.º 1
0
def test_indexing_with_labelit_on_two_images(dials_regression, tmpdir):
    template = os.path.join(dials_regression, "xia2_demo_data",
                            "insulin_1_%03i.img")
    tmpdir.chdir()

    from xia2.DriverExceptions.NotAvailableError import NotAvailableError
    from xia2.Wrappers.Labelit.LabelitIndex import LabelitIndex
    try:
        indexer = LabelitIndex()
    except NotAvailableError:
        pytest.skip("labelit not found")

    indexer.set_beam_search_scope(4.0)
    for image in (1, 45):
        indexer.add_image(template % image)

    indexer.run()

    print(''.join(indexer.get_all_output()))
    assert indexer.get_mosflm_beam_centre() == pytest.approx((94.35, 94.52),
                                                             abs=1e-1)
    assert indexer.get_mosflm_detector_distance() == pytest.approx(159.8,
                                                                   abs=1e-1)

    solutions = indexer.get_solutions()
    assert len(solutions) == 22
    assert solutions[22]['cell'] == pytest.approx(
        [78.6, 78.6, 78.6, 90, 90, 90], abs=1e-1)
    assert solutions[22]['lattice'] == 'cI'
    assert solutions[22]['rmsd'] <= 0.12
    assert solutions[22]['metric'] <= 0.1243
    assert solutions[22]['smiley'] == ':) '
    assert solutions[22]['number'] == 22
    assert solutions[22]['mosaic'] <= 0.2
    assert solutions[22]['nspots'] == pytest.approx(563, abs=30)
Exemplo n.º 2
0
def test_indexing_with_labelit_on_multiple_images(xia2_regression_build,
                                                  tmpdir):
    template = os.path.join(xia2_regression_build, "test_data", "insulin",
                            "insulin_1_%03i.img")
    tmpdir.chdir()

    from xia2.DriverExceptions.NotAvailableError import NotAvailableError
    from xia2.Wrappers.Labelit.LabelitIndex import LabelitIndex
    try:
        indexer = LabelitIndex()
    except NotAvailableError:
        pytest.skip("labelit not found")

    for image in (1, 22, 45):
        indexer.add_image(template % image)
    indexer.set_distance(160)
    indexer.set_beam_centre((94.24, 94.52))
    indexer.set_wavelength(0.98)
    indexer.set_refine_beam(False)

    indexer.run()

    print(''.join(indexer.get_all_output()))
    assert indexer.get_mosflm_beam_centre() == pytest.approx((94.35, 94.49),
                                                             abs=4e-2)
    assert indexer.get_mosflm_detector_distance() == pytest.approx(159.75,
                                                                   abs=1e-1)

    solutions = indexer.get_solutions()
    assert len(solutions) == 22
    assert solutions[22]['cell'] == pytest.approx(
        [78.61, 78.61, 78.61, 90, 90, 90], abs=5e-2)
    assert solutions[22]['lattice'] == 'cI'
    assert solutions[22]['rmsd'] <= 0.16
    assert solutions[22]['metric'] <= 0.18
    assert solutions[22]['smiley'] == ':) '
    assert solutions[22]['number'] == 22
    assert solutions[22]['mosaic'] <= 0.12
    assert solutions[22]['nspots'] == pytest.approx(
        823, abs=41)  # XXX quite a big difference!
Exemplo n.º 3
0
def exercise_labelit_index():
    if not have_dials_regression:
        print "Skipping exercise_labelit_index(): dials_regression not configured"
        return

    xia2_demo_data = os.path.join(dials_regression, "xia2_demo_data")
    template = os.path.join(xia2_demo_data, "insulin_1_%03i.img")

    from xia2.Wrappers.Labelit.LabelitIndex import LabelitIndex

    # exercise basic indexing from two images
    cwd = os.path.abspath(os.curdir)
    tmp_dir = open_tmp_directory()
    os.chdir(tmp_dir)

    from xia2.DriverExceptions.NotAvailableError import NotAvailableError

    try:
        indexer = LabelitIndex()
    except NotAvailableError:
        print "Skipping exercise_labelit_index(): labelit not found"
        return
    indexer.set_beam_search_scope(4.0)
    indexer.add_image(template % 1)
    indexer.add_image(template % 45)
    indexer.run()
    output = "".join(indexer.get_all_output())
    print output
    assert approx_equal(indexer.get_mosflm_beam_centre(), (94.35, 94.52), eps=1e-1)
    assert approx_equal(indexer.get_mosflm_detector_distance(), 159.8, eps=1e-1)
    solutions = indexer.get_solutions()
    assert len(solutions) == 22
    assert approx_equal(solutions[22]["cell"], [78.6, 78.6, 78.6, 90, 90, 90], eps=2e-2)
    assert solutions[22]["lattice"] == "cI"
    assert solutions[22]["rmsd"] <= 0.076
    assert solutions[22]["metric"] <= 0.1243
    assert solutions[22]["smiley"] == ":) "
    assert solutions[22]["number"] == 22
    assert solutions[22]["mosaic"] == 0.05
    assert abs(solutions[22]["nspots"] - 563) <= 3

    # now exercise indexing off multiple images and test more settings
    os.chdir(cwd)
    tmp_dir = open_tmp_directory()
    os.chdir(tmp_dir)

    indexer = LabelitIndex()
    indexer.add_image(template % 1)
    indexer.add_image(template % 22)
    indexer.add_image(template % 45)
    indexer.set_distance(160)
    indexer.set_beam_centre((94.24, 94.52))
    indexer.set_wavelength(0.98)
    indexer.set_refine_beam(False)
    indexer.run()
    output = "".join(indexer.get_all_output())
    print output
    assert approx_equal(indexer.get_mosflm_beam_centre(), (94.35, 94.49), eps=4e-2)
    assert approx_equal(indexer.get_mosflm_detector_distance(), 159.75, eps=1e-1)
    solutions = indexer.get_solutions()
    assert len(solutions) == 22
    assert approx_equal(solutions[22]["cell"], [78.61, 78.61, 78.61, 90, 90, 90], eps=5e-2)
    assert solutions[22]["lattice"] == "cI"
    assert solutions[22]["rmsd"] <= 0.084
    assert solutions[22]["metric"] <= 0.1663
    assert solutions[22]["smiley"] == ":) "
    assert solutions[22]["number"] == 22
    assert solutions[22]["mosaic"] == 0.025
    assert abs(solutions[22]["nspots"] - 823) <= 41  # XXX quite a big difference!