Browse Source

added documentation for guard peak finding

master
Holger Frey 6 years ago
parent
commit
88952ef410
  1. 10
      mtor/dataproc.py

10
mtor/dataproc.py

@ -113,13 +113,21 @@ def find_guard_threshold(data_frame, parameters):
left_values = data_frame[parameters.left_guard_column] left_values = data_frame[parameters.left_guard_column]
right_values = data_frame[parameters.right_guard_column] right_values = data_frame[parameters.right_guard_column]
guard_values = left_values.append(right_values, ignore_index=True) guard_values = left_values.append(right_values, ignore_index=True)
guard_data = numpy.histogram( guard_data = numpy.histogram(
guard_values, bins=parameters.guard_histogram_bins guard_values, bins=parameters.guard_histogram_bins
) )
# The guard edges (x-axis values) enclose the counts (y-axis values)
# of the histogram. This means, there is one more guard edge than count.
# To construct a dataframe later, the number of items must be the same.
# Therefore a value of 0 counts is added before the "real counts"
# this also solves the problem of finding the first peak value later on
# if the first histogram bin contains the highest count.
guard_counts = numpy.concatenate([[0], guard_data[0]]).astype( guard_counts = numpy.concatenate([[0], guard_data[0]]).astype(
numpy.float16 numpy.float16
) )
guard_edges = guard_data[1] # edges enclose the counts guard_edges = guard_data[1]
pyplot.clf() pyplot.clf()
seaborn.lineplot(x=guard_edges, y=guard_counts) seaborn.lineplot(x=guard_edges, y=guard_counts)

Loading…
Cancel
Save