code: def remove_common_offset(arr):
      
      offset = 0
      isneg = (arr <= 0).all()
      # make sure all values have the same sign
      if isneg or (arr >= 0).all():
          # only remove offset if the minimum and maximum values are the same
          # order of magintude and > O(1000)
          minpwr = numpy.log10(abs(arr).min())
          maxpwr = numpy.log10(abs(arr).max())
          if numpy.floor(minpwr) == numpy.floor(maxpwr) and minpwr > 3:
              offset = numpy.floor(10**minpwr)
              if isneg:
                  offset *= -1
              arr = arr - offset
      return arr, int(offset)
docs: Given an array of data, removes a common offset > 1000, returning the
      removed value.