code: def stretch_logarithmic(self, ch_nb, factor=100.):
          
          logger.debug("Perform a logarithmic contrast stretch.")
          if ((self.channels[ch_nb].size ==
               np.ma.count_masked(self.channels[ch_nb])) or
                  (self.channels[ch_nb].min() == self.channels[ch_nb].max())):
              logger.warning("Nothing to stretch !")
              return
  
          crange = (0., 1.0)
  
          arr = self.channels[ch_nb]
          b__ = float(crange[1] - crange[0]) / np.log(factor)
          c__ = float(crange[0])
          slope = (factor - 1.) / float(arr.max() - arr.min())
          arr = 1. + (arr - arr.min()) * slope
          arr = c__ + b__ * np.log(arr)
          self.channels[ch_nb] = arr
docs: Move data into range [1:factor] and do a normalized logarithmic
          enhancement.