def histogram_equalize(self, use_bands, **kwargs):
data = self._read(self[use_bands,...], **kwargs)<EOL>data = np.rollaxis(data.astype(np.float32), <NUM_LIT:0>, <NUM_LIT:3>)<EOL>flattened = data.flatten()<EOL>if <NUM_LIT:0> in data:<EOL><INDENT>masked = np.ma.masked_values(data, <NUM_LIT:0>).compressed()<EOL>image_histogram, bin_edges = np.histogram(masked, <NUM_LIT>)<EOL><DEDENT>else:<EOL><INDENT>image_histogram, bin_edges = np.histogram(flattened, <NUM_LIT>)<EOL><DEDENT>bins = (bin_edges[:-<NUM_LIT:1>] + bin_edges[<NUM_LIT:1>:]) / <NUM_LIT><EOL>cdf = image_histogram.cumsum() <EOL>cdf = cdf / float(cdf[-<NUM_LIT:1>])<EOL>image_equalized = np.interp(flattened, bins, cdf).reshape(data.shape)<EOL>if '<STR_LIT>' in kwargs or '<STR_LIT>' in kwargs:<EOL><INDENT>return self._histogram_stretch(image_equalized, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>return image_equalized<EOL><DEDENT>
Equalize and the histogram and normalize value range
            Equalization is on all three bands, not per-band