Repository: wright-group/WrightTools

Issue:
remove `debug`
currently many of the modules in WrightTools have a `debug` variable that, in theory, should toggle some change in behavior. The idea is that you would be able to take some code, toggle debug e.g. `wt.data.debug = True`, and see more information that helps you think about what's happening.

Frankly this system is just over-designed, and I don't think it's been used by any human in the last 6 months. Unless there is great outcry, I move that we strip it out.


Discussion:
I think that debug as it is as a boolean flag should be removed, but I could see use for the underlying functionality using a logging library

Logging libraries typically have several different levels of importance, and it is settable at runtime which level you wish to see.

A typicall progression may look like:
ALL < DEBUG < INFO < WARN < ERROR < FATAL < OFF

This was taken from a java logging library [log4j](
https://www.tutorialspoint.com/log4j/log4j_logging_levels.htm)

Using a logging library would replace all print statements with `logger.info()` or `logger.error()` etc.

see wright-group/PyCMDS#61
OK---we'll remove debug then

not sure that a logging library is needed within WrightTools, but willing to consider in future

Resolving patch:
diff --git a/WrightTools/calibration.py b/WrightTools/calibration.py
--- a/WrightTools/calibration.py
+++ b/WrightTools/calibration.py
@@ -21,7 +21,6 @@
 from . import artists as wt_artists
 
 matplotlib.rcParams['font.size'] = 14
-debug = False
 
 
 # --- define --------------------------------------------------------------------------------------
diff --git a/WrightTools/data.py b/WrightTools/data.py
--- a/WrightTools/data.py
+++ b/WrightTools/data.py
@@ -38,9 +38,6 @@
 # --- define --------------------------------------------------------------------------------------
 
 
-debug = False
-
-
 # string types
 if sys.version[0] == '2':
     # recognize unicode and string types
@@ -2305,8 +2302,6 @@ def from_COLORS(
             grid_i = griddata(points, zi, xi,
                               method='linear', fill_value=fill_value)
             channel.give_values(grid_i)
-            if debug:
-                print(key)
 
     # create data object --------------------------------------------------------------------------
 
@@ -2475,8 +2470,6 @@ def from_KENT(filepaths, null=None, name=None, ignore=['wm'], use_norm=False,
             grid_i = griddata(points, zi, xi,
                               method='linear', fill_value=fill_value)
             channel.give_values(grid_i)
-            if debug:
-                print(key)
     # create data object --------------------------------------------------------------------------
     data = Data(list(scanned), list(channels.values()), list(constant))
     for axis in data.axes:
@@ -3092,15 +3085,11 @@ def discover_dimensions(arr, dimension_cols, verbose=True):
                 else:
                     d_equal[i, j] = False
                     break
-    if debug:
-        print(d_equal)
 
     # condense
     dims_unaccounted = list(range(len(dims)))
     dims_condensed = []
     while dims_unaccounted:
-        if debug:
-            print(dims_unaccounted)
         dim_current = dims_unaccounted[0]
         index = dims[dim_current][0]
         tolerance = [dims[dim_current][1]]
@@ -3109,8 +3098,6 @@ def discover_dimensions(arr, dimension_cols, verbose=True):
         dims_unaccounted.pop(0)
         indicies = list(range(len(dims_unaccounted)))
         indicies.reverse()
-        if debug:
-            print(indicies)
         for i in indicies:
             dim_check = dims_unaccounted[i]
             if d_equal[dim_check, dim_current]:
@@ -3120,8 +3107,6 @@ def discover_dimensions(arr, dimension_cols, verbose=True):
         tolerance = max(tolerance)
         dims_condensed.append([index, tolerance, units, key])
     dims = dims_condensed
-    if debug:
-        print(dims)
 
     # which dimensions are scanned ----------------------------------------------------------------
 
diff --git a/WrightTools/tuning/coset.py b/WrightTools/tuning/coset.py
--- a/WrightTools/tuning/coset.py
+++ b/WrightTools/tuning/coset.py
@@ -21,8 +21,6 @@
 from .. import kit as wt_kit
 from .. import artists as wt_artists
 
-debug = False
-
 matplotlib.rcParams['font.size'] = 14
 
 # --- coset class ---------------------------------------------------------------------------------


Test patch: