mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-03-15 14:50:25 +01:00
error handling for autorange special case in Corr.show
This commit is contained in:
parent
132763c33e
commit
9722500d3c
1 changed files with 6 additions and 4 deletions
|
@ -313,10 +313,12 @@ class Corr:
|
|||
ax1.set_yscale('log')
|
||||
else:
|
||||
# we generate ylim instead of using autoscaling.
|
||||
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)])
|
||||
|
||||
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 comp:
|
||||
if isinstance(comp, Corr) or isinstance(comp, list):
|
||||
for corr in comp if isinstance(comp, list) else [comp]:
|
||||
|
|
Loading…
Add table
Reference in a new issue