Skip to content

Commit

Permalink
Corrected problems when pdf was a delta
Browse files Browse the repository at this point in the history
  • Loading branch information
fbcotter committed Jun 7, 2018
1 parent 7c413a1 commit 483ee3b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion plotters.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,15 @@ def plot_dtcwt(yl, yh, fig=None, f=np.abs, top=1, fmt='chw', imshow_kwargs={}):
else:
x = np.linspace(vmin, vmax, 50)
# Fit a kernel to it
density = stats.gaussian_kde(yh_disp[j].ravel())
try:
density = stats.gaussian_kde(yh_disp[j].ravel())
except np.linalg.LinAlgError:
def delta(x):
if x == 0:
return 1
else:
return 0
density = np.vectorize(delta)
y = density(x)
# Plot it vertically and then make it right-aligned
hist.set_xlim(y.max(), 0)
Expand Down

0 comments on commit 483ee3b

Please sign in to comment.