mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-03-15 06:40:24 +01:00
docstring added to correlators.show
This commit is contained in:
parent
6ac4c94cbc
commit
1ea8655684
3 changed files with 12 additions and 4 deletions
|
@ -583,7 +583,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.3"
|
||||
"version": "3.6.9"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
|
|
@ -217,7 +217,7 @@ class Corr:
|
|||
|
||||
return np.log(Corr(newcontent, padding_back=1))
|
||||
|
||||
else: #This is usually not very stable. One could default back to periodic=False.
|
||||
else: #This is usually not very stable.
|
||||
newcontent = []
|
||||
for t in range(1, self.T - 1):
|
||||
if (self.content[t] is None) or (self.content[t + 1] is None)or (self.content[t - 1] is None):
|
||||
|
@ -265,6 +265,14 @@ class Corr:
|
|||
#If one would not want to import pyplot, this could easily be replaced by a call to pe.plot_corrs
|
||||
#This might be a bit more flexible later
|
||||
def show(self, x_range=None, comp=None, logscale=False):
|
||||
"""Plots the correlator, uses tag as label if available.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
x_range -- list of two values, determining the range of the x-axis e.g. [4, 8]
|
||||
comp -- Correlator or list of correlators which are plotted for comparison.
|
||||
logscale -- Sets y-axis to logsclae
|
||||
"""
|
||||
if self.N!=1:
|
||||
raise Exception("Correlator must be projected before plotting")
|
||||
if x_range is None:
|
||||
|
@ -287,7 +295,7 @@ class Corr:
|
|||
if isinstance(comp, Corr) or isinstance(comp, list):
|
||||
for corr in comp if isinstance(comp, list) else [comp]:
|
||||
x,y,y_err=corr.plottable()
|
||||
plt.errorbar(x, y, y_err, label=corr.tag)
|
||||
plt.errorbar(x, y, y_err, label=corr.tag, mfc=plt.rcParams['axes.facecolor'])
|
||||
else:
|
||||
raise Exception('comp must be a correlator or a list of correlators.')
|
||||
|
||||
|
|
2
setup.py
2
setup.py
|
@ -9,5 +9,5 @@ setup(name='pyerrors',
|
|||
author_email='fabian.joswig@wwu.de',
|
||||
packages=find_packages(),
|
||||
python_requires='>=3.5.0',
|
||||
install_requires=['numpy>=1.16', 'autograd>=1.2', 'numdifftools', 'matplotlib', 'scipy', 'iminuit']
|
||||
install_requires=['numpy>=1.16', 'autograd>=1.2', 'numdifftools', 'matplotlib', 'scipy']
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue