threeML.utils.histogram module

class threeML.utils.histogram.Histogram(list_of_intervals, contents=None, errors=None, sys_errors=None, is_poisson=False)[source]

Bases: IntervalSet

INTERVAL_TYPE

alias of Interval

bin_entries(entires)[source]

add the entries into the proper bin

Parameters:

entires – list of events

Returns:

property contents
display(fill=False, fill_min=0.0, x_label='x', y_label='y', **kwargs)[source]
property errors
classmethod from_entries(list_of_intervals, entries)[source]

create a histogram from a list of intervals and entries to bin

Parameters:
  • list_of_intervals

  • entries

Returns:

classmethod from_numpy_histogram(hist, errors=None, sys_errors=None, is_poisson=False, **kwargs)[source]

create a Histogram from a numpy histogram. .. rubric:: Example

r = np.random.randn(1000) np_hist = np.histogram(r) hist = Histogram.from_numpy_histogram(np_hist)

Parameters:
  • hist – a np.histogram tuple

  • errors – list of errors for each bin in the numpy histogram

  • sys_errors – list of systematic errors for each bin in the numpy histogram

  • is_poisson – if the data is Poisson distributed or not

  • kwargs – any kwargs to pass along

Returns:

a Histogram object

property is_poisson
property sys_errors
property total
property total_error