fix numerical issue caused by comparing using SUPERTINY_NUMBER instead of TINY_NUMBER
@@ -97,16 +97,17 @@ class Distribution(object):
new_xmax = np.min([k.xmax for k in dists])
x_vals = np.unique(np.concatenate([k.x for k in dists]))
- x_vals = x_vals[(x_vals>new_xmin-SUPERTINY_NUMBER)&(x_vals<new_xmax+SUPERTINY_NUMBER)]
+ x_vals = x_vals[(x_vals> new_xmin-TINY_NUMBER)&(x_vals< new_xmax+TINY_NUMBER)]
y_vals = np.sum([k.__call__(x_vals) for k in dists], axis=0)
- if not y_vals:
+ try:
+ peak = y_vals.min()
+ except:
print("ERROR in distribution multiplication: Distributions do not overlap")
x_vals = [0,1]
y_vals = [BIG_NUMBER,BIG_NUMBER]
res = Distribution(x_vals, y_vals, is_log=True,
min_width=min_width, kind='linear')
return res
- peak = y_vals.min()
ind = (y_vals-peak)<BIG_NUMBER/1000
n_points = ind.sum()
if n_points == 0:
