-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatasheet.py
More file actions
145 lines (133 loc) · 3.74 KB
/
datasheet.py
File metadata and controls
145 lines (133 loc) · 3.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/usr/bin/env python3
import numpy as np
from scipy.interpolate import interp1d
def read_plot_from_pixels(xmin_px, xmax_px, xmin_val, xmax_val, xs_px):
xs_val = []
for x_px in xs_px:
x_normalised = (x_px - xmin_px) / (xmax_px - xmin_px)
x_val = x_normalised * (xmax_val - xmin_val) + xmin_val
xs_val.append(x_val)
return xs_val
def interploate_from_pixels(xmin_px,
xmax_px,
xmin_val,
xmax_val,
xs_px,
ymin_px,
ymax_px,
ymin_val,
ymax_val,
ys_px,
resolution=500,
xnew=None,
plot=False,
show=True):
xs_val = read_plot_from_pixels(xmin_px, xmax_px, xmin_val, xmax_val, xs_px)
ys_val = read_plot_from_pixels(ymin_px, ymax_px, ymin_val, ymax_val, ys_px)
if xnew is None:
xnew = np.linspace(min(xs_val),
max(xs_val),
num=resolution,
endpoint=True)
f = interp1d(xs_val,
ys_val,
kind='cubic',
bounds_error=False,
fill_value=(ys_val[0], ys_val[-1]))
ynew = f(xnew)
if plot:
from plotting import plt
plt.plot(xs_val, ys_val, label='measured')
plt.plot(xnew, ynew, label='interp')
if show:
plt.show()
return xnew, ynew
def get_diode_response(xnew=None, resolution=500, plot=False, show=True):
xs_px = [
642, 662, 692, 722, 755, 791, 816, 852, 866, 898, 948, 993, 1155, 1332,
1512, 1700
]
ys_px = [
282, 282, 282, 282, 282, 286, 301, 347, 374, 441, 545, 622, 794, 865,
894, 908
]
xmin_px, xmax_px, xmin_val, xmax_val = 630, 1769, 1000, 31000
ymin_px, ymax_px, ymin_val, ymax_val = 929, 186, 0, 0.3
X, Y = interploate_from_pixels(xmin_px,
xmax_px,
xmin_val,
xmax_val,
xs_px,
ymin_px,
ymax_px,
ymin_val,
ymax_val,
ys_px,
xnew=xnew,
plot=plot,
show=show)
return X, Y
Ag_filters = [
{
'material': 'Mo',
'thickness_um': 10,
'channel': 1,
'scope': 4
}, # Ag wire
{
'material': 'Al',
'thickness_um': 130,
'channel': 1,
'scope': 7
},
{
'material': 'Co',
'thickness_um': 5,
'channel': 3,
'scope': 7
},
{
'material': 'Ti',
'thickness_um': 12.5 + 3 + 3,
'channel': 2,
'scope': 7
},
{
'material': 'Al',
'thickness_um': 13,
'channel': 3,
'scope': 4
},
]
Cu_filters = [
{
'material': 'Cu',
'thickness_um': 4,
'channel': 1,
'scope': 4
}, # Cu wire
{
'material': 'Al',
'thickness_um': 130,
'channel': 1,
'scope': 7
},
{
'material': 'Co',
'thickness_um': 5,
'channel': 3,
'scope': 7
},
{
'material': 'Ti',
'thickness_um': 12.5 + 3 + 3,
'channel': 2,
'scope': 7
},
{
'material': 'Al',
'thickness_um': 13,
'channel': 3,
'scope': 4
},
]