feat: Argument references added to Corr.show

This commit is contained in:
Fabian Joswig 2022-05-02 12:13:03 +01:00
parent d0f96f2bf8
commit c5b25ebdd9

View file

@ -703,7 +703,7 @@ class Corr:
self.prange = prange self.prange = prange
return return
def show(self, x_range=None, comp=None, y_range=None, logscale=False, plateau=None, fit_res=None, ylabel=None, save=None, auto_gamma=False, hide_sigma=None): def show(self, x_range=None, comp=None, y_range=None, logscale=False, plateau=None, fit_res=None, ylabel=None, save=None, auto_gamma=False, hide_sigma=None, references=None):
"""Plots the correlator using the tag of the correlator as label if available. """Plots the correlator using the tag of the correlator as label if available.
Parameters Parameters
@ -727,6 +727,8 @@ class Corr:
Apply the gamma method with standard parameters to all correlators and plateau values before plotting. Apply the gamma method with standard parameters to all correlators and plateau values before plotting.
hide_sigma : float hide_sigma : float
Hides data points from the first value on which is consistent with zero within 'hide_sigma' standard errors. Hides data points from the first value on which is consistent with zero within 'hide_sigma' standard errors.
references : list
List of floating point values that are displayed as horizontal lines for reference.
""" """
if self.N != 1: if self.N != 1:
raise Exception("Correlator must be projected before plotting") raise Exception("Correlator must be projected before plotting")
@ -780,6 +782,14 @@ class Corr:
ax1.axhspan(plateau.value - plateau.dvalue, plateau.value + plateau.dvalue, alpha=0.25, color=plt.rcParams['text.color'], ls='-') ax1.axhspan(plateau.value - plateau.dvalue, plateau.value + plateau.dvalue, alpha=0.25, color=plt.rcParams['text.color'], ls='-')
else: else:
raise Exception("'plateau' must be an Obs") raise Exception("'plateau' must be an Obs")
if references:
if isinstance(references, list):
for ref in references:
ax1.axhline(y=ref, linewidth=1, color=plt.rcParams['text.color'], alpha=0.6, marker=',', ls='--')
else:
raise Exception("'references' must be a list of floating pint values.")
if self.prange: if self.prange:
ax1.axvline(self.prange[0], 0, 1, ls='-', marker=',') ax1.axvline(self.prange[0], 0, 1, ls='-', marker=',')
ax1.axvline(self.prange[1], 0, 1, ls='-', marker=',') ax1.axvline(self.prange[1], 0, 1, ls='-', marker=',')