pyTEMlib 0.2024.8.4__py3-none-any.whl → 0.2025.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pyTEMlib might be problematic. Click here for more details.
- pyTEMlib/animation.py +1 -1
- pyTEMlib/atom_tools.py +2 -1
- pyTEMlib/core_loss_widget.py +337 -272
- pyTEMlib/eels_dialog.py +15 -10
- pyTEMlib/eels_tools.py +452 -125
- pyTEMlib/file_tools.py +314 -30
- pyTEMlib/image_tools.py +91 -15
- pyTEMlib/info_widget.py +211 -58
- pyTEMlib/info_widget3.py +1120 -0
- pyTEMlib/low_loss_widget.py +344 -41
- pyTEMlib/peak_dialog.py +141 -59
- pyTEMlib/probe_tools.py +65 -8
- pyTEMlib/version.py +2 -2
- {pyTEMlib-0.2024.8.4.dist-info → pyTEMlib-0.2025.2.1.dist-info}/METADATA +16 -7
- {pyTEMlib-0.2024.8.4.dist-info → pyTEMlib-0.2025.2.1.dist-info}/RECORD +19 -18
- {pyTEMlib-0.2024.8.4.dist-info → pyTEMlib-0.2025.2.1.dist-info}/WHEEL +1 -2
- {pyTEMlib-0.2024.8.4.dist-info → pyTEMlib-0.2025.2.1.dist-info}/LICENSE +0 -0
- {pyTEMlib-0.2024.8.4.dist-info → pyTEMlib-0.2025.2.1.dist-info}/entry_points.txt +0 -0
- {pyTEMlib-0.2024.8.4.dist-info → pyTEMlib-0.2025.2.1.dist-info}/top_level.txt +0 -0
pyTEMlib/core_loss_widget.py
CHANGED
|
@@ -21,38 +21,45 @@ import sidpy
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
def get_core_loss_sidebar():
|
|
24
|
-
side_bar = ipywidgets.GridspecLayout(15, 3,width='auto', grid_gap="0px")
|
|
24
|
+
side_bar = ipywidgets.GridspecLayout(15, 3, width='auto', grid_gap="0px")
|
|
25
25
|
|
|
26
26
|
side_bar[0, :2] = ipywidgets.Dropdown(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
options=[('None', 0)],
|
|
28
|
+
value=0,
|
|
29
|
+
description='Main Dataset:',
|
|
30
|
+
disabled=False)
|
|
31
|
+
|
|
32
32
|
row = 1
|
|
33
33
|
side_bar[row, :3] = ipywidgets.ToggleButton(description='Fit Area',
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
layout=ipywidgets.Layout(
|
|
35
|
+
width='auto', grid_area='header'),
|
|
36
|
+
tooltip='Shows fit regions and regions excluded from fit',
|
|
37
|
+
button_style='info') # ipywidgets.ButtonStyle(button_color='lightblue'))
|
|
37
38
|
row += 1
|
|
38
|
-
side_bar[row, :2] = ipywidgets.FloatText(
|
|
39
|
-
|
|
39
|
+
side_bar[row, :2] = ipywidgets.FloatText(
|
|
40
|
+
value=7.5, description='Fit Start:', disabled=False, color='black', layout=ipywidgets.Layout(width='200px'))
|
|
41
|
+
side_bar[row, 2] = ipywidgets.widgets.Label(
|
|
42
|
+
value="eV", layout=ipywidgets.Layout(width='20px'))
|
|
40
43
|
row += 1
|
|
41
|
-
side_bar[row, :2] = ipywidgets.FloatText(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
side_bar[row, :2] = ipywidgets.FloatText(
|
|
45
|
+
value=0.1, description='Fit End:', disabled=False, color='black', layout=ipywidgets.Layout(width='200px'))
|
|
46
|
+
side_bar[row, 2] = ipywidgets.widgets.Label(
|
|
47
|
+
value="eV", layout=ipywidgets.Layout(width='20px'))
|
|
48
|
+
|
|
44
49
|
row += 1
|
|
45
|
-
|
|
50
|
+
|
|
46
51
|
side_bar[row, :3] = ipywidgets.Button(description='Elements',
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
layout=ipywidgets.Layout(
|
|
53
|
+
width='auto', grid_area='header'),
|
|
54
|
+
style=ipywidgets.ButtonStyle(button_color='lightblue'))
|
|
49
55
|
row += 1
|
|
50
56
|
side_bar[row, :2] = ipywidgets.Dropdown(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
options=[('Edge 1', 0), ('Edge 2', 1), ('Edge 3', 2),
|
|
58
|
+
('Edge 4', 3), ('Add Edge', -1)],
|
|
59
|
+
value=0,
|
|
60
|
+
description='Edges:',
|
|
61
|
+
disabled=False,
|
|
62
|
+
layout=ipywidgets.Layout(width='200px'))
|
|
56
63
|
"""side_bar[row,2] = ipywidgets.ToggleButton(
|
|
57
64
|
description='Regions',
|
|
58
65
|
disabled=False,
|
|
@@ -62,131 +69,152 @@ def get_core_loss_sidebar():
|
|
|
62
69
|
)
|
|
63
70
|
"""
|
|
64
71
|
row += 1
|
|
65
|
-
side_bar[row, :2] = ipywidgets.IntText(
|
|
66
|
-
|
|
72
|
+
side_bar[row, :2] = ipywidgets.IntText(
|
|
73
|
+
value=7.5, description='Z:', disabled=False, color='black', layout=ipywidgets.Layout(width='200px'))
|
|
74
|
+
side_bar[row, 2] = ipywidgets.widgets.Label(
|
|
75
|
+
value="", layout=ipywidgets.Layout(width='100px'))
|
|
67
76
|
row += 1
|
|
68
77
|
side_bar[row, :2] = ipywidgets.Dropdown(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
options=['K1', 'L3', 'M5', 'M3', 'M1', 'N7', 'N5', 'N3', 'N1'],
|
|
79
|
+
value='K1',
|
|
80
|
+
description='Symmetry:',
|
|
81
|
+
disabled=False,
|
|
82
|
+
layout=ipywidgets.Layout(width='200px'))
|
|
74
83
|
row += 1
|
|
75
|
-
side_bar[row, :2] = ipywidgets.FloatText(
|
|
76
|
-
|
|
84
|
+
side_bar[row, :2] = ipywidgets.FloatText(
|
|
85
|
+
value=0.1, description='Onset:', disabled=False, color='black', layout=ipywidgets.Layout(width='200px'))
|
|
86
|
+
side_bar[row, 2] = ipywidgets.widgets.Label(
|
|
87
|
+
value="eV", layout=ipywidgets.Layout(width='100px'))
|
|
77
88
|
row += 1
|
|
78
|
-
side_bar[row, :2] = ipywidgets.FloatText(
|
|
79
|
-
|
|
89
|
+
side_bar[row, :2] = ipywidgets.FloatText(
|
|
90
|
+
value=0.1, description='Excl.Start:', disabled=False, color='black', layout=ipywidgets.Layout(width='200px'))
|
|
91
|
+
side_bar[row, 2] = ipywidgets.widgets.Label(
|
|
92
|
+
value="eV", layout=ipywidgets.Layout(width='100px'))
|
|
80
93
|
row += 1
|
|
81
|
-
side_bar[row, :2] = ipywidgets.FloatText(
|
|
82
|
-
|
|
94
|
+
side_bar[row, :2] = ipywidgets.FloatText(
|
|
95
|
+
value=0.1, description='Excl.End:', disabled=False, color='black', layout=ipywidgets.Layout(width='200px'))
|
|
96
|
+
side_bar[row, 2] = ipywidgets.widgets.Label(
|
|
97
|
+
value="eV", layout=ipywidgets.Layout(width='100px'))
|
|
83
98
|
row += 1
|
|
84
|
-
side_bar[row, :2] = ipywidgets.FloatText(
|
|
85
|
-
|
|
99
|
+
side_bar[row, :2] = ipywidgets.FloatText(
|
|
100
|
+
value=0.1, description='Mutliplier:', disabled=False, color='black', layout=ipywidgets.Layout(width='200px'))
|
|
101
|
+
side_bar[row, 2] = ipywidgets.widgets.Label(
|
|
102
|
+
value="a.u.", layout=ipywidgets.Layout(width='100px'))
|
|
86
103
|
row += 1
|
|
87
|
-
|
|
104
|
+
|
|
88
105
|
side_bar[row, :3] = ipywidgets.Button(description='Quantification',
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
side_bar[row,0] = ipywidgets.ToggleButton(
|
|
94
|
-
description='Probabiity',
|
|
95
|
-
disabled=False,
|
|
96
|
-
button_style='', # 'success', 'info', 'warning', 'danger' or ''
|
|
97
|
-
tooltip='Changes y-axis to probability of flux is given',
|
|
98
|
-
layout=ipywidgets.Layout(width='100px')
|
|
99
|
-
)
|
|
100
|
-
side_bar[row,1] = ipywidgets.ToggleButton(
|
|
101
|
-
description='Conv.LL',
|
|
102
|
-
disabled=False,
|
|
103
|
-
button_style='', # 'success', 'info', 'warning', 'danger' or ''
|
|
104
|
-
tooltip='Changes y-axis to probability of flux is given',
|
|
105
|
-
layout=ipywidgets.Layout(width='100px')
|
|
106
|
-
)
|
|
107
|
-
side_bar[row,2] = ipywidgets.ToggleButton(
|
|
108
|
-
description='Show Edges',
|
|
109
|
-
disabled=False,
|
|
110
|
-
button_style='', # 'success', 'info', 'warning', 'danger' or ''
|
|
111
|
-
tooltip='Changes y-axis to probability of flux is given',
|
|
112
|
-
layout=ipywidgets.Layout(width='100px')
|
|
113
|
-
)
|
|
114
|
-
|
|
106
|
+
layout=ipywidgets.Layout(
|
|
107
|
+
width='auto', grid_area='header'),
|
|
108
|
+
style=ipywidgets.ButtonStyle(button_color='lightblue'))
|
|
109
|
+
|
|
115
110
|
row += 1
|
|
116
|
-
side_bar[row,0] = ipywidgets.ToggleButton(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
111
|
+
side_bar[row, 0] = ipywidgets.ToggleButton(
|
|
112
|
+
description='Probabiity',
|
|
113
|
+
disabled=False,
|
|
114
|
+
button_style='', # 'success', 'info', 'warning', 'danger' or ''
|
|
115
|
+
tooltip='Changes y-axis to probability of flux is given',
|
|
116
|
+
layout=ipywidgets.Layout(width='100px')
|
|
117
|
+
)
|
|
118
|
+
side_bar[row, 1] = ipywidgets.ToggleButton(
|
|
119
|
+
description='Conv.LL',
|
|
120
|
+
disabled=False,
|
|
121
|
+
button_style='', # 'success', 'info', 'warning', 'danger' or ''
|
|
122
|
+
tooltip='Changes y-axis to probability of flux is given',
|
|
123
|
+
layout=ipywidgets.Layout(width='100px')
|
|
124
|
+
)
|
|
125
|
+
side_bar[row, 2] = ipywidgets.ToggleButton(
|
|
126
|
+
description='Show Edges',
|
|
127
|
+
disabled=False,
|
|
128
|
+
button_style='', # 'success', 'info', 'warning', 'danger' or ''
|
|
129
|
+
tooltip='Changes y-axis to probability of flux is given',
|
|
130
|
+
layout=ipywidgets.Layout(width='100px')
|
|
131
|
+
)
|
|
123
132
|
|
|
124
|
-
|
|
125
|
-
|
|
133
|
+
row += 1
|
|
134
|
+
side_bar[row, 0] = ipywidgets.ToggleButton(
|
|
135
|
+
description='Do All',
|
|
136
|
+
disabled=False,
|
|
137
|
+
button_style='', # 'success', 'info', 'warning', 'danger' or ''
|
|
138
|
+
tooltip='Fits all spectra of spectrum image',
|
|
139
|
+
layout=ipywidgets.Layout(width='100px')
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
side_bar[row, 1:3] = ipywidgets.IntProgress(value=0, min=0, max=10, description=' ', bar_style='', # 'success', 'info', 'warning', 'danger' or ''
|
|
143
|
+
style={'bar_color': 'maroon'}, orientation='horizontal')
|
|
126
144
|
return side_bar
|
|
127
145
|
|
|
128
146
|
|
|
129
|
-
|
|
130
147
|
class CoreLoss(object):
|
|
131
148
|
def __init__(self, sidebar=None, parent=None):
|
|
132
149
|
self.parent = parent
|
|
133
150
|
self.dataset = parent.dataset
|
|
134
151
|
self.core_loss_tab = sidebar
|
|
135
|
-
|
|
152
|
+
|
|
136
153
|
self.model = []
|
|
137
154
|
self.edges = {}
|
|
138
155
|
self.count = 0
|
|
139
|
-
self.cl_key = ''
|
|
140
|
-
|
|
141
|
-
self.periodic_table = eels_dialog_utilities.PeriodicTableWidget(
|
|
156
|
+
self.cl_key = 'None'
|
|
157
|
+
|
|
158
|
+
self.periodic_table = eels_dialog_utilities.PeriodicTableWidget(
|
|
159
|
+
self.parent.energy_scale)
|
|
142
160
|
self.elements_cancel_button = ipywidgets.Button(description='Cancel')
|
|
143
161
|
self.elements_select_button = ipywidgets.Button(description='Select')
|
|
144
162
|
self.elements_auto_button = ipywidgets.Button(description='Auto ID')
|
|
145
|
-
|
|
163
|
+
|
|
146
164
|
self.periodic_table_panel = ipywidgets.VBox([self.periodic_table.periodic_table,
|
|
147
165
|
ipywidgets.HBox([self.elements_cancel_button, self.elements_auto_button, self.elements_select_button])])
|
|
148
|
-
|
|
166
|
+
|
|
149
167
|
# self.update_cl_sidebar()
|
|
150
168
|
self.set_cl_action()
|
|
151
|
-
|
|
169
|
+
|
|
152
170
|
def update_cl_key(self, value=0):
|
|
153
171
|
self.cl_key = self.core_loss_tab[0, 0].value.split(':')[0]
|
|
172
|
+
self.parent.coreloss_key = self.cl_key
|
|
173
|
+
if 'None' in self.cl_key:
|
|
174
|
+
return
|
|
154
175
|
self.parent.set_dataset(self.cl_key)
|
|
155
|
-
|
|
156
|
-
self.dataset = self.parent.dataset
|
|
157
|
-
print(self.cl_key, self.core_loss_tab[0, 0].value)
|
|
158
176
|
|
|
159
|
-
|
|
160
|
-
if self.cl_key not in self.core_loss_tab[0, 0].options:
|
|
161
|
-
self.cl_key = self.core_loss_tab[0, 0].value.split(':')[0]
|
|
162
|
-
self.parent.set_dataset(self.cl_key)
|
|
177
|
+
self.dataset = self.parent.datasets[self.cl_key]
|
|
163
178
|
|
|
164
|
-
self.dataset = self.parent.dataset
|
|
165
179
|
|
|
166
180
|
def update_cl_sidebar(self):
|
|
167
|
-
|
|
168
|
-
spectrum_list = ['None '+str(self.count)]
|
|
181
|
+
spectrum_list = ['None']
|
|
169
182
|
cl_index = 0
|
|
183
|
+
self.cl_key = self.parent.coreloss_key
|
|
170
184
|
for index, key in enumerate(self.parent.datasets.keys()):
|
|
171
185
|
if isinstance(self.parent.datasets[key], sidpy.Dataset):
|
|
172
186
|
if 'SPECTR' in self.parent.datasets[key].data_type.name:
|
|
173
|
-
spectrum_list.append(
|
|
187
|
+
spectrum_list.append(
|
|
188
|
+
f'{key}: {self.parent.datasets[key].title}')
|
|
174
189
|
if key == self.cl_key:
|
|
175
|
-
cl_index = index
|
|
176
|
-
self.cl_key = spectrum_list[cl_index]
|
|
190
|
+
cl_index = index+1
|
|
177
191
|
self.core_loss_tab[0, 0].options = spectrum_list
|
|
178
192
|
self.core_loss_tab[0, 0].value = spectrum_list[cl_index]
|
|
179
|
-
|
|
193
|
+
if '_relationship' in self.parent.datasets.keys():
|
|
194
|
+
self.update_cl_dataset()
|
|
195
|
+
self.set_fit_start()
|
|
196
|
+
self.parent.plot()
|
|
180
197
|
|
|
198
|
+
def update_cl_dataset(self, value=0):
|
|
199
|
+
self.cl_key = self.core_loss_tab[0, 0].value.split(':')[0]
|
|
200
|
+
self.parent.coreloss_key = self.cl_key
|
|
201
|
+
if '_relationship' in self.parent.datasets.keys():
|
|
202
|
+
self.parent.datasets['_relationship']['core_loss'] = self.cl_key
|
|
181
203
|
|
|
204
|
+
if 'None' in self.cl_key:
|
|
205
|
+
return
|
|
206
|
+
self.parent.set_dataset(self.cl_key)
|
|
207
|
+
self.dataset = self.parent.dataset
|
|
208
|
+
|
|
182
209
|
def line_select_callback(self, x_min, x_max):
|
|
183
|
-
|
|
184
|
-
|
|
210
|
+
self.start_cursor.value = np.round(x_min, 3)
|
|
211
|
+
self.end_cursor.value = np.round(x_max, 3)
|
|
212
|
+
|
|
213
|
+
self.start_channel = np.searchsorted(
|
|
214
|
+
self.datasets[self.cl_key].energy_loss, self.start_cursor.value)
|
|
215
|
+
self.end_channel = np.searchsorted(
|
|
216
|
+
self.datasets[self.cl_key].energy_loss, self.end_cursor.value)
|
|
185
217
|
|
|
186
|
-
self.start_channel = np.searchsorted(self.datasets[self.key].energy_loss, self.start_cursor.value)
|
|
187
|
-
self.end_channel = np.searchsorted(self.datasets[self.key].energy_loss, self.end_cursor.value)
|
|
188
|
-
|
|
189
|
-
|
|
190
218
|
def plot(self, scale=True):
|
|
191
219
|
self.parent.dataset.metadata['edges'] = self.edges
|
|
192
220
|
self.parent.plot(scale=scale)
|
|
@@ -194,9 +222,11 @@ class CoreLoss(object):
|
|
|
194
222
|
spectrum = self.parent.spectrum
|
|
195
223
|
if len(self.model) > 1:
|
|
196
224
|
self.model = self.edges['model']['spectrum'].copy()
|
|
197
|
-
#self.parent.axis.plot(self.parent.energy_scale, (self.edges['model']['spectrum'])*y_scale, label='difference')
|
|
198
|
-
self.parent.axis.plot(self.parent.energy_scale,
|
|
199
|
-
|
|
225
|
+
# self.parent.axis.plot(self.parent.energy_scale, (self.edges['model']['spectrum'])*y_scale, label='difference')
|
|
226
|
+
self.parent.axis.plot(self.parent.energy_scale,
|
|
227
|
+
self.model*y_scale, label='model')
|
|
228
|
+
self.parent.axis.plot(self.parent.energy_scale,
|
|
229
|
+
spectrum-self.model*y_scale, label='difference')
|
|
200
230
|
self.parent.axis.legend()
|
|
201
231
|
pass
|
|
202
232
|
if self.core_loss_tab[13, 2].value:
|
|
@@ -204,8 +234,7 @@ class CoreLoss(object):
|
|
|
204
234
|
if self.core_loss_tab[1, 0].value:
|
|
205
235
|
self.plot_regions()
|
|
206
236
|
self.parent.figure.canvas.draw_idle()
|
|
207
|
-
|
|
208
|
-
|
|
237
|
+
|
|
209
238
|
def plot_regions(self):
|
|
210
239
|
axis = self.parent.figure.gca()
|
|
211
240
|
y_min, y_max = axis.get_ylim()
|
|
@@ -223,7 +252,7 @@ class CoreLoss(object):
|
|
|
223
252
|
axis.text(x_min, y_max, 'fit region', verticalalignment='top')
|
|
224
253
|
color = 'red'
|
|
225
254
|
alpha = 0.5
|
|
226
|
-
|
|
255
|
+
|
|
227
256
|
for key in self.edges:
|
|
228
257
|
if key.isdigit():
|
|
229
258
|
x_min = self.edges[key]['start_exclude']
|
|
@@ -231,31 +260,32 @@ class CoreLoss(object):
|
|
|
231
260
|
rect.append(patches.Rectangle((x_min, y_min), width, height,
|
|
232
261
|
edgecolor=color, alpha=alpha, facecolor=color))
|
|
233
262
|
axis.add_patch(rect[-1])
|
|
234
|
-
axis.text(
|
|
263
|
+
axis.text(
|
|
264
|
+
x_min, y_max, f"exclude\n edge {int(key)+1}", verticalalignment='top')
|
|
235
265
|
|
|
236
266
|
def show_edges(self):
|
|
237
267
|
axis = self.parent.figure.gca()
|
|
238
268
|
x_min, x_max = axis.get_xlim()
|
|
239
269
|
y_min, y_max = axis.get_ylim()
|
|
240
|
-
|
|
270
|
+
|
|
241
271
|
for key, edge in self.edges.items():
|
|
242
272
|
i = 0
|
|
243
273
|
if key.isdigit():
|
|
244
274
|
element = edge['element']
|
|
245
275
|
for sym in edge['all_edges']:
|
|
246
|
-
x = edge['all_edges'][sym]['onset'] +
|
|
276
|
+
x = edge['all_edges'][sym]['onset'] + \
|
|
277
|
+
edge['chemical_shift']
|
|
247
278
|
if x_min < x < x_max:
|
|
248
279
|
axis.text(x, y_max, '\n' * i + f"{element}-{sym}",
|
|
249
|
-
|
|
280
|
+
verticalalignment='top', color='black')
|
|
250
281
|
axis.axvline(x, ymin=0, ymax=1, color='gray')
|
|
251
282
|
i += 1
|
|
252
283
|
|
|
253
|
-
|
|
254
284
|
def update_element(self, z=0, index=-1):
|
|
255
285
|
# We check whether this element is already in the
|
|
256
286
|
if z == 0:
|
|
257
287
|
z = self.core_loss_tab[6, 0].value
|
|
258
|
-
|
|
288
|
+
|
|
259
289
|
zz = eels.get_z(z)
|
|
260
290
|
for key, edge in self.edges.items():
|
|
261
291
|
if key.isdigit():
|
|
@@ -305,9 +335,10 @@ class CoreLoss(object):
|
|
|
305
335
|
self.edges[str(index)]['all_edges'] = all_edges
|
|
306
336
|
self.edges[str(index)]['chemical_shift'] = 0.0
|
|
307
337
|
self.edges[str(index)]['areal_density'] = 0.0
|
|
308
|
-
self.edges[str(index)]['original_onset'] = self.edges[str(
|
|
338
|
+
self.edges[str(index)]['original_onset'] = self.edges[str(
|
|
339
|
+
index)]['onset']
|
|
309
340
|
return True
|
|
310
|
-
|
|
341
|
+
|
|
311
342
|
def sort_elements(self):
|
|
312
343
|
onsets = []
|
|
313
344
|
for index, edge in self.edges.items():
|
|
@@ -348,10 +379,10 @@ class CoreLoss(object):
|
|
|
348
379
|
for key in to_delete:
|
|
349
380
|
edges[key] = self.edges[key]
|
|
350
381
|
del self.edges[key]
|
|
351
|
-
|
|
382
|
+
|
|
352
383
|
for index, elem in enumerate(selected_elements):
|
|
353
|
-
if elem
|
|
354
|
-
self.edges[str(index)] = edges[str(old_elements.index(elem))]
|
|
384
|
+
if elem in old_elements:
|
|
385
|
+
self.edges[str(index)] = edges[str(old_elements.index(elem))]
|
|
355
386
|
else:
|
|
356
387
|
self.update_element(elem, index=index)
|
|
357
388
|
self.sort_elements()
|
|
@@ -362,60 +393,64 @@ class CoreLoss(object):
|
|
|
362
393
|
self.update_element(self.core_loss_tab[6, 0].value)
|
|
363
394
|
# self.sort_elements()
|
|
364
395
|
self.update()
|
|
365
|
-
|
|
366
|
-
|
|
396
|
+
|
|
367
397
|
def set_fit_start(self, value=0):
|
|
368
398
|
if 'edges' not in self.dataset.metadata:
|
|
369
399
|
self.edges = self.dataset.metadata['edges'] = {}
|
|
370
|
-
if 'fit_area' not in self.edges:
|
|
371
|
-
self.edges['fit_area'] = {'fit_start':self.parent.energy_scale[10],
|
|
400
|
+
if 'fit_area' not in self.edges:
|
|
401
|
+
self.edges['fit_area'] = {'fit_start': self.parent.energy_scale[10],
|
|
372
402
|
'fit_end': self.parent.energy_scale[-10]}
|
|
373
|
-
self.core_loss_tab[3, 0].value = str(
|
|
374
|
-
|
|
403
|
+
self.core_loss_tab[3, 0].value = str(
|
|
404
|
+
self.edges['fit_area']['fit_end'])
|
|
405
|
+
self.core_loss_tab[2, 0].value = str(
|
|
406
|
+
self.edges['fit_area']['fit_start'])
|
|
375
407
|
if self.core_loss_tab[2, 0].value < self.parent.energy_scale[0]:
|
|
376
408
|
self.core_loss_tab[2, 0].value = self.parent.energy_scale[10]
|
|
377
|
-
self.edges['fit_area']['fit_start'] = float(
|
|
409
|
+
self.edges['fit_area']['fit_start'] = float(
|
|
410
|
+
self.core_loss_tab[2, 0].value)
|
|
378
411
|
self.parent.plot()
|
|
379
|
-
|
|
412
|
+
|
|
380
413
|
def set_fit_end(self, value=0):
|
|
381
414
|
if 'edges' not in self.dataset.metadata:
|
|
382
415
|
self.edges = self.dataset.metadata['edges'] = {}
|
|
383
|
-
if 'fit_area' not in self.edges:
|
|
384
|
-
self.edges['fit_area'] = {'fit_start':self.parent.energy_scale[10],
|
|
416
|
+
if 'fit_area' not in self.edges:
|
|
417
|
+
self.edges['fit_area'] = {'fit_start': self.parent.energy_scale[10],
|
|
385
418
|
'fit_end': self.parent.energy_scale[-10]}
|
|
386
|
-
self.core_loss_tab[3, 0].value = str(
|
|
387
|
-
|
|
419
|
+
self.core_loss_tab[3, 0].value = str(
|
|
420
|
+
self.edges['fit_area']['fit_end'])
|
|
421
|
+
self.core_loss_tab[2, 0].value = str(
|
|
422
|
+
self.edges['fit_area']['fit_start'])
|
|
388
423
|
if self.core_loss_tab[3, 0].value > self.parent.energy_scale[-1]:
|
|
389
424
|
self.core_loss_tab[3, 0].value = self.parent.energy_scale[-10]
|
|
390
|
-
self.edges['fit_area']['fit_end'] = self.core_loss_tab[3, 0].value
|
|
425
|
+
self.edges['fit_area']['fit_end'] = self.core_loss_tab[3, 0].value
|
|
391
426
|
self.parent.plot()
|
|
427
|
+
|
|
392
428
|
def set_fit_area(self, value=1):
|
|
393
|
-
if 'fit_area' not in self.edges:
|
|
394
|
-
self.edges['fit_area'] = {'fit_start':self.parent.energy_scale[10],
|
|
429
|
+
if 'fit_area' not in self.edges:
|
|
430
|
+
self.edges['fit_area'] = {'fit_start': self.parent.energy_scale[10],
|
|
395
431
|
'fit_end': self.parent.energy_scale[-10]}
|
|
396
|
-
|
|
397
|
-
fit_end = str(self.edges['fit_area']['fit_end']
|
|
398
|
-
fit_start = str(self.edges['fit_area']['fit_start']
|
|
399
|
-
|
|
432
|
+
|
|
433
|
+
fit_end = str(self.edges['fit_area']['fit_end'])
|
|
434
|
+
fit_start = str(self.edges['fit_area']['fit_start'])
|
|
435
|
+
|
|
400
436
|
if fit_end > fit_start:
|
|
401
437
|
fit_start = self.parent.energy_scale[10]
|
|
402
438
|
fit_end = self.parent.energy_scale[-10]
|
|
403
439
|
self.core_loss_tab[2, 0].value = fit_start
|
|
404
440
|
self.core_loss_tab[3, 0].value = fit_end
|
|
405
|
-
self.edges['fit_area']['fit_start'] = self.core_loss_tab[2, 0].value
|
|
406
|
-
self.edges['fit_area']['fit_end'] = self.core_loss_tab[3, 0].value
|
|
407
|
-
|
|
441
|
+
self.edges['fit_area']['fit_start'] = self.core_loss_tab[2, 0].value
|
|
442
|
+
self.edges['fit_area']['fit_end'] = self.core_loss_tab[3, 0].value
|
|
443
|
+
|
|
408
444
|
self.parent.plot()
|
|
409
|
-
|
|
410
445
|
|
|
411
446
|
def auto_id(self, value=0):
|
|
412
447
|
found_edges = eels.auto_id_edges(self.dataset)
|
|
413
448
|
if len(found_edges) > 0:
|
|
414
449
|
self.periodic_table.elements_selected = found_edges
|
|
415
450
|
self.periodic_table.update()
|
|
416
|
-
|
|
451
|
+
|
|
417
452
|
def find_elements(self, value=0):
|
|
418
|
-
|
|
453
|
+
|
|
419
454
|
if '0' not in self.edges:
|
|
420
455
|
self.edges['0'] = {}
|
|
421
456
|
# found_edges = eels.auto_id_edges(self.dataset)
|
|
@@ -430,66 +465,78 @@ class CoreLoss(object):
|
|
|
430
465
|
selected_elements.append(self.edges[key]['element'])
|
|
431
466
|
self.periodic_table.elements_selected = selected_elements
|
|
432
467
|
self.periodic_table.update()
|
|
433
|
-
|
|
468
|
+
# self.periodic_table.periodic_table
|
|
469
|
+
self.parent.app_layout.center = self.periodic_table_panel
|
|
434
470
|
|
|
435
471
|
def set_figure_pane(self, value=0):
|
|
436
472
|
self.parent.app_layout.center = self.parent.panel
|
|
437
|
-
|
|
473
|
+
|
|
438
474
|
def update(self, index=0):
|
|
439
|
-
self.dataset = self.parent.dataset
|
|
440
|
-
index = self.core_loss_tab[5,0].value # which edge
|
|
475
|
+
self.dataset = self.parent.dataset
|
|
476
|
+
index = self.core_loss_tab[5, 0].value # which edge
|
|
441
477
|
if index < 0:
|
|
442
|
-
options
|
|
443
|
-
options.insert(-1, (f'Edge {len(self.core_loss_tab[5, 0].options)}', len(
|
|
444
|
-
|
|
445
|
-
self.core_loss_tab[5, 0].
|
|
478
|
+
options = list(self.core_loss_tab[5, 0].options)
|
|
479
|
+
options.insert(-1, (f'Edge {len(self.core_loss_tab[5, 0].options)}', len(
|
|
480
|
+
self.sidebar[4, 0].options)-1))
|
|
481
|
+
self.core_loss_tab[5, 0].options = options
|
|
482
|
+
self.core_loss_tab[5, 0].value = len(
|
|
483
|
+
self.core_loss_tab[5, 0].options)-2
|
|
446
484
|
if str(index) not in self.edges:
|
|
447
|
-
self.edges[str(index)] = {'z': 0, 'element': 'x', 'symmetry': 'K1', 'onset': 0, 'start_exclude': 0, 'end_exclude':0,
|
|
448
|
-
|
|
485
|
+
self.edges[str(index)] = {'z': 0, 'element': 'x', 'symmetry': 'K1', 'onset': 0, 'start_exclude': 0, 'end_exclude': 0,
|
|
486
|
+
'areal_density': 0, 'chemical_shift': 0}
|
|
449
487
|
if 'z' not in self.edges[str(index)]:
|
|
450
|
-
|
|
451
|
-
'areal_density': 0, 'chemical_shift':0}
|
|
488
|
+
self.edges[str(index)] = {'z': 0, 'element': 'x', 'symmetry': 'K1', 'onset': 0, 'start_exclude': 0, 'end_exclude': 0,
|
|
489
|
+
'areal_density': 0, 'chemical_shift': 0}
|
|
452
490
|
edge = self.edges[str(index)]
|
|
453
|
-
|
|
454
|
-
self.core_loss_tab[6,0].value = edge['z']
|
|
455
|
-
self.core_loss_tab[6,2].value = edge['element']
|
|
456
|
-
self.core_loss_tab[7,0].value = edge['symmetry']
|
|
457
|
-
self.core_loss_tab[8,0].value = edge['onset']
|
|
458
|
-
self.core_loss_tab[9,0].value = edge['start_exclude']
|
|
459
|
-
self.core_loss_tab[10,0].value = edge['end_exclude']
|
|
491
|
+
|
|
492
|
+
self.core_loss_tab[6, 0].value = edge['z']
|
|
493
|
+
self.core_loss_tab[6, 2].value = edge['element']
|
|
494
|
+
self.core_loss_tab[7, 0].value = edge['symmetry']
|
|
495
|
+
self.core_loss_tab[8, 0].value = edge['onset']
|
|
496
|
+
self.core_loss_tab[9, 0].value = edge['start_exclude']
|
|
497
|
+
self.core_loss_tab[10, 0].value = edge['end_exclude']
|
|
460
498
|
self.core_loss_tab[13, 0].value = self.parent.info_tab[9, 2].value
|
|
461
499
|
if self.parent.y_scale == 1.0:
|
|
462
500
|
self.core_loss_tab[11, 0].value = edge['areal_density']
|
|
463
|
-
self.core_loss_tab[11, 2].value =
|
|
501
|
+
self.core_loss_tab[11, 2].value = 'a.u.'
|
|
464
502
|
else:
|
|
465
|
-
dispersion = self.parent.energy_scale[1]-
|
|
466
|
-
|
|
503
|
+
dispersion = self.parent.energy_scale[1] - \
|
|
504
|
+
self.parent.energy_scale[0]
|
|
505
|
+
self.core_loss_tab[11, 0].value = np.round(
|
|
506
|
+
edge['areal_density']/self.dataset.metadata['experiment']['flux_ppm']*1e-6, 2)
|
|
467
507
|
self.core_loss_tab[11, 2].value = 'atoms/nm²'
|
|
468
|
-
|
|
508
|
+
|
|
469
509
|
def do_fit(self, value=0):
|
|
470
510
|
if 'experiment' in self.dataset.metadata:
|
|
471
511
|
exp = self.dataset.metadata['experiment']
|
|
472
512
|
if 'convergence_angle' not in exp:
|
|
473
|
-
|
|
513
|
+
self.parent.status_message('Aborted Quantification: need a convergence_angle in experiment of metadata dictionary')
|
|
514
|
+
return
|
|
515
|
+
|
|
474
516
|
alpha = exp['convergence_angle']
|
|
475
517
|
beta = exp['collection_angle']
|
|
476
518
|
beam_kv = exp['acceleration_voltage']
|
|
477
|
-
|
|
519
|
+
if beam_kv < 20:
|
|
520
|
+
self.parent.status_message('Aborted Quantification: no acceleration voltage')
|
|
521
|
+
return
|
|
478
522
|
else:
|
|
479
|
-
raise ValueError(
|
|
480
|
-
|
|
481
|
-
|
|
523
|
+
raise ValueError(
|
|
524
|
+
'need a experiment parameter in metadata dictionary')
|
|
525
|
+
|
|
526
|
+
self.parent.status_message('Fitting cross-sections ')
|
|
527
|
+
eff_beta = eels.effective_collection_angle(
|
|
528
|
+
self.parent.energy_scale, alpha, beta, beam_kv)
|
|
482
529
|
self.dataset.metadata['experiment']['eff_beta'] = eff_beta
|
|
483
530
|
self.low_loss = None
|
|
484
531
|
if self.core_loss_tab[13, 1].value:
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
532
|
+
if 'low_loss' in self.parent.datasets['_relationship'].keys():
|
|
533
|
+
ll_key = self.parent.datasets['_relationship']['low_loss']
|
|
534
|
+
self.low_loss = np.array(self.parent.datasets[ll_key] / \
|
|
535
|
+
self.parent.datasets[ll_key].sum())
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
edges = eels.make_cross_sections(self.edges, np.array(
|
|
539
|
+
self.parent.energy_scale), beam_kv, eff_beta, self.low_loss)
|
|
493
540
|
if self.dataset.data_type == sidpy.DataType.SPECTRAL_IMAGE:
|
|
494
541
|
spectrum = self.parent.get_spectrum()
|
|
495
542
|
else:
|
|
@@ -497,7 +544,7 @@ class CoreLoss(object):
|
|
|
497
544
|
self.edges = eels.fit_edges2(spectrum, self.parent.energy_scale, edges)
|
|
498
545
|
self.model = self.edges['model']['spectrum'].copy()
|
|
499
546
|
print('set_model', self.edges['model']['spectrum'][0], self.model[0])
|
|
500
|
-
|
|
547
|
+
|
|
501
548
|
areal_density = []
|
|
502
549
|
elements = []
|
|
503
550
|
for key in edges:
|
|
@@ -509,149 +556,167 @@ class CoreLoss(object):
|
|
|
509
556
|
for i, element in enumerate(elements):
|
|
510
557
|
out_string += f'{element}: {areal_density[i] / areal_density.sum() * 100:.1f}% '
|
|
511
558
|
|
|
512
|
-
|
|
513
|
-
|
|
514
559
|
self.update()
|
|
515
560
|
self.plot()
|
|
561
|
+
self.parent.status_message('Fitting cross-sections -- success')
|
|
516
562
|
|
|
517
563
|
def do_all_button_click(self, value=0):
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
if self.dataset.data_type.name != 'SPECTRAL_IMAGE':
|
|
522
|
-
self.do_fit()
|
|
523
|
-
return
|
|
564
|
+
if self.sidebar[13, 0].value == False:
|
|
565
|
+
return
|
|
524
566
|
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
567
|
+
if self.dataset.data_type.name != 'SPECTRAL_IMAGE':
|
|
568
|
+
self.do_fit()
|
|
569
|
+
return
|
|
570
|
+
|
|
571
|
+
if 'experiment' in self.dataset.metadata:
|
|
572
|
+
exp = self.dataset.metadata['experiment']
|
|
573
|
+
if 'convergence_angle' not in exp:
|
|
574
|
+
raise ValueError(
|
|
575
|
+
'need a convergence_angle in experiment of metadata dictionary ')
|
|
576
|
+
alpha = exp['convergence_angle']
|
|
577
|
+
beta = exp['collection_angle']
|
|
578
|
+
beam_kv = exp['acceleration_voltage']
|
|
579
|
+
else:
|
|
580
|
+
raise ValueError(
|
|
581
|
+
'need a experiment parameter in metadata dictionary')
|
|
582
|
+
|
|
583
|
+
eff_beta = eels.effective_collection_angle(
|
|
584
|
+
self.energy_scale, alpha, beta, beam_kv)
|
|
585
|
+
eff_beta = beta
|
|
586
|
+
self.low_loss = None
|
|
587
|
+
if self.sidebar[12, 1].value:
|
|
588
|
+
for key in self.datasets.keys():
|
|
589
|
+
if key != self.parent.lowloss_key:
|
|
590
|
+
if isinstance(self.datasets[key], sidpy.Dataset):
|
|
591
|
+
if 'SPECTR' in self.datasets[key].data_type.name:
|
|
592
|
+
if self.datasets[key].energy_loss[0] < 0:
|
|
593
|
+
self.low_loss = self.datasets[key] / \
|
|
594
|
+
self.datasets[key].sum()
|
|
551
595
|
|
|
552
|
-
|
|
553
|
-
|
|
596
|
+
edges = eels.make_cross_sections(self.edges, np.array(
|
|
597
|
+
self.energy_scale), beam_kv, eff_beta, self.low_loss)
|
|
598
|
+
|
|
599
|
+
view = self.parent
|
|
600
|
+
bin_x = view.bin_x
|
|
601
|
+
bin_y = view.bin_y
|
|
602
|
+
|
|
603
|
+
start_x = view.x
|
|
604
|
+
start_y = view.y
|
|
605
|
+
|
|
606
|
+
number_of_edges = 0
|
|
607
|
+
for key in self.edges:
|
|
608
|
+
if key.isdigit():
|
|
609
|
+
number_of_edges += 1
|
|
610
|
+
|
|
611
|
+
results = np.zeros([int(self.dataset.shape[0]/bin_x),
|
|
612
|
+
int(self.dataset.shape[1]/bin_y), number_of_edges])
|
|
613
|
+
total_spec = int(
|
|
614
|
+
self.dataset.shape[0]/bin_x)*int(self.dataset.shape[1]/bin_y)
|
|
615
|
+
self.sidebar[13, 1].max = total_spec
|
|
616
|
+
# self.ui.progress.setMaximum(total_spec)
|
|
617
|
+
# self.ui.progress.setValue(0)
|
|
618
|
+
ind = 0
|
|
619
|
+
for x in range(int(self.dataset.shape[0]/bin_x)):
|
|
620
|
+
for y in range(int(self.dataset.shape[1]/bin_y)):
|
|
621
|
+
ind += 1
|
|
622
|
+
self.sidebar[13, 1].value = ind
|
|
623
|
+
view.x = x*bin_x
|
|
624
|
+
view.y = y*bin_y
|
|
625
|
+
spectrum = view.get_spectrum()
|
|
626
|
+
with warnings.catch_warnings():
|
|
627
|
+
warnings.simplefilter("ignore")
|
|
628
|
+
edges = eels.fit_edges2(spectrum, self.energy_scale, edges)
|
|
629
|
+
for key, edge in edges.items():
|
|
630
|
+
if key.isdigit():
|
|
631
|
+
# element.append(edge['element'])
|
|
632
|
+
results[x, y, int(key)] = edge['areal_density']
|
|
633
|
+
edges['spectrum_image_quantification'] = results
|
|
634
|
+
self.sidebar[13, 1].value = total_spec
|
|
635
|
+
view.x = start_x
|
|
636
|
+
view.y = start_y
|
|
637
|
+
self.sidebar[13, 0].value = False
|
|
554
638
|
|
|
555
|
-
number_of_edges = 0
|
|
556
|
-
for key in self.edges:
|
|
557
|
-
if key.isdigit():
|
|
558
|
-
number_of_edges += 1
|
|
559
|
-
|
|
560
|
-
results = np.zeros([int(self.dataset.shape[0]/bin_x), int(self.dataset.shape[1]/bin_y), number_of_edges])
|
|
561
|
-
total_spec = int(self.dataset.shape[0]/bin_x)*int(self.dataset.shape[1]/bin_y)
|
|
562
|
-
self.sidebar[13,1].max = total_spec
|
|
563
|
-
#self.ui.progress.setMaximum(total_spec)
|
|
564
|
-
#self.ui.progress.setValue(0)
|
|
565
|
-
ind = 0
|
|
566
|
-
for x in range(int(self.dataset.shape[0]/bin_x)):
|
|
567
|
-
for y in range(int(self.dataset.shape[1]/bin_y)):
|
|
568
|
-
ind += 1
|
|
569
|
-
self.sidebar[13,1].value = ind
|
|
570
|
-
view.x = x*bin_x
|
|
571
|
-
view.y = y*bin_y
|
|
572
|
-
spectrum = view.get_spectrum()
|
|
573
|
-
with warnings.catch_warnings():
|
|
574
|
-
warnings.simplefilter("ignore")
|
|
575
|
-
edges = eels.fit_edges2(spectrum, self.energy_scale, edges)
|
|
576
|
-
for key, edge in edges.items():
|
|
577
|
-
if key.isdigit():
|
|
578
|
-
# element.append(edge['element'])
|
|
579
|
-
results[x, y, int(key)] = edge['areal_density']
|
|
580
|
-
edges['spectrum_image_quantification'] = results
|
|
581
|
-
self.sidebar[13,1].value = total_spec
|
|
582
|
-
view.x = start_x
|
|
583
|
-
view.y = start_y
|
|
584
|
-
self.sidebar[13,0].value = False
|
|
585
|
-
|
|
586
|
-
|
|
587
639
|
def modify_onset(self, value=-1):
|
|
588
640
|
edge_index = self.core_loss_tab[5, 0].value
|
|
589
641
|
edge = self.edges[str(edge_index)]
|
|
590
|
-
edge['onset'] = self.core_loss_tab[8,0].value
|
|
642
|
+
edge['onset'] = self.core_loss_tab[8, 0].value
|
|
591
643
|
if 'original_onset' not in edge:
|
|
592
644
|
edge['original_onset'] = edge['onset']
|
|
593
|
-
edge['chemical_shift'] = edge['onset'] -
|
|
645
|
+
edge['chemical_shift'] = edge['onset'] - edge['original_onset']
|
|
594
646
|
self.update()
|
|
595
|
-
|
|
596
|
-
|
|
647
|
+
|
|
597
648
|
def modify_start_exclude(self, value=-1):
|
|
598
649
|
edge_index = self.core_loss_tab[5, 0].value
|
|
599
650
|
edge = self.edges[str(edge_index)]
|
|
600
|
-
edge['start_exclude'] = self.core_loss_tab[9,0].value
|
|
651
|
+
edge['start_exclude'] = self.core_loss_tab[9, 0].value
|
|
601
652
|
self.plot()
|
|
602
|
-
|
|
653
|
+
|
|
603
654
|
def modify_end_exclude(self, value=-1):
|
|
604
655
|
edge_index = self.core_loss_tab[5, 0].value
|
|
605
656
|
edge = self.edges[str(edge_index)]
|
|
606
|
-
edge['end_exclude'] = self.core_loss_tab[10,0].value
|
|
657
|
+
edge['end_exclude'] = self.core_loss_tab[10, 0].value
|
|
607
658
|
self.plot()
|
|
608
|
-
|
|
659
|
+
|
|
609
660
|
def modify_areal_density(self, value=-1):
|
|
610
661
|
edge_index = self.core_loss_tab[5, 0].value
|
|
611
662
|
edge = self.edges[str(edge_index)]
|
|
612
|
-
|
|
663
|
+
|
|
613
664
|
edge['areal_density'] = self.core_loss_tab[11, 0].value
|
|
614
665
|
if self.parent.y_scale != 1.0:
|
|
615
|
-
dispersion = self.parent.energy_scale[1]-
|
|
616
|
-
|
|
666
|
+
dispersion = self.parent.energy_scale[1] - \
|
|
667
|
+
self.parent.energy_scale[0]
|
|
668
|
+
edge['areal_density'] = self.core_loss_tab[11, 0].value * \
|
|
669
|
+
self.dataset.metadata['experiment']['flux_ppm']/1e-6
|
|
617
670
|
if 'model' in self.edges:
|
|
618
671
|
self.model = self.edges['model']['background']
|
|
619
672
|
for key in self.edges:
|
|
620
673
|
if key.isdigit():
|
|
621
674
|
if 'data' in self.edges[key]:
|
|
622
|
-
self.model = self.model +
|
|
675
|
+
self.model = self.model + \
|
|
676
|
+
self.edges[key]['areal_density'] * \
|
|
677
|
+
self.edges[key]['data']
|
|
623
678
|
self.model = self.edges['model']['background']
|
|
624
679
|
for key in self.edges:
|
|
625
680
|
if key.isdigit():
|
|
626
681
|
if 'data' in self.edges[key]:
|
|
627
|
-
self.model = self.model +
|
|
682
|
+
self.model = self.model + \
|
|
683
|
+
self.edges[key]['areal_density'] * \
|
|
684
|
+
self.edges[key]['data']
|
|
628
685
|
self.plot()
|
|
629
|
-
|
|
686
|
+
|
|
630
687
|
def set_y_scale(self, value):
|
|
631
|
-
self.parent.info_tab[9, 2].value = self.core_loss_tab[13,0].value
|
|
688
|
+
self.parent.info_tab[9, 2].value = self.core_loss_tab[13, 0].value
|
|
632
689
|
self.update()
|
|
633
|
-
|
|
634
690
|
|
|
691
|
+
def set_convolution(self, value=0):
|
|
692
|
+
self.do_fit()
|
|
693
|
+
|
|
694
|
+
|
|
635
695
|
def set_cl_action(self):
|
|
636
696
|
|
|
637
|
-
self.core_loss_tab[0, 0].observe(self.
|
|
697
|
+
self.core_loss_tab[0, 0].observe(self.update_cl_dataset, names='value')
|
|
638
698
|
self.core_loss_tab[2, 0].observe(self.set_fit_start, names='value')
|
|
639
699
|
self.core_loss_tab[3, 0].observe(self.set_fit_end, names='value')
|
|
640
|
-
|
|
700
|
+
|
|
641
701
|
self.core_loss_tab[4, 0].on_click(self.find_elements)
|
|
642
702
|
self.core_loss_tab[5, 0].observe(self.update, names='value')
|
|
643
703
|
self.core_loss_tab[6, 0].observe(self.set_element, names='value')
|
|
644
704
|
|
|
645
705
|
self.core_loss_tab[8, 0].observe(self.modify_onset, names='value')
|
|
646
|
-
self.core_loss_tab[9, 0].observe(
|
|
647
|
-
|
|
648
|
-
self.core_loss_tab[
|
|
649
|
-
|
|
706
|
+
self.core_loss_tab[9, 0].observe(
|
|
707
|
+
self.modify_start_exclude, names='value')
|
|
708
|
+
self.core_loss_tab[10, 0].observe(
|
|
709
|
+
self.modify_end_exclude, names='value')
|
|
710
|
+
self.core_loss_tab[11, 0].observe(
|
|
711
|
+
self.modify_areal_density, names='value')
|
|
712
|
+
|
|
650
713
|
self.core_loss_tab[12, 0].on_click(self.do_fit)
|
|
651
714
|
self.core_loss_tab[13, 2].observe(self.plot, names='value')
|
|
652
715
|
self.core_loss_tab[1, 0].observe(self.plot, names='value')
|
|
653
|
-
self.core_loss_tab[13,0].observe(self.set_y_scale, names='value')
|
|
654
|
-
self.core_loss_tab[
|
|
716
|
+
self.core_loss_tab[13, 0].observe(self.set_y_scale, names='value')
|
|
717
|
+
self.core_loss_tab[13, 1].observe(self.set_convolution, names='value')
|
|
718
|
+
self.core_loss_tab[14, 0].observe(
|
|
719
|
+
self.do_all_button_click, names='value')
|
|
655
720
|
|
|
656
721
|
self.elements_cancel_button.on_click(self.set_figure_pane)
|
|
657
722
|
self.elements_auto_button.on_click(self.auto_id)
|