def exercise_show_summary():
  from scitbx.graph import test_cases_tardy_pdb
  tcs = test_cases_tardy_pdb.select_test_cases(
    tags_or_indices=["ZINC03847120"])
  assert len(tcs) == 1
  tt = tcs[0].tardy_tree_construct()
  for vl,cb in [(None, ("10", "11")),
                (list("ABCDEFGHIKLMNO"), ("L", "M"))]:
    sio = StringIO()
    assert tt.show_summary(vertex_labels=vl, out=sio, prefix="&") is tt
    assert not show_diff(sio.getvalue(), """\
&number of vertices: 14
&number of edges: 15
&find cluster loops: 0 repeats
&number of fixed vertex lists: 0
&number of fixed vertices: 0
&number of clusters: 1
&merge clusters with multiple connections: 1 pass
&number of hinge edges: 1
&number of loop edges: 0
&number of loop edge bendings: 0
&number of fixed hinges: 1
&tardy fixed hinge: %s
&                   %s
""" % cb)
 def get(tag):
   from scitbx.graph import test_cases_tardy_pdb
   tcs = test_cases_tardy_pdb.select_test_cases(tags_or_indices=[tag])
   assert len(tcs) == 1
   tt = tcs[0].tardy_tree_construct()
   ec = tt.cluster_manager.edge_classifier()
   edge_classes = {
     "base":  [],
     "hinge": [],
     "intra": [],
     "loop":  [],
     "fixed": []}
   for e in tt.edge_list:
     edge_classes[ec(edge=e)].append(e)
   return tt, edge_classes
def exercise_pickle():
  from scitbx.graph import test_cases_tardy_pdb
  tcs = test_cases_tardy_pdb.select_test_cases(
    tags_or_indices=["ZINC03847120"])
  assert len(tcs) == 1
  tt = tcs[0].tardy_tree_construct()
  try:
    tt.arbitrary = 0
  except AttributeError: pass # make sure __slots__ work
  else: raise Exception_expected
  ts = StringIO()
  tt.show_summary(vertex_labels=None, out=ts)
  for protocol in xrange(pickle.HIGHEST_PROTOCOL):
    s = pickle.dumps(tt, protocol)
    l = pickle.loads(s)
    ls = StringIO()
    l.show_summary(vertex_labels=None, out=ls)
    assert not show_diff(ls.getvalue(), ts.getvalue())
def run(args):
  if (1):
    random.seed(0)
    flex.set_random_seed(0)
  out = null_out()
  remaining_args = []
  for arg in args:
    if (arg == "--verbose"): out = sys.stdout
    else: remaining_args.append(arg)
  test_cases = test_cases_tardy_pdb.select_test_cases(
    tags_or_indices=remaining_args)
  for test_case in test_cases:
    print >> out, "test case %d: %s" % (test_case.index, test_case.tag)
    minimized = []
    for use_geo in [False, True]:
      minimized.append(exercise_lbfgs(test_case, use_geo=use_geo, out=out))
    m0, m1 = minimized
    assert m0.real_space_target_weight == 1
    assert m1.real_space_target_weight == 1
    assert m1.f_final < m0.f_start * 0.98
  print format_cpu_times()
Exemple #5
0
def run(args):
    if (1):
        random.seed(0)
        flex.set_random_seed(0)
    out = null_out()
    remaining_args = []
    for arg in args:
        if (arg == "--verbose"): out = sys.stdout
        else: remaining_args.append(arg)
    test_cases = test_cases_tardy_pdb.select_test_cases(
        tags_or_indices=remaining_args)
    for test_case in test_cases:
        print("test case %d: %s" % (test_case.index, test_case.tag), file=out)
        minimized = []
        for use_geo in [False, True]:
            minimized.append(
                exercise_lbfgs(test_case, use_geo=use_geo, out=out))
        m0, m1 = minimized
        assert m0.real_space_target_weight == 1
        assert m1.real_space_target_weight == 1
        assert m1.f_final < m0.f_start * 0.98
    print(format_cpu_times())