Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add fit.py #4

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

add fit.py #4

wants to merge 7 commits into from

Conversation

OOLebedenko
Copy link
Contributor

No description provided.



def fit_limit(data: List[Union[float, int]], window_size=50, pos_diff_ratio=0.5) -> int:
def fit_limit(data: List[Union[float, int]],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bad function name. Should be smth like estimate_acorr_fitting_limit

@@ -22,14 +21,18 @@ def fit_limit(data: List[Union[float, int]], window_size=50, pos_diff_ratio=0.5)
amount of negative derivatives
"""

def moving_average(data_set, periods=3):
def moving_average(data_set,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't split short function signature across multiple lines

@@ -48,17 +51,17 @@ def __multi_exp_f(x: Union[float, int],
:param C: free element
:return: sum exponential functions composition
"""
return np.sum(
return sum(
(a * np.exp(-x / tau)) for a, tau in zip(A, TAU)
) + C


def multi_exp_free_amplitude(x: Union[float, int],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

short function signature should be one line

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename function. Now it's name is not very telling.

@@ -72,7 +75,13 @@ def multi_exp_free_amplitude(x: Union[float, int],
return __multi_exp_f(x, A, TAU, C)


def mult_exp_fixed_amplitude_1(x, *args):
def multi_exp_fixed_amplitude_1(x: Union[float, int],
*args):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

:fit_func: function for fit data
:return: Fit curve parameters
"""
def scale_times(args,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@@ -90,7 +99,7 @@ def fit_auto_correlation(time: List[float],
bounds: List[List[List[Union[float, int]]]]) \
-> Tuple[int, Union[np.ndarray, Iterable, int, float]]:
"""
Fit input data with :math:`\sum_n A_n \exp(-t/\\tau_n) + const`
Fit input data with :math: sum_n(A_n exp(-t/tau_n) + const)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't break latex formula

@@ -122,12 +131,25 @@ def decorated_fit_auto_correlation(time: List[float],
bounds: List[List[Union[float, int]]],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants