Sfoglia il codice sorgente

Adds better handling of empty plots w/o arguments

Caleb Fangmeier 6 anni fa
parent
commit
a181009b25
2 ha cambiato i file con 4 aggiunte e 2 eliminazioni
  1. 3 1
      filval/plotting.py
  2. 1 1
      filval/result_set.py

+ 3 - 1
filval/plotting.py

@@ -241,7 +241,9 @@ def grid_plot(subplots):
             plt.subplot2grid((rows, cols), (i, j),
                              colspan=column_span, rowspan=row_span)
             for plot in cell:
-                if len(plot) == 1:
+                if not isinstance(plot, tuple):
+                    plot_fn, args, kwargs = plot, (), {}
+                elif len(plot) == 1:
                     plot_fn, args, kwargs = plot[0], (), {}
                 elif len(plot) == 2:
                     plot_fn, args, kwargs = plot[0], plot[1], {}

+ 1 - 1
filval/result_set.py

@@ -24,7 +24,7 @@ class ResultSet:
             pass
         try:
             self.config = str(file.Get("_config").GetString())
-        except TypeError:
+        except (TypeError, AttributeError):
             pass
         list_of_keys = file.GetListOfKeys()
         for i in range(list_of_keys.GetSize()):