mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-16 12:33:41 +02:00
docstrings extended
This commit is contained in:
parent
bb07ce9cef
commit
ebba71075a
2 changed files with 82 additions and 40 deletions
|
@ -15,6 +15,14 @@ from .pyerrors import Obs, derived_observable, covariance, pseudo_Obs
|
||||||
|
|
||||||
|
|
||||||
class Fit_result(Sequence):
|
class Fit_result(Sequence):
|
||||||
|
"""Represents fit results.
|
||||||
|
|
||||||
|
Attributes
|
||||||
|
----------
|
||||||
|
fit_parameters : list
|
||||||
|
results for the individual fit parameters,
|
||||||
|
also accesible via indices.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.fit_parameters = None
|
self.fit_parameters = None
|
||||||
|
|
|
@ -24,16 +24,21 @@ class Obs:
|
||||||
|
|
||||||
Attributes
|
Attributes
|
||||||
----------
|
----------
|
||||||
e_tag_global -- Integer which determines which part of the name belongs
|
e_tag_global : int
|
||||||
|
Integer which determines which part of the name belongs
|
||||||
to the ensemble and which to the replicum.
|
to the ensemble and which to the replicum.
|
||||||
S_global -- Standard value for S (default 2.0)
|
S_global : float
|
||||||
S_dict -- Dictionary for S values. If an entry for a given ensemble
|
Standard value for S (default 2.0)
|
||||||
|
S_dict : dict
|
||||||
|
Dictionary for S values. If an entry for a given ensemble
|
||||||
exists this overwrites the standard value for that ensemble.
|
exists this overwrites the standard value for that ensemble.
|
||||||
tau_exp_global -- Standard value for tau_exp (default 0.0)
|
tau_exp_global : float
|
||||||
tau_exp_dict -- Dictionary for tau_exp values. If an entry for a given
|
Standard value for tau_exp (default 0.0)
|
||||||
ensemble exists this overwrites the standard value for that
|
tau_exp_dict :dict
|
||||||
ensemble.
|
Dictionary for tau_exp values. If an entry for a given ensemble exists
|
||||||
N_sigma_global -- Standard value for N_sigma (default 1.0)
|
this overwrites the standard value for that ensemble.
|
||||||
|
N_sigma_global : float
|
||||||
|
Standard value for N_sigma (default 1.0)
|
||||||
"""
|
"""
|
||||||
__slots__ = ['names', 'shape', 'r_values', 'deltas', 'N', '_value', '_dvalue',
|
__slots__ = ['names', 'shape', 'r_values', 'deltas', 'N', '_value', '_dvalue',
|
||||||
'ddvalue', 'reweighted', 'S', 'tau_exp', 'N_sigma', 'e_names',
|
'ddvalue', 'reweighted', 'S', 'tau_exp', 'N_sigma', 'e_names',
|
||||||
|
@ -50,6 +55,20 @@ class Obs:
|
||||||
filter_eps = 1e-10
|
filter_eps = 1e-10
|
||||||
|
|
||||||
def __init__(self, samples, names, idl=None, means=None, **kwargs):
|
def __init__(self, samples, names, idl=None, means=None, **kwargs):
|
||||||
|
""" Initialize Obs object.
|
||||||
|
|
||||||
|
Attributes
|
||||||
|
----------
|
||||||
|
samples : list
|
||||||
|
list of numpy arrays containing the Monte Carlo samples
|
||||||
|
names : list
|
||||||
|
list of strings labeling the indivdual samples
|
||||||
|
idl : list, optional
|
||||||
|
list of ranges or lists on which the samples are defined
|
||||||
|
means : list, optional
|
||||||
|
list of mean values for the case that the mean values were
|
||||||
|
already subtracted from the samples
|
||||||
|
"""
|
||||||
|
|
||||||
if means is None:
|
if means is None:
|
||||||
if len(samples) != len(names):
|
if len(samples) != len(names):
|
||||||
|
@ -173,17 +192,22 @@ class Obs:
|
||||||
|
|
||||||
Keyword arguments
|
Keyword arguments
|
||||||
-----------------
|
-----------------
|
||||||
S -- specifies a custom value for the parameter S (default 2.0), can be
|
S : float
|
||||||
|
specifies a custom value for the parameter S (default 2.0), can be
|
||||||
a float or an array of floats for different ensembles
|
a float or an array of floats for different ensembles
|
||||||
tau_exp -- positive value triggers the critical slowing down analysis
|
tau_exp : float
|
||||||
(default 0.0), can be a float or an array of floats for
|
positive value triggers the critical slowing down analysis
|
||||||
different ensembles
|
(default 0.0), can be a float or an array of floats for different
|
||||||
N_sigma -- number of standard deviations from zero until the tail is
|
ensembles
|
||||||
|
N_sigma : float
|
||||||
|
number of standard deviations from zero until the tail is
|
||||||
attached to the autocorrelation function (default 1)
|
attached to the autocorrelation function (default 1)
|
||||||
e_tag -- number of characters which label the ensemble. The remaining
|
e_tag : int
|
||||||
|
number of characters which label the ensemble. The remaining
|
||||||
ones label replica (default 0)
|
ones label replica (default 0)
|
||||||
fft -- boolean, which determines whether the fft algorithm is used for
|
fft : bool
|
||||||
the computation of the autocorrelation function (default True)
|
determines whether the fft algorithm is used for the computation
|
||||||
|
of the autocorrelation function (default True)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if 'e_tag' in kwargs:
|
if 'e_tag' in kwargs:
|
||||||
|
@ -846,11 +870,15 @@ def expand_deltas_for_merge(deltas, idx, shape, new_idx):
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
deltas -- List of fluctuations
|
deltas : list
|
||||||
idx -- List or range of configs on which the deltas are defined.
|
List of fluctuations
|
||||||
|
idx : list
|
||||||
|
List or range of configs on which the deltas are defined.
|
||||||
Has to be a subset of new_idx.
|
Has to be a subset of new_idx.
|
||||||
shape -- Number of configs in idx.
|
shape : list
|
||||||
new_idx -- List of configs that defines the new range.
|
Number of configs in idx.
|
||||||
|
new_idx : list
|
||||||
|
List of configs that defines the new range.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if type(idx) is range and type(new_idx) is range:
|
if type(idx) is range and type(new_idx) is range:
|
||||||
|
@ -903,18 +931,22 @@ def derived_observable(func, data, **kwargs):
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
func -- arbitrary function of the form func(data, **kwargs). For the
|
func : object
|
||||||
|
arbitrary function of the form func(data, **kwargs). For the
|
||||||
automatic differentiation to work, all numpy functions have to have
|
automatic differentiation to work, all numpy functions have to have
|
||||||
the autograd wrapper (use 'import autograd.numpy as anp').
|
the autograd wrapper (use 'import autograd.numpy as anp').
|
||||||
data -- list of Obs, e.g. [obs1, obs2, obs3].
|
data : list
|
||||||
|
list of Obs, e.g. [obs1, obs2, obs3].
|
||||||
|
|
||||||
Keyword arguments
|
Keyword arguments
|
||||||
-----------------
|
-----------------
|
||||||
num_grad -- if True, numerical derivatives are used instead of autograd
|
num_grad : bool
|
||||||
|
if True, numerical derivatives are used instead of autograd
|
||||||
(default False). To control the numerical differentiation the
|
(default False). To control the numerical differentiation the
|
||||||
kwargs of numdifftools.step_generators.MaxStepGenerator
|
kwargs of numdifftools.step_generators.MaxStepGenerator
|
||||||
can be used.
|
can be used.
|
||||||
man_grad -- manually supply a list or an array which contains the jacobian
|
man_grad : list
|
||||||
|
manually supply a list or an array which contains the jacobian
|
||||||
of func. Use cautiously, supplying the wrong derivative will
|
of func. Use cautiously, supplying the wrong derivative will
|
||||||
not be intercepted.
|
not be intercepted.
|
||||||
|
|
||||||
|
@ -1077,9 +1109,11 @@ def reweight(weight, obs, **kwargs):
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
weight -- Reweighting factor. An Observable that has to be defined on a superset of the
|
weight : Obs
|
||||||
|
Reweighting factor. An Observable that has to be defined on a superset of the
|
||||||
configurations in obs[i].idl for all i.
|
configurations in obs[i].idl for all i.
|
||||||
obs -- list of Obs, e.g. [obs1, obs2, obs3].
|
obs : list
|
||||||
|
list of Obs, e.g. [obs1, obs2, obs3].
|
||||||
|
|
||||||
Keyword arguments
|
Keyword arguments
|
||||||
-----------------
|
-----------------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue