pyTEMlib 0.2024.2.2__py2.py3-none-any.whl → 0.2024.6.0__py2.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/core_loss_widget.py +658 -0
- pyTEMlib/eels_dialog.py +13 -12
- pyTEMlib/eels_dialog_utilities.py +2 -3
- pyTEMlib/eels_tools.py +56 -71
- pyTEMlib/file_tools.py +7 -1
- pyTEMlib/image_tools.py +95 -23
- pyTEMlib/info_widget.py +301 -365
- pyTEMlib/low_loss_widget.py +176 -0
- pyTEMlib/version.py +2 -2
- {pyTEMlib-0.2024.2.2.dist-info → pyTEMlib-0.2024.6.0.dist-info}/METADATA +4 -4
- {pyTEMlib-0.2024.2.2.dist-info → pyTEMlib-0.2024.6.0.dist-info}/RECORD +15 -13
- {pyTEMlib-0.2024.2.2.dist-info → pyTEMlib-0.2024.6.0.dist-info}/WHEEL +1 -1
- {pyTEMlib-0.2024.2.2.dist-info → pyTEMlib-0.2024.6.0.dist-info}/LICENSE +0 -0
- {pyTEMlib-0.2024.2.2.dist-info → pyTEMlib-0.2024.6.0.dist-info}/entry_points.txt +0 -0
- {pyTEMlib-0.2024.2.2.dist-info → pyTEMlib-0.2024.6.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
import os
|
|
5
|
+
import ipywidgets
|
|
6
|
+
import matplotlib.pylab as plt
|
|
7
|
+
import matplotlib
|
|
8
|
+
from IPython.display import display
|
|
9
|
+
|
|
10
|
+
import sidpy
|
|
11
|
+
# from pyTEMlib.microscope import microscope
|
|
12
|
+
from pyTEMlib import file_tools
|
|
13
|
+
from pyTEMlib import eels_tools
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def get_low_loss_sidebar() -> Any:
|
|
17
|
+
side_bar = ipywidgets.GridspecLayout(9, 3, width='auto', grid_gap="0px")
|
|
18
|
+
|
|
19
|
+
side_bar[0, :2] = ipywidgets.Dropdown(
|
|
20
|
+
options=[('None', 0)],
|
|
21
|
+
value=0,
|
|
22
|
+
description='Main Dataset:',
|
|
23
|
+
disabled=False)
|
|
24
|
+
|
|
25
|
+
row = 1
|
|
26
|
+
|
|
27
|
+
side_bar[row, :3] = ipywidgets.Button(description='Resolution Function',
|
|
28
|
+
layout=ipywidgets.Layout(width='auto', grid_area='header'),
|
|
29
|
+
style=ipywidgets.ButtonStyle(button_color='lightblue'))
|
|
30
|
+
row += 1
|
|
31
|
+
side_bar[row, :2] = ipywidgets.FloatText(value=7.5, description='fit width:', disabled=False, color='black',
|
|
32
|
+
layout=ipywidgets.Layout(width='200px'))
|
|
33
|
+
side_bar[row, 2] = ipywidgets.widgets.Label(value="eV", layout=ipywidgets.Layout(width='100px'))
|
|
34
|
+
row +=1
|
|
35
|
+
side_bar[row, 0] = ipywidgets.widgets.Label(value="thickness", layout=ipywidgets.Layout(width='100px'))
|
|
36
|
+
side_bar[row, 1] = ipywidgets.widgets.Label(value="", layout=ipywidgets.Layout(width='100px'))
|
|
37
|
+
side_bar[row, 2] = ipywidgets.widgets.Label(value="* iMFP", layout=ipywidgets.Layout(width='100px'))
|
|
38
|
+
row +=1
|
|
39
|
+
side_bar[row, 0] = ipywidgets.ToggleButton(description='Plot Res.Fct.',
|
|
40
|
+
disabled=False,
|
|
41
|
+
button_style='', # 'success', 'info', 'warning', 'danger' or ''
|
|
42
|
+
tooltip='Plots resolution function on right',
|
|
43
|
+
layout=ipywidgets.Layout(width='100px'))
|
|
44
|
+
|
|
45
|
+
side_bar[row, 2] = ipywidgets.ToggleButton(description='Probability',
|
|
46
|
+
disabled=False,
|
|
47
|
+
button_style='', # 'success', 'info', 'warning', 'danger' or ''
|
|
48
|
+
tooltip='Changes y-axis to probability if flux is given',
|
|
49
|
+
layout=ipywidgets.Layout(width='100px'))
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
row += 1
|
|
53
|
+
side_bar[row, :3] = ipywidgets.Button(description='Drude',
|
|
54
|
+
layout=ipywidgets.Layout(width='auto', grid_area='header'),
|
|
55
|
+
style=ipywidgets.ButtonStyle(button_color='lightblue'))
|
|
56
|
+
row += 1
|
|
57
|
+
side_bar[row, :2] = ipywidgets.FloatText(value=0.1, description='Start Fit:', disabled=False, color='black',
|
|
58
|
+
layout=ipywidgets.Layout(width='200px'))
|
|
59
|
+
side_bar[row, 2] = ipywidgets.widgets.Label(value="eV", layout=ipywidgets.Layout(width='100px'))
|
|
60
|
+
row += 1
|
|
61
|
+
side_bar[row, :2] = ipywidgets.FloatText(value=7.5, description='End Fit:', disabled=False, color='black',
|
|
62
|
+
layout=ipywidgets.Layout(width='200px'))
|
|
63
|
+
side_bar[row, 2] = ipywidgets.widgets.Label(value="eV", layout=ipywidgets.Layout(width='50px'))
|
|
64
|
+
row +=1
|
|
65
|
+
side_bar[row, 0] = ipywidgets.ToggleButton(description='Plot Drude',
|
|
66
|
+
disabled=False,
|
|
67
|
+
button_style='', # 'success', 'info', 'warning', 'danger' or ''
|
|
68
|
+
tooltip='Plots resolution function on right',
|
|
69
|
+
layout=ipywidgets.Layout(width='100px'))
|
|
70
|
+
|
|
71
|
+
side_bar[row, 2] = ipywidgets.ToggleButton(description='Plot Diel.Fct.',
|
|
72
|
+
disabled=False,
|
|
73
|
+
button_style='', # 'success', 'info', 'warning', 'danger' or ''
|
|
74
|
+
tooltip='Changes y-axis to probability if flux is given',
|
|
75
|
+
layout=ipywidgets.Layout(width='100px'))
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
return side_bar
|
|
79
|
+
|
|
80
|
+
class LowLoss(object):
|
|
81
|
+
def __init__(self, sidebar=None, parent=None):
|
|
82
|
+
self.parent = parent
|
|
83
|
+
self.dataset = parent.dataset
|
|
84
|
+
self.low_loss_tab = sidebar
|
|
85
|
+
self.set_ll_action()
|
|
86
|
+
self.update_ll_sidebar()
|
|
87
|
+
|
|
88
|
+
def update_ll_sidebar(self):
|
|
89
|
+
spectrum_list = ['None']
|
|
90
|
+
for index, key in enumerate(self.parent.datasets.keys()):
|
|
91
|
+
if isinstance(self.parent.datasets[key], sidpy.Dataset):
|
|
92
|
+
if 'SPECTR' in self.parent.datasets[key].data_type.name:
|
|
93
|
+
energy_offset = self.parent.datasets[key].get_spectral_dims(return_axis=True)[0][0]
|
|
94
|
+
if energy_offset < 0:
|
|
95
|
+
spectrum_list.append(f'{key}: {self.parent.datasets[key].title}')
|
|
96
|
+
|
|
97
|
+
self.low_loss_tab[0, 0].options = spectrum_list
|
|
98
|
+
|
|
99
|
+
def get_resolution_function(self, value):
|
|
100
|
+
self.low_loss_tab[4, 0].value = False
|
|
101
|
+
zero_loss_fit_width=self.low_loss_tab[2, 0].value
|
|
102
|
+
self.parent.datasets['resolution_functions'] = eels_tools.get_resolution_functions(self.parent.dataset,
|
|
103
|
+
startFitEnergy=-zero_loss_fit_width,
|
|
104
|
+
endFitEnergy=zero_loss_fit_width)
|
|
105
|
+
if 'low_loss' not in self.dataset.metadata:
|
|
106
|
+
self.dataset.metadata['zero_loss'] = {}
|
|
107
|
+
self.dataset.metadata['zero_loss'].update(self.parent.datasets['resolution_functions'].metadata['zero_loss'])
|
|
108
|
+
self.low_loss_tab[4, 0].value = True
|
|
109
|
+
self.low_loss_tab[3, 1].value = f"{np.log(self.parent.dataset.sum()/self.parent.datasets['resolution_functions'].sum())}"
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def set_ll_action(self):
|
|
114
|
+
self.low_loss_tab[0, 0].observe(self.update_ll_dataset)
|
|
115
|
+
#self.low_loss_tab[1, 0].on_click(self.fix_energy_scale)
|
|
116
|
+
#self.low_loss_tab[2, 0].observe(self.set_energy_scale, names='value')
|
|
117
|
+
#self.low_loss_tab[3, 0].observe(self.set_energy_scale, names='value')
|
|
118
|
+
self.low_loss_tab[1, 0].on_click(self.get_resolution_function)
|
|
119
|
+
self.low_loss_tab[4, 2].observe(self.parent.info.set_y_scale, names='value')
|
|
120
|
+
self.low_loss_tab[4, 0].observe(self._update, names='value')
|
|
121
|
+
|
|
122
|
+
def _update(self, ev=0):
|
|
123
|
+
self.parent._update(ev)
|
|
124
|
+
|
|
125
|
+
if self.low_loss_tab[4, 0].value:
|
|
126
|
+
if 'resolution_functions' in self.parent.datasets:
|
|
127
|
+
resolution_function = self.get_additional_spectrum('resolution_functions')
|
|
128
|
+
self.parent.axis.plot(self.parent.energy_scale, resolution_function, label='resolution_function')
|
|
129
|
+
self.parent.axis.plot(self.parent.energy_scale,
|
|
130
|
+
self.parent.spectrum -resolution_function, label='difference')
|
|
131
|
+
|
|
132
|
+
self.parent.axis.legend()
|
|
133
|
+
|
|
134
|
+
def get_additional_spectrum(self, key):
|
|
135
|
+
if key not in self.parent.datasets.keys():
|
|
136
|
+
return
|
|
137
|
+
|
|
138
|
+
if self.parent.datasets[key].data_type == sidpy.DataType.SPECTRUM:
|
|
139
|
+
self.spectrum = self.parent.datasets[key].copy()
|
|
140
|
+
else:
|
|
141
|
+
image_dims = self.parent.datasets[key].get_dimensions_by_type(sidpy.DimensionType.SPATIAL)
|
|
142
|
+
selection = []
|
|
143
|
+
for dim, axis in self.parent.datasets[key]._axes.items():
|
|
144
|
+
# print(dim, axis.dimension_type)
|
|
145
|
+
if axis.dimension_type == sidpy.DimensionType.SPATIAL:
|
|
146
|
+
if dim == image_dims[0]:
|
|
147
|
+
selection.append(slice(self.x, self.x + self.bin_x))
|
|
148
|
+
else:
|
|
149
|
+
selection.append(slice(self.y, self.y + self.bin_y))
|
|
150
|
+
|
|
151
|
+
elif axis.dimension_type == sidpy.DimensionType.SPECTRAL:
|
|
152
|
+
selection.append(slice(None))
|
|
153
|
+
elif axis.dimension_type == sidpy.DimensionType.CHANNEL:
|
|
154
|
+
selection.append(slice(None))
|
|
155
|
+
else:
|
|
156
|
+
selection.append(slice(0, 1))
|
|
157
|
+
|
|
158
|
+
self.spectrum = self.parent.datasets[key][tuple(selection)].mean(axis=tuple(image_dims))
|
|
159
|
+
|
|
160
|
+
self.spectrum *= self.parent.y_scale
|
|
161
|
+
|
|
162
|
+
return self.spectrum.squeeze()
|
|
163
|
+
|
|
164
|
+
def update_ll_dataset(self, value=0):
|
|
165
|
+
self.ll_key = self.low_loss_tab[0, 0].value.split(':')[0]
|
|
166
|
+
self.parent.set_dataset(self.ll_key)
|
|
167
|
+
self.dataset = self.parent.dataset
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def set_binning(self, value):
|
|
171
|
+
if 'SPECTRAL' in self.dataset.data_type.name:
|
|
172
|
+
bin_x = self.info_tab[15, 0].value
|
|
173
|
+
bin_y = self.info_tab[16, 0].value
|
|
174
|
+
self.dataset.view.set_bin([bin_x, bin_y])
|
|
175
|
+
self.datasets[self.key].metadata['experiment']['SI_bin_x'] = bin_x
|
|
176
|
+
self.datasets[self.key].metadata['experiment']['SI_bin_y'] = bin_y
|
pyTEMlib/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyTEMlib
|
|
3
|
-
Version: 0.2024.
|
|
3
|
+
Version: 0.2024.6.0
|
|
4
4
|
Summary: pyTEM: TEM Data Quantification library through a model-based approach
|
|
5
5
|
Home-page: https://pycroscopy.github.io/pyTEMlib/about.html
|
|
6
6
|
Author: Gerd Duscher
|
|
@@ -38,9 +38,9 @@ Requires-Dist: ipympl
|
|
|
38
38
|
Requires-Dist: spglib
|
|
39
39
|
Requires-Dist: scikit-image
|
|
40
40
|
Requires-Dist: scikit-learn
|
|
41
|
-
Requires-Dist: pyNSID
|
|
42
|
-
Requires-Dist: sidpy
|
|
43
|
-
Requires-Dist: SciFiReaders
|
|
41
|
+
Requires-Dist: pyNSID>=0.0.7
|
|
42
|
+
Requires-Dist: sidpy>=0.12.1
|
|
43
|
+
Requires-Dist: SciFiReaders>=0.0.8
|
|
44
44
|
|
|
45
45
|
pyTEMlib
|
|
46
46
|
========
|
|
@@ -2,34 +2,36 @@ pyTEMlib/__init__.py,sha256=nEN93amIEoZxO7rJgN71ABeCoXrnmaywBbE97l5lPio,178
|
|
|
2
2
|
pyTEMlib/animation.py,sha256=oPxbTuy8LfdH2mOOgm9Q40ArFAJmXM_58UV97ptcNAY,25187
|
|
3
3
|
pyTEMlib/atom_tools.py,sha256=ViO4ZZZoCZ_Cp2KijiqKKOiQhGOWnye45T0rsiPhf4I,7314
|
|
4
4
|
pyTEMlib/config_dir.py,sha256=4evlo9P2Yht-AnqaLI-WweLjDQcislbAP3I7P7EZsPU,2085
|
|
5
|
+
pyTEMlib/core_loss_widget.py,sha256=BPGGNcYkdiX3pIfe600ERVAJjUHw5C2BA7idroP1pgU,29746
|
|
5
6
|
pyTEMlib/crystal_tools.py,sha256=g4OXyvd5NLw7vaXhjDP3P6VZpVV6eiyuPn8MdgR2amI,61652
|
|
6
7
|
pyTEMlib/diffraction_plot.py,sha256=pM5d3bdBGa8LlPZ5lw8sLT94mlYTXELxPLv-jUP2FWY,27959
|
|
7
8
|
pyTEMlib/dynamic_scattering.py,sha256=O9MxnxfndWJ2VhQRjksKNQ4yY7y-gN_hitRQ4Qox4ns,9472
|
|
8
9
|
pyTEMlib/eds_tools.py,sha256=34YYoix9rhq0aYnZrHVi0A8gQeu9XZ9fGGT0VxPQo8Y,24882
|
|
9
|
-
pyTEMlib/eels_dialog.py,sha256=
|
|
10
|
-
pyTEMlib/eels_dialog_utilities.py,sha256=
|
|
11
|
-
pyTEMlib/eels_tools.py,sha256=
|
|
12
|
-
pyTEMlib/file_tools.py,sha256=
|
|
10
|
+
pyTEMlib/eels_dialog.py,sha256=oWLivCQ96Fq0tj52wbfs-5qKccUSWk2k1iP2TVneXZA,32379
|
|
11
|
+
pyTEMlib/eels_dialog_utilities.py,sha256=73W9jFbPx-eeLEiSaBptTgGLr40bIYYfSyzLnZbhfvo,51761
|
|
12
|
+
pyTEMlib/eels_tools.py,sha256=O22WENQ04fCfVvI4ktJdx6GfE8ZSNb-E6dAu4ZbfHqw,76041
|
|
13
|
+
pyTEMlib/file_tools.py,sha256=UScJenVk73MZUW-laoKymnO27eCUC0vlRxxlQ4Kq2Hg,46923
|
|
13
14
|
pyTEMlib/file_tools_qt.py,sha256=tLZACS4JyGH_AOzNR_SGAhjA01y4VJB261opPhGMlm8,7223
|
|
14
15
|
pyTEMlib/graph_tools.py,sha256=iu0Y2hIPU6CkQHQEh-dI1vKnUHnSNXx4-CXs2M-1Sr8,44097
|
|
15
16
|
pyTEMlib/graph_viz.py,sha256=m5PwSn6l2r0bsaLWBDSHc9IGR3_PneG2BrZgnEdi07I,13644
|
|
16
17
|
pyTEMlib/image_dialog.py,sha256=F-ZgKq7UnMtPPd1b9eqb7t8MXDfWN-8hVKwB2Il0x28,6235
|
|
17
18
|
pyTEMlib/image_dlg.py,sha256=n5gradDiYOFGEQ3k_Wlk9RUYYzl4bl_hKLzNVcYteNE,5694
|
|
18
|
-
pyTEMlib/image_tools.py,sha256=
|
|
19
|
-
pyTEMlib/info_widget.py,sha256=
|
|
19
|
+
pyTEMlib/image_tools.py,sha256=PU13i2KgKVoAf_NyCRdCGTfb6c42UZqprmgJ9zthMCw,48970
|
|
20
|
+
pyTEMlib/info_widget.py,sha256=wd1F6UDcLMsWEg1DHHVPa1P7_MRGv8iLOUjRsYkZOQY,46453
|
|
20
21
|
pyTEMlib/interactive_image.py,sha256=5PwypcA1OjLAD-fi8bmWWFHuOjdIPVY9Dh59V24WuDA,34
|
|
21
22
|
pyTEMlib/kinematic_scattering.py,sha256=CUdJnclkok7d8qm_jDUF92MVHrmaTeMkKdvxxB6AqvA,43309
|
|
23
|
+
pyTEMlib/low_loss_widget.py,sha256=nSU6-pu7gP8ch61w2wpImNNIuo_3bBN1HAB3UVlEJoQ,9043
|
|
22
24
|
pyTEMlib/microscope.py,sha256=iigUF1UImHEfmL2wqEBBj3aNRgEYouDbIln8VCo4_KM,1545
|
|
23
25
|
pyTEMlib/peak_dialog.py,sha256=-HhgmoscfJMme9N495hDzfniYwuhn7iBzsDwZOOhTd4,48260
|
|
24
26
|
pyTEMlib/peak_dlg.py,sha256=qcjcnhwpGa4jBCeXzwQz9sCyX-tHsLLQ67ToqfKOiQY,11550
|
|
25
27
|
pyTEMlib/probe_tools.py,sha256=8tPQuANClLsGAKnZo6Vo4gNIGKfyDR6WUMO3dXcm_4k,27177
|
|
26
28
|
pyTEMlib/sidpy_tools.py,sha256=0oIx-qMtEmcZmLazQKW19dd-KoxyY3B15aIeMcyHA8E,4878
|
|
27
29
|
pyTEMlib/simulation_tools.py,sha256=RmegD5TpQMU68uASvzZWVplAqs7bM5KkF6bWDWLjyc0,2799
|
|
28
|
-
pyTEMlib/version.py,sha256=
|
|
30
|
+
pyTEMlib/version.py,sha256=eTxYL1VM1SZB6XwKQ7HgZ3bzXDIpG0PDiLYHW8AqAyw,94
|
|
29
31
|
pyTEMlib/xrpa_x_sections.py,sha256=peb2pozcH0T-3zlWITx-5rdyeoP2YhOfBpwsWD1-4T4,1813751
|
|
30
|
-
pyTEMlib-0.2024.
|
|
31
|
-
pyTEMlib-0.2024.
|
|
32
|
-
pyTEMlib-0.2024.
|
|
33
|
-
pyTEMlib-0.2024.
|
|
34
|
-
pyTEMlib-0.2024.
|
|
35
|
-
pyTEMlib-0.2024.
|
|
32
|
+
pyTEMlib-0.2024.6.0.dist-info/LICENSE,sha256=7HdBF6SXIBd38bHOKkQd4DYR1KV-OYm9mwB16fM-984,1062
|
|
33
|
+
pyTEMlib-0.2024.6.0.dist-info/METADATA,sha256=5wU66BPQnYNIQK_7KmkB3N_dDgzahaDzk9L41GaB6CM,3303
|
|
34
|
+
pyTEMlib-0.2024.6.0.dist-info/WHEEL,sha256=fS9sRbCBHs7VFcwJLnLXN1MZRR0_TVTxvXKzOnaSFs8,110
|
|
35
|
+
pyTEMlib-0.2024.6.0.dist-info/entry_points.txt,sha256=qiIFPP3ffSz-gxj-TowzbA0Setq5Lo0RJTVtSrqD1IY,44
|
|
36
|
+
pyTEMlib-0.2024.6.0.dist-info/top_level.txt,sha256=rPLVH0UJxrPSPgSoKScTjL1K_X69JFzsYYnDnYTYIlU,9
|
|
37
|
+
pyTEMlib-0.2024.6.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|