예제 #1
0
def crystal_statistics(label, crystals, value_func, header=False, footer=False):
    sorted_crystals = sorted(crystals, key=value_func)
    sorted_values   = flex.double([value_func(c) for c in crystals])
    min_max_mean = sorted_values.min_max_mean()
    stddev       = sorted_values.sample_standard_deviation()
    hinges       = robust_statistics.hinges(sorted_values)
    median       = robust_statistics.median(sorted_values)
    s_out = []
    if header: s_out += [format_row(cols=['Min', 'Lower Quartile', 'Median', 'Upper Quartile', 'Max', 'Mean', 'Standard Dev'], row=' ',   header=True)]
    s_out += [format_row(cols=[min_max_mean.min, hinges[0], median, hinges[1], min_max_mean.max, min_max_mean.mean, stddev],   row=label, header=False)]
    if footer: s_out += [format_row(cols=['Min', 'Lower Quartile', 'Median', 'Upper Quartile', 'Max', 'Mean', 'Standard Dev'], row=' ',   header=True)]
    return '\n'.join(s_out)
예제 #2
0
def tst_median():
    x = flex.double(range(10))
    assert rs.median(x) == 4.5
    x = flex.double(range(11))
    assert rs.median(x) == 5.0
예제 #3
0
def tst_percentile():
    n = 10
    x = flex.double(range(n))
    assert rs.percentile(x, 0.50) == rs.median(x)
예제 #4
0
def tst_trimean():
    n = 13
    x = flex.double(range(n))
    assert rs.trimean(x) == rs.median(x)
예제 #5
0
def tst_median():
  x = flex.double(range(10))
  assert rs.median(x)==4.5
  x = flex.double(range(11))
  assert rs.median(x)==5.0
예제 #6
0
def tst_percentile():
  n = 10
  x = flex.double(range(n))
  assert rs.percentile(x,0.50) == rs.median(x)
예제 #7
0
def tst_trimean():
  n = 13
  x = flex.double(range(n))
  assert rs.trimean(x) == rs.median(x)