code: def __entropy(data):
      """Compute entropy of the flattened data set (e.g. a density distribution)."""
      # normalize and convert to float
      data = data / float(numpy.sum(data))
      # for each grey-value g with a probability p(g) = 0, the entropy is defined as 0, therefore we remove these values and also flatten the histogram
      data = data[numpy.nonzero(data)]
      # compute entropy
      return -1.0 * numpy.sum(data * numpy.log2(data))
  
imports: import numpy
  from ..core import ArgumentError
label_desc: Use image node_id 3 for calling a global function with example usage: __entropy(data) and returns: unknown