dan mackinlay avatar dan mackinlay committed 5eb6f36

defective bin fixing

Comments (0)

Files changed (1)

         histo = sp.histogram2d(x, y, bins=(x_b, y_b))[0]
     except ValueError:
         # degenerate binning
-        x_size = max(x[-1] - x[0], 0.00001)
-        y_size = max(y[-1] - y[0], 0.00001)
-        x_b = x_b * (1-x_size)  + np.linspace(-x_size, x_size, x_b.size)
-        y_b = y_b * (1-y_size)  + np.linspace(-y_size, y_size, y_b.size)
+        x_span = max(x[-1] - x[0], 0.00001)
+        y_span = max(y[-1] - y[0], 0.00001)
+        x_b = x_b * (0.99)  + 0.01* np.linspace(-x_span, x_span, x_b.size)
+        y_b = y_b * (0.99)  + 0.01* np.linspace(-y_span, y_span, y_b.size)
+        histo = sp.histogram2d(x, y, bins=(x_b, y_b))[0]
     return histo
 
 def plugin_mi_dist_disc(x, y, x_bins=None, y_bins=None, **kwargs):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.