mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-15 20:13:41 +02:00
Merge branch 'develop' into feature/v2.0
This commit is contained in:
commit
d78254937b
13 changed files with 1893 additions and 1724 deletions
|
@ -354,7 +354,7 @@ class Corr:
|
|||
return
|
||||
|
||||
# Plotting routine for correlator
|
||||
def show(self, x_range=None, comp=None, logscale=False, plateau=None, fit_res=None, save=None, ylabel=None):
|
||||
def show(self, x_range=None, comp=None, y_range=None, logscale=False, plateau=None, fit_res=None, save=None, ylabel=None):
|
||||
"""Plots the correlator, uses tag as label if available.
|
||||
|
||||
Parameters
|
||||
|
@ -367,7 +367,7 @@ class Corr:
|
|||
if self.N!=1:
|
||||
raise Exception("Correlator must be projected before plotting")
|
||||
if x_range is None:
|
||||
x_range=[0, self.T]
|
||||
x_range = [0, self.T]
|
||||
|
||||
fig = plt.figure()
|
||||
ax1 = fig.add_subplot(111)
|
||||
|
@ -378,12 +378,15 @@ class Corr:
|
|||
ax1.set_yscale('log')
|
||||
else:
|
||||
# we generate ylim instead of using autoscaling.
|
||||
try:
|
||||
y_min=min([(x[0].value - x[0].dvalue) for x in self.content[x_range[0]:x_range[1]] if (x is not None) and x[0].dvalue < 2 * np.abs(x[0].value)])
|
||||
y_max=max([(x[0].value + x[0].dvalue) for x in self.content[x_range[0]:x_range[1]] if (x is not None) and x[0].dvalue < 2 * np.abs(x[0].value)])
|
||||
ax1.set_ylim([y_min - 0.1 * (y_max - y_min), y_max + 0.1 * (y_max - y_min)])
|
||||
except:
|
||||
pass
|
||||
if y_range is None:
|
||||
try:
|
||||
y_min=min([(x[0].value - x[0].dvalue) for x in self.content[x_range[0]:x_range[1]] if (x is not None) and x[0].dvalue < 2 * np.abs(x[0].value)])
|
||||
y_max=max([(x[0].value + x[0].dvalue) for x in self.content[x_range[0]:x_range[1]] if (x is not None) and x[0].dvalue < 2 * np.abs(x[0].value)])
|
||||
ax1.set_ylim([y_min - 0.1 * (y_max - y_min), y_max + 0.1 * (y_max - y_min)])
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
ax1.set_ylim(y_range)
|
||||
if comp:
|
||||
if isinstance(comp, Corr) or isinstance(comp, list):
|
||||
for corr in comp if isinstance(comp, list) else [comp]:
|
||||
|
|
|
@ -575,7 +575,7 @@ def residual_plot(x, y, func, fit_res):
|
|||
gs = gridspec.GridSpec(2, 1, height_ratios=[3, 1], wspace=0.0, hspace=0.0)
|
||||
ax0 = plt.subplot(gs[0])
|
||||
ax0.errorbar(x, [o.value for o in y], yerr=[o.dvalue for o in y], ls='none', fmt='o', capsize=3, markersize=5, label='Data')
|
||||
ax0.plot(x_samples, func([o.value for o in fit_res], x_samples), label='Fit', zorder=10)
|
||||
ax0.plot(x_samples, func([o.value for o in fit_res], x_samples), label='Fit', zorder=10, ls='-', ms=0)
|
||||
ax0.set_xticklabels([])
|
||||
ax0.set_xlim([xstart, xstop])
|
||||
ax0.set_xticklabels([])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue