Plots for poster
This commit is contained in:
parent
5d33ff6dbf
commit
a5b22b5bef
10 changed files with 29964 additions and 19277 deletions
31
modeling.py
Normal file
31
modeling.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import numpy as np
|
||||
def calc_upper(c: int, m: float, b: float) -> float:
|
||||
return np.floor(c / 32) * 32 * m + b
|
||||
|
||||
def calc_lower(c: int, m: float, b: float) -> float:
|
||||
return np.ceil(c / 32) * 32 * 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_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)
|
||||
else:
|
||||
return calc_lower(c, m_l, b_l)
|
||||
|
||||
def lin_interpol(x0:float, x1:float, y0:float, y1:float) -> (float, float):
|
||||
m = (y1 - y0) / (x1 - x0)
|
||||
b = y1 - m * x1
|
||||
return m, b
|
||||
|
||||
def calculate_deltas(sweep:list[float]):
|
||||
deltas = []
|
||||
lv = sweep[0]
|
||||
for meas in list(sweep)[1:]:
|
||||
deltas.append((meas / lv))
|
||||
lv = meas
|
||||
return deltas
|
||||
|
||||
def compute_absolute_percentage_errors(measurements: list[float], guesses: list[float]):
|
||||
return [np.abs((guess - meas) / meas) * 100 for guess, meas in zip(guesses, measurements)]
|
||||
Loading…
Add table
Add a link
Reference in a new issue