From b67b29fe625ad09a40a5e4073a32f5d23e4e0610 Mon Sep 17 00:00:00 2001
From: "Daniel.Frisinghelli" <daniel.frisinghelli@eurac.edu>
Date: Mon, 17 Aug 2020 10:20:23 +0200
Subject: [PATCH] Removed redundant keyword arguments

---
 pysegcnn/core/graphics.py | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/pysegcnn/core/graphics.py b/pysegcnn/core/graphics.py
index d164c49..5366f7d 100644
--- a/pysegcnn/core/graphics.py
+++ b/pysegcnn/core/graphics.py
@@ -24,7 +24,7 @@ from pysegcnn.main.config import HERE
 
 # this function applies percentile stretching at the alpha level
 # can be used to increase constrast for visualization
-def contrast_stretching(image, alpha=2):
+def contrast_stretching(image, alpha=5):
 
     # compute upper and lower percentiles defining the range of the stretch
     inf, sup = np.percentile(image, (alpha, 100 - alpha))
@@ -49,15 +49,11 @@ def running_mean(x, w):
 # plot_sample() plots a false color composite of the scene/tile together
 # with the model prediction and the corresponding ground truth
 def plot_sample(x, y, use_bands, labels, y_pred=None, figsize=(10, 10),
-                bands=['nir', 'red', 'green'], stretch=False, state=None,
-                outpath=os.path.join(HERE, '_samples/'),  **kwargs):
+                bands=['nir', 'red', 'green'], state=None,
+                outpath=os.path.join(HERE, '_samples/'), alpha=0):
 
     # check whether to apply constrast stretching
-    stretch = True if kwargs else stretch
-    func = contrast_stretching if stretch else lambda x: x
-
-    # create an rgb stack
-    rgb = np.dstack([func(x[use_bands.index(band)], **kwargs)
+    rgb = np.dstack([contrast_stretching(x[use_bands.index(band)], alpha)
                      for band in bands])
 
     # get labels and corresponding colors
-- 
GitLab