Plots for poster
This commit is contained in:
parent
5d33ff6dbf
commit
a5b22b5bef
10 changed files with 29964 additions and 19277 deletions
BIN
__pycache__/experiment_loader.cpython-313.pyc
Normal file
BIN
__pycache__/experiment_loader.cpython-313.pyc
Normal file
Binary file not shown.
BIN
__pycache__/modeling.cpython-313.pyc
Normal file
BIN
__pycache__/modeling.cpython-313.pyc
Normal file
Binary file not shown.
23606
channel_experiments.ipynb
Normal file
23606
channel_experiments.ipynb
Normal file
File diff suppressed because one or more lines are too long
28
experiment_loader.py
Normal file
28
experiment_loader.py
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
import csv
|
||||||
|
def load_2d_experiment(filename: str):
|
||||||
|
with open(filename) as csvfile:
|
||||||
|
spamreader = csv.reader(csvfile, delimiter=',', quotechar='|')
|
||||||
|
rows = list(spamreader)
|
||||||
|
x = [int(row[0]) for row in rows]
|
||||||
|
y = [float(row[1]) for row in rows]
|
||||||
|
return (x, y)
|
||||||
|
|
||||||
|
def load_3d_experiment(filename: str):
|
||||||
|
with open(filename) as csvfile:
|
||||||
|
offset = 1 if csv.Sniffer().has_header(csvfile.read(1024)) else 0
|
||||||
|
csvfile.seek(0)
|
||||||
|
spamreader = csv.reader(csvfile, delimiter=',', quotechar='|')
|
||||||
|
rows = list(spamreader)[offset:]
|
||||||
|
x = []
|
||||||
|
y = []
|
||||||
|
z = []
|
||||||
|
# for row in rows[offset]:
|
||||||
|
# print(row)
|
||||||
|
# x.append(int(row[0]))
|
||||||
|
# y.append(int(row[1]))
|
||||||
|
# z.append(float(row[2]))
|
||||||
|
|
||||||
|
x = [int(row[0]) for row in rows]
|
||||||
|
y = [int(row[1]) for row in rows]
|
||||||
|
z = [float(row[2]) for row in rows]
|
||||||
|
return (x, y, z)
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
pandas
|
pandas
|
||||||
plotly
|
plotly
|
||||||
scipy
|
scipy
|
||||||
|
kaleido
|
||||||
]))
|
]))
|
||||||
];
|
];
|
||||||
packages = [
|
packages = [
|
||||||
|
|
@ -37,8 +38,7 @@
|
||||||
];
|
];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
python --version
|
python --version
|
||||||
exec fish
|
jupyter-lab --no-browser
|
||||||
. ./.venv/bin/activate.fish
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
1
images/delta_approx.svg
Normal file
1
images/delta_approx.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 32 KiB |
1
images/fig1.svg
Normal file
1
images/fig1.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 219 KiB |
1
images/step_approx.svg
Normal file
1
images/step_approx.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 33 KiB |
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)]
|
||||||
25569
notebook.ipynb
25569
notebook.ipynb
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue