funfit module
get y = f(x) based on pair of two points using given function shape.
This is the internal module to help point values calculation.
- lin_fit(x, xy_0: tuple, xy_1: tuple)
Get value of point using linear function
Get
using linear function of form on range- Parameters:
x (scalar) – Point for which return value of y
xy_0 (tuple of two floats) – Starting point (x0, y0)
xy_1 (tuple of two floats) – Ending point (x1, y1)
- Returns:
Value of y at point x.
- Return type:
float
Examples
>>> xy_0 = (10, 10) >>> xy_1 = (20, 30) >>> x = 11 >>> lin_fit(x, xy_0, xy_1) 12.0
- exp_fit(x, xy_0: tuple, xy_1: tuple, alpha: float = 2.0)
Get value of point using exponential function
Get
using exp function of form on range scaled to- Parameters:
x (float) – Point for which return value of y
xy_0 (tuple of two floats) – Starting point (x0, y0)
xy_1 (tuple of two floats) – Ending point (x1, y1)
alpha (float, optional) – Exponent factor. Default is 2.
- Returns:
Value of y at point x.
- Return type:
float
Examples
>>> xy_0 = (10, 10) >>> xy_1 = (20, 30) >>> x = 11 >>> exp_fit(x, xy_0, xy_1, alpha=2.0) 10.2
- exp_xy_fit(x, xy_0: tuple, xy_1: tuple, alpha: float = 2.0)
Get value of point using exponential function mirrored over y=x
Get
using exp function mirrored over line of form on range scaled to- Parameters:
x (float) – Point for which return value of y
xy_0 (tuple of two floats) – Starting point (x0, y0)
xy_1 (tuple of two floats) – Ending point (x1, y1)
alpha (float, optional) – Exponent factor. Default is 2.
- Returns:
Value of y at point x.
- Return type:
float
Examples
>>> xy_0 = (10, 10) >>> xy_1 = (20, 30) >>> x = 19 >>> exp_xy_fit(x, xy_0, xy_1, alpha=2.0) 29.8
- exp_lin_fit(x, xy_0: tuple, xy_1: tuple, alpha=2)
Get value of point using combination of linear and exponential function
Get
using linear and exp function line of form on range scaled to whereIt is a linear combination of values returned be
exp_fit()
andlin_fit()
.- Parameters:
x (float) – Point for which return value of y
xy_0 (tuple of two floats) – Starting point (x0, y0)
xy_1 (tuple of two floats) – Ending point (x1, y1)
alpha (float, optional) – Exponent factor. Default is 2.
- Returns:
Value of y at point x.
- Return type:
float
Examples
>>> xy_0 = (10, 10) >>> xy_1 = (20, 30) >>> x = 19 >>> exp_lin_fit(x, xy_0, xy_1, alpha=2.0) 27.82
- lin_exp_xy_fit(x, xy_0: tuple, xy_1: tuple, alpha=2)
Get value of point using combination of linear and exponential function mirrored over xy line
Get
using linear and exp function line mirrored over xy of form on range scaled toIt is a linear combination of values returned be
lin_fit()
andexp_xy_fit()
.- Parameters:
x (float) – Point for which return value of y
xy_0 (tuple of two floats) – Starting point (x0, y0)
xy_1 (tuple of two floats) – Ending point (x1, y1)
alpha (float, optional) – Exponent factor. Default is 2.
- Returns:
Value of y at point x.
- Return type:
float
Examples
>>> xy_0 = (10, 10) >>> xy_1 = (20, 30) >>> x = 19 >>> exp_xy_fit(x, xy_0, xy_1, alpha=2.0) 29.8