mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-14 19:43:41 +02:00
Fixed bug in Corr._init_() , added auto_gamma argument to plateaus and updated the examples.
This commit is contained in:
parent
032b0b5116
commit
951233ab79
4 changed files with 40 additions and 42 deletions
File diff suppressed because one or more lines are too long
|
@ -393,7 +393,7 @@
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3 (ipykernel)",
|
"display_name": "Python 3",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
|
@ -407,7 +407,7 @@
|
||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.8.10"
|
"version": "3.8.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -56,8 +56,8 @@ class Corr:
|
||||||
N = data_input.shape[0]
|
N = data_input.shape[0]
|
||||||
input_as_list = []
|
input_as_list = []
|
||||||
for t in range(T):
|
for t in range(T):
|
||||||
if any([(item.content[t][0] is None) for item in data_input.flatten()]):
|
if any([(item.content[t] is None) for item in data_input.flatten()]):
|
||||||
if not all([(item.content[t][0] is None) for item in data_input.flatten()]):
|
if not all([(item.content[t] is None) for item in data_input.flatten()]):
|
||||||
warnings.warn("Input ill-defined at different timeslices. Conversion leads to data loss!", RuntimeWarning)
|
warnings.warn("Input ill-defined at different timeslices. Conversion leads to data loss!", RuntimeWarning)
|
||||||
input_as_list.append(None)
|
input_as_list.append(None)
|
||||||
else:
|
else:
|
||||||
|
@ -645,7 +645,7 @@ class Corr:
|
||||||
result = least_squares(xs, ys, function, silent=silent, **kwargs)
|
result = least_squares(xs, ys, function, silent=silent, **kwargs)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def plateau(self, plateau_range=None, method="fit"):
|
def plateau(self, plateau_range=None, method="fit", auto_gamma=False):
|
||||||
""" Extract a plateau value from a Corr object
|
""" Extract a plateau value from a Corr object
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
|
@ -657,6 +657,8 @@ class Corr:
|
||||||
method to extract the plateau.
|
method to extract the plateau.
|
||||||
'fit' fits a constant to the plateau region
|
'fit' fits a constant to the plateau region
|
||||||
'avg', 'average' or 'mean' just average over the given timeslices.
|
'avg', 'average' or 'mean' just average over the given timeslices.
|
||||||
|
auto_gamma : bool
|
||||||
|
apply gamma_method with default parameters to the Corr. Defaults to None
|
||||||
"""
|
"""
|
||||||
if not plateau_range:
|
if not plateau_range:
|
||||||
if self.prange:
|
if self.prange:
|
||||||
|
@ -667,6 +669,8 @@ class Corr:
|
||||||
raise Exception("Correlator must be projected before getting a plateau.")
|
raise Exception("Correlator must be projected before getting a plateau.")
|
||||||
if(all([self.content[t] is None for t in range(plateau_range[0], plateau_range[1] + 1)])):
|
if(all([self.content[t] is None for t in range(plateau_range[0], plateau_range[1] + 1)])):
|
||||||
raise Exception("plateau is undefined at all timeslices in plateaurange.")
|
raise Exception("plateau is undefined at all timeslices in plateaurange.")
|
||||||
|
if auto_gamma:
|
||||||
|
self.gamma_method()
|
||||||
if method == "fit":
|
if method == "fit":
|
||||||
def const_func(a, t):
|
def const_func(a, t):
|
||||||
return a[0]
|
return a[0]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue