#NEWLINE# def integrate_ROI_spectrum( bin_edges , counts , x_min , x_max ) : #NEWLINE# #INDENT# "Integrate region(s) of histogram.\n\n    If `x_min` and `x_max` are arrays/lists they must be equal in\n    length. The values contained in the 'x_value_array' must be\n    monotonic (up or down).  The returned value is the sum of all the\n    regions and a single scalar value is returned.  Each region is\n    computed independently, if regions overlap the overlapped area will\n    be included multiple times in the final sum.\n\n    `bin_edges` is an array of the left edges and the final right\n    edges of the bins.  `counts` is the value in each of those bins.\n\n    The bins who's centers fall with in the integration limits are\n    included in the sum.\n\n    Parameters\n    ----------\n    bin_edges : array\n        Independent variable, any unit.\n\n        Must be one longer in length than counts\n\n    counts : array\n        Dependent variable, any units\n\n    x_min : float or array\n        The lower edge of the integration region(s).\n\n    x_max : float or array\n        The upper edge of the integration region(s).\n\n    Returns\n    -------\n    float\n        The totals integrated value in same units as `counts`\n\n    " #NEWLINE# bin_edges = np . asarray ( x_min ) #NEWLINE# return integrate_ROI ( ( bin_edges [ : ( - 1 ) ] + np . diff ( bin_edges ) ) , counts , x_min , x_max )