diff --git a/pymule/errortools.py b/pymule/errortools.py index 36f643410915c45a255b80f67cd6834bc12f74b3..123864fc8dc0e5594da993d2aa86f7e6446aee4d 100644 --- a/pymule/errortools.py +++ b/pymule/errortools.py @@ -88,14 +88,20 @@ def combineplots(a, b, yfunc, efunc): maskB = [False]*len(b) for ia in range(len(a)): for ib in range(len(b)): - if abs(1-a[ia, 0] / b[ib, 0]) < 1e-15: + if abs(1-a[ia, 0] / b[ib, 0]) < 1e-10: maskA[ia] = True maskB[ib] = True - x = a[maskA, 0] - y = yfunc(a[maskA, 1], b[maskB, 1]) - e = efunc(a[maskA, 1], a[maskA, 2], b[maskB, 1], b[maskB, 2]) - return np.column_stack((x, y, e)) + with np.errstate(divide='ignore', invalid='ignore'): + x = a[maskA, 0] + y = yfunc(a[maskA, 1], b[maskB, 1]) + e = efunc(a[maskA, 1], a[maskA, 2], b[maskB, 1], b[maskB, 2]) + + out = np.column_stack((x, y, e)) + # if one bin is empty, the zero causes trouble + out[~np.isfinite(out)] = 0 + + return out def addplots(a, b, sa=1., sb=1.): diff --git a/pymule/loader.py b/pymule/loader.py index a7960d01d0f90bcfa8c01346939b5205b7360453..0aed028d94d66098b85cd1bfbb6559c06fde80df 100644 --- a/pymule/loader.py +++ b/pymule/loader.py @@ -44,7 +44,8 @@ def importreg(r, folder='.', filenames=None, def pattern(piece='.*', flavour='.*', obs='', folderp='.*'): if len(obs) > 0: return ( - folderp + piece + '_' + flavour + '_S(\d+)X([\d\.]+)D([\d\.]+).*' + folderp + piece + '_' + flavour + '_S(\d+)X([\d\.]+)D([\d\.]+).*O' + + obs + ".vegas" ) else: return ( diff --git a/pymule/mpl_axes_aligner.py b/pymule/mpl_axes_aligner.py index 368cbf6e3ca57a356a10792988b6c358aada376c..1c4f4cead16ff95c974f5b8e2fd0dcb509ddbbc9 100644 --- a/pymule/mpl_axes_aligner.py +++ b/pymule/mpl_axes_aligner.py @@ -22,8 +22,9 @@ def _calc_pos(org1, org2, lim1, lim2): pos = (rorg1 + rorg2) / 2 if pos == 0 or pos == 1: - raise ValueError("When pos=None, at least one origin should be " - "within the initial plotting range.") + print "When pos=None, at least one origin should be " + \ + "within the initial plotting range." + pos = 0.5 return pos diff --git a/pymule/plot.py b/pymule/plot.py index f798d7d3ec52659b927714761b500c99f995281e..36819dcbd992a2473c5b3f2e94d2586bd8d74507 100644 --- a/pymule/plot.py +++ b/pymule/plot.py @@ -89,7 +89,7 @@ def twopanel(labelx, downright = [downright] fig, axs = plt.subplots( - 2, sharex=True, sharey=True, gridspec_kw={'hspace': 0} + 2, sharex=True, gridspec_kw={'hspace': 0} ) axs[1].set_xlabel(labelx)