Ejemplo n.º 1
0
def exercise_solver():
  import libtbx.load_env
  if (not libtbx.env.has_module("spotfinder")):
    print "Skipping some tests due to missing module: spotfinder"
    return
  from libtbx.test_utils import block_show_diff, contains_substring
  from libtbx import easy_run
  def run(args):
    cmd = " ".join(["rstbx.simage.solver"] + args)
    print cmd
    buf = easy_run.fully_buffered(
      command=cmd, stdout_splitlines=False).raise_if_errors().stdout_buffer
    for key in [
          "Final:"]:
      assert contains_substring(buf, key)
    return buf
  buf = run(["d_min=5"])
  assert not block_show_diff(buf, """\
input_im0_i_perm: 0

Correlation of input and estimated I-obs:
  i_perm=0:  1.00000 (r1: 0.00000)
""")
  buf = run(["d_min=5", "lattice_symmetry=R32:R", "intensity_symmetry=R3:R"])
  assert not block_show_diff(buf, """\
input_im0_i_perm: 1

Correlation of input and estimated I-obs:
  i_perm=0:  0.06799 (r1: 0.37555)
  i_perm=1:  1.00000 (r1: 0.00000)
""")
  buf = run(["d_min=5", "lattice_symmetry=R32:R", "intensity_symmetry=P1"])
  assert not block_show_diff(buf, """\
input_im0_i_perm: 5

Correlation of input and estimated I-obs:
  i_perm=0:  0.07524 (r1: 0.38937)
  i_perm=1: -0.02385 (r1: 0.40114)
  i_perm=2: -0.04577 (r1: 0.41742)
  i_perm=3: -0.00099 (r1: 0.40390)
  i_perm=4:  0.00764 (r1: 0.39213)
  i_perm=5:  1.00000 (r1: 0.00000)
""")
  if (not libtbx.env.has_module("labelit")):
    print "Skipping some tests due to missing module: labelit"
  else:
    from libtbx import easy_mp
    mp_problem = easy_mp.detect_problem()
    if (mp_problem is not None):
      print "Skipping some tests:", mp_problem
    else:
      buf = run([
        "d_min=5", "lattice_symmetry=P422", "intensity_symmetry=P4",
        "index_and_integrate=True", "multiprocessing=True"])
      assert contains_substring(buf, "Refined unit cell 9 (")
      assert contains_substring(
        buf, "Correlation of input and estimated I-obs:")
      assert contains_substring(buf, "  Best correlation:  0.999")
Ejemplo n.º 2
0
Archivo: tst.py Proyecto: dials/cctbx
def exercise_solver():
    import libtbx.load_env
    if (not libtbx.env.has_module("spotfinder")):
        print("Skipping some tests due to missing module: spotfinder")
        return
    from libtbx.test_utils import block_show_diff, contains_substring
    from libtbx import easy_run

    def run(args):
        cmd = " ".join(["rstbx.simage.solver"] + args)
        print(cmd)
        buf = easy_run.fully_buffered(
            command=cmd,
            stdout_splitlines=False).raise_if_errors().stdout_buffer
        for key in ["Final:"]:
            assert contains_substring(buf, key)
        return buf

    buf = run(["d_min=5"])
    assert not block_show_diff(
        buf, """\
input_im0_i_perm: 0

Correlation of input and estimated I-obs:
  i_perm=0:  1.00000 (r1: 0.00000)
""")
    buf = run(["d_min=5", "lattice_symmetry=R32:R", "intensity_symmetry=R3:R"])
    assert not block_show_diff(
        buf, """\
input_im0_i_perm: 1

Correlation of input and estimated I-obs:
  i_perm=0:  0.06799 (r1: 0.37555)
  i_perm=1:  1.00000 (r1: 0.00000)
""")
    buf = run(["d_min=5", "lattice_symmetry=R32:R", "intensity_symmetry=P1"])
    assert not block_show_diff(
        buf, """\
input_im0_i_perm: 5

Correlation of input and estimated I-obs:
  i_perm=0:  0.07524 (r1: 0.38937)
  i_perm=1: -0.02385 (r1: 0.40114)
  i_perm=2: -0.04577 (r1: 0.41742)
  i_perm=3: -0.00099 (r1: 0.40390)
  i_perm=4:  0.00764 (r1: 0.39213)
  i_perm=5:  1.00000 (r1: 0.00000)
""")
    if (not libtbx.env.has_module("labelit")):
        print("Skipping some tests due to missing module: labelit")
    else:
        from libtbx import easy_mp
        mp_problem = easy_mp.detect_problem()
        if (mp_problem is not None):
            print("Skipping some tests:", mp_problem)
        else:
            buf = run([
                "d_min=5", "lattice_symmetry=P422", "intensity_symmetry=P4",
                "index_and_integrate=True", "multiprocessing=True"
            ])
            assert contains_substring(buf, "Refined unit cell 9 (")
            assert contains_substring(
                buf, "Correlation of input and estimated I-obs:")
            assert contains_substring(buf, "  Best correlation:  0.999")
Ejemplo n.º 3
0
Archivo: tst.py Proyecto: dials/cctbx
 def check(args, expected_block):
     sio = StringIO()
     work_params = create.process_args(args=args, out=sio)
     assert not block_show_diff(sio.getvalue(), expected_block)
     pixels = create.compute_image(work_params)
     assert pixels.all() == tuple(work_params.detector.pixels)
Ejemplo n.º 4
0
 def check(args, expected_block):
   sio = StringIO()
   work_params = create.process_args(args=args, out=sio)
   assert not block_show_diff(sio.getvalue(), expected_block)
   pixels = create.compute_image(work_params)
   assert pixels.all() == tuple(work_params.detector.pixels)