2D model trial
This commit is contained in:
parent
232c6d945a
commit
b7114d815f
1288 changed files with 17207 additions and 6644 deletions
22
modeling.py
22
modeling.py
|
|
@ -1,18 +1,20 @@
|
|||
import numpy as np
|
||||
def calc_upper(c: int, m: float, b: float) -> float:
|
||||
return np.floor(c / 32) * 32 * m + b
|
||||
def calc_upper(c: int, m: float, b: float, period: float) -> float:
|
||||
return np.floor(c / period) * period * m + b
|
||||
|
||||
def calc_lower(c: int, m: float, b: float) -> float:
|
||||
return np.ceil(c / 32) * 32 * m + b
|
||||
def calc_lower(c: int, m: float, b: float, period: float) -> float:
|
||||
return np.ceil(c / period) * period * m + b
|
||||
|
||||
def calc_mean(c:int , m_u: float, b_u: float, m_l: float, b_l: float) -> float:
|
||||
return (calc_upper(c, m_u, b_u) + calc_lower(c, m_l, b_l)) / 2
|
||||
def calc_mean(c:int , m_u: float, b_u: float, m_l: float, b_l: float, period: float) -> float:
|
||||
return (calc_upper(c, m_u, b_u, period) + calc_lower(c, m_l, b_l, period)) / 2
|
||||
|
||||
def calc_rect(c:int , m_u: float, b_u: float, m_l: float, b_l: float) -> float:
|
||||
if ((c - 1) % 8) < 4:
|
||||
return calc_upper(c, m_u, b_u)
|
||||
|
||||
def calc_rect(c:int , m_u: float, b_u: float, m_l: float, b_l: float, step_period: float, rect_period: float) -> float:
|
||||
if ((c - 1) % rect_period) < 4:
|
||||
return calc_upper(c, m_u, b_u, step_period)
|
||||
else:
|
||||
return calc_lower(c, m_l, b_l)
|
||||
return calc_lower(c, m_l, b_l, step_period)
|
||||
|
||||
|
||||
def lin_interpol(x0:float, x1:float, y0:float, y1:float) -> (float, float):
|
||||
m = (y1 - y0) / (x1 - x0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue