Skip to content

Reducers

source module isofit.utils.reducers

Functions

  • band_mean Wrapper for the np.mean reducer. A wrapper is necessary because you need to pass it a row-axis call. Args: vals: (N-locs x bands) array of pixel values Returns: (b x 1) array of band-means

  • class_priority Wrapper for the priority reducer. This might not be the correct place for this reducer. The rules are as follows: If pct(n) > thresh: -> class = n elif pct(n-1) > thresh: -> class = n-1 else pct(0) > thresh -> class = 0 This will mean that the largest int class will take precedence. The threshold controls how many pixels in the SUB have to be a class for it to be important. Args: vals: (N-locs) array of pixel classes Returns: (int) Super pixel class

source band_mean(vals)

Wrapper for the np.mean reducer. A wrapper is necessary because you need to pass it a row-axis call. Args: vals: (N-locs x bands) array of pixel values Returns: (b x 1) array of band-means

source class_priority(vals, thresh=0.25)

Wrapper for the priority reducer. This might not be the correct place for this reducer. The rules are as follows: If pct(n) > thresh: -> class = n elif pct(n-1) > thresh: -> class = n-1 else pct(0) > thresh -> class = 0 This will mean that the largest int class will take precedence. The threshold controls how many pixels in the SUB have to be a class for it to be important. Args: vals: (N-locs) array of pixel classes Returns: (int) Super pixel class