mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-03-15 06:40:24 +01:00
fits fit_exp removed
This commit is contained in:
parent
f4abad1280
commit
0b158f8731
3 changed files with 2 additions and 29 deletions
2
.github/workflows/flake8.yml
vendored
2
.github/workflows/flake8.yml
vendored
|
@ -1,4 +1,4 @@
|
|||
name: flake8 Lint
|
||||
name: flake8
|
||||
|
||||
on:
|
||||
push:
|
||||
|
|
|
@ -17,6 +17,7 @@ All notable changes to this project will be documented in this file.
|
|||
- The function `plot_corrs` was deprecated as all its functionality is now contained within `Corr.show`
|
||||
- The kwarg `bias_correction` in `derived_observable` was removed
|
||||
- Obs no longer have an attribute `e_Q`
|
||||
- Removed `fits.fit_exp`
|
||||
|
||||
## [1.1.0] - 2021-10-11
|
||||
### Added
|
||||
|
|
|
@ -512,34 +512,6 @@ def fit_lin(x, y, **kwargs):
|
|||
raise Exception('Unsupported types for x')
|
||||
|
||||
|
||||
def fit_exp(data, **kwargs):
|
||||
"""Fit a single exponential to a discrete time series of Obs without errors.
|
||||
|
||||
Keyword arguments
|
||||
-----------------
|
||||
shift -- specifies the absolute timeslice value of the first entry of data (default 0.0)
|
||||
only important if one is interested in the matrix element, for the mass this is irrelevant.
|
||||
"""
|
||||
if 'shift' in kwargs:
|
||||
shift = kwargs.get("shift")
|
||||
else:
|
||||
shift = 0
|
||||
length = len(data)
|
||||
xsum = 0
|
||||
xsum2 = 0
|
||||
ysum = 0
|
||||
xysum = 0
|
||||
for i in range(shift, length + shift):
|
||||
xsum += i
|
||||
xsum2 += i ** 2
|
||||
tmp_log = np.log(np.abs(data[i - shift]))
|
||||
ysum += tmp_log
|
||||
xysum += i * tmp_log
|
||||
res0 = -(length * xysum - xsum * ysum) / (length * xsum2 - xsum * xsum) # mass
|
||||
res1 = np.exp((xsum2 * ysum - xsum * xysum) / (length * xsum2 - xsum * xsum)) # matrix element
|
||||
return [res0, res1]
|
||||
|
||||
|
||||
def qqplot(x, o_y, func, p):
|
||||
""" Generates a quantile-quantile plot of the fit result which can be used to
|
||||
check if the residuals of the fit are gaussian distributed.
|
||||
|
|
Loading…
Add table
Reference in a new issue