better docstrings (#144)

* first example of returns statement in docstring

* added a some return statements for pandas API

* last return statements in pandas input

* added returns to bdio docstrings

* few returns statements added to docstring

* finished docstrings for hadrons submodule

* also finished docstrings for json submodule

* finished misc submodule

* added returns in docstrings in openqQCD

* made some cosmetic chanes to dostrings

* added return nad return statement in docstring

* linting

* Improved docstrings of mpm, fits, roots, misc to have return statements

returns added for misc.py

returns added for mpm.py

reutrns added for fits.py

* linting...

* Some polishing of docstrings
This commit is contained in:
Justus Kuhlmann 2023-01-16 15:57:22 +01:00 committed by GitHub
parent b9cdebd442
commit 26447d658c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 276 additions and 6 deletions

View file

@ -14,6 +14,10 @@ def dump_object(obj, name, **kwargs):
name of the file
path : str
specifies a custom path for the file (default '.')
Returns
-------
None
"""
if 'path' in kwargs:
file_name = kwargs.get('path') + '/' + name + '.p'
@ -30,6 +34,11 @@ def load_object(path):
----------
path : str
path to the file
Returns
-------
object : Obs
Loaded Object
"""
with open(path, 'rb') as file:
return pickle.load(file)
@ -48,6 +57,11 @@ def pseudo_Obs(value, dvalue, name, samples=1000):
name of the ensemble for which the Obs is to be generated.
samples: int
number of samples for the Obs (default 1000).
Returns
-------
res : Obs
Generated Observable
"""
if dvalue <= 0.0:
return Obs([np.zeros(samples) + value], [name])
@ -83,6 +97,11 @@ def gen_correlated_data(means, cov, name, tau=0.5, samples=1000):
every dataset.
samples : int
number of samples to be generated for each observable.
Returns
-------
corr_obs : list[Obs]
Generated observable list
"""
assert len(means) == cov.shape[-1]