empix 0.0.1__py3-none-any.whl → 0.0.3__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.
- empix/__init__.py +115 -137
- empix/version.py +2 -2
- {empix-0.0.1.dist-info → empix-0.0.3.dist-info}/METADATA +11 -11
- empix-0.0.3.dist-info/RECORD +7 -0
- {empix-0.0.1.dist-info → empix-0.0.3.dist-info}/WHEEL +1 -1
- empix-0.0.1.dist-info/RECORD +0 -7
- {empix-0.0.1.dist-info → empix-0.0.3.dist-info}/LICENSE +0 -0
- {empix-0.0.1.dist-info → empix-0.0.3.dist-info}/top_level.txt +0 -0
empix/__init__.py
CHANGED
|
@@ -23,15 +23,13 @@ microscopy data that are not available in `hyperspy
|
|
|
23
23
|
## Load libraries/packages/modules ##
|
|
24
24
|
#####################################
|
|
25
25
|
|
|
26
|
-
# For accessing attributes of functions.
|
|
27
|
-
import inspect
|
|
28
|
-
|
|
29
|
-
# For randomly selecting items in dictionaries.
|
|
30
|
-
import random
|
|
31
|
-
|
|
32
26
|
# For performing deep copies.
|
|
33
27
|
import copy
|
|
34
28
|
|
|
29
|
+
# For checking whether certain submodules exists and for importing said
|
|
30
|
+
# submodules should they exist.
|
|
31
|
+
import importlib
|
|
32
|
+
|
|
35
33
|
|
|
36
34
|
|
|
37
35
|
# For general array handling.
|
|
@@ -53,8 +51,10 @@ import hyperspy.signals
|
|
|
53
51
|
import hyperspy.axes
|
|
54
52
|
|
|
55
53
|
# For azimuthally integrating 2D hyperspy signals.
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
detectors = importlib.import_module("pyFAI.detectors")
|
|
55
|
+
integrators = (importlib.import_module("pyFAI.integrator.azimuthal")
|
|
56
|
+
if importlib.util.find_spec("pyFAI.integrator")
|
|
57
|
+
else importlib.import_module("pyFAI.azimuthalIntegrator"))
|
|
58
58
|
|
|
59
59
|
# For downsampling hyperspy signals.
|
|
60
60
|
import skimage.measure
|
|
@@ -62,7 +62,7 @@ import skimage.measure
|
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
# Get version of current package.
|
|
65
|
-
from
|
|
65
|
+
from empix.version import __version__
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
|
|
@@ -92,9 +92,7 @@ __all__ = ["abs_sq",
|
|
|
92
92
|
|
|
93
93
|
|
|
94
94
|
def _check_and_convert_action_to_apply_to_input_signal(params):
|
|
95
|
-
|
|
96
|
-
char_idx = 19
|
|
97
|
-
obj_name = current_func_name[char_idx:]
|
|
95
|
+
obj_name = "action_to_apply_to_input_signal"
|
|
98
96
|
action_to_apply_to_input_signal = params[obj_name]
|
|
99
97
|
|
|
100
98
|
return action_to_apply_to_input_signal
|
|
@@ -102,9 +100,7 @@ def _check_and_convert_action_to_apply_to_input_signal(params):
|
|
|
102
100
|
|
|
103
101
|
|
|
104
102
|
def _check_and_convert_input_signal(params):
|
|
105
|
-
|
|
106
|
-
char_idx = 19
|
|
107
|
-
obj_name = current_func_name[char_idx:]
|
|
103
|
+
obj_name = "input_signal"
|
|
108
104
|
input_signal = params[obj_name]
|
|
109
105
|
|
|
110
106
|
action_to_apply_to_input_signal = params["action_to_apply_to_input_signal"]
|
|
@@ -131,9 +127,7 @@ def _check_and_convert_input_signal(params):
|
|
|
131
127
|
|
|
132
128
|
|
|
133
129
|
def _check_and_convert_title(params):
|
|
134
|
-
|
|
135
|
-
char_idx = 19
|
|
136
|
-
obj_name = current_func_name[char_idx:]
|
|
130
|
+
obj_name = "title"
|
|
137
131
|
obj = params[obj_name]
|
|
138
132
|
|
|
139
133
|
accepted_types = (str, type(None))
|
|
@@ -184,7 +178,7 @@ def _generate_title(input_signal, action_to_apply_to_input_signal):
|
|
|
184
178
|
|
|
185
179
|
|
|
186
180
|
def _pre_serialize_title(title):
|
|
187
|
-
obj_to_pre_serialize =
|
|
181
|
+
obj_to_pre_serialize = title
|
|
188
182
|
serializable_rep = obj_to_pre_serialize
|
|
189
183
|
|
|
190
184
|
return serializable_rep
|
|
@@ -227,17 +221,16 @@ def abs_sq(input_signal, title=_default_title):
|
|
|
227
221
|
|
|
228
222
|
"""
|
|
229
223
|
params = locals()
|
|
230
|
-
params["action_to_apply_to_input_signal"] =
|
|
224
|
+
params["action_to_apply_to_input_signal"] = "abs_sq"
|
|
225
|
+
global_symbol_table = globals()
|
|
231
226
|
for param_name in params:
|
|
232
227
|
func_name = "_check_and_convert_" + param_name
|
|
233
|
-
func_alias =
|
|
228
|
+
func_alias = global_symbol_table[func_name]
|
|
234
229
|
params[param_name] = func_alias(params)
|
|
235
230
|
|
|
236
|
-
func_name = "_" + inspect.stack()[0][3]
|
|
237
|
-
func_alias = globals()[func_name]
|
|
238
231
|
kwargs = params
|
|
239
232
|
del kwargs["action_to_apply_to_input_signal"]
|
|
240
|
-
output_signal =
|
|
233
|
+
output_signal = _abs_sq(**kwargs)
|
|
241
234
|
|
|
242
235
|
return output_signal
|
|
243
236
|
|
|
@@ -257,9 +250,7 @@ def _abs_sq(input_signal, title):
|
|
|
257
250
|
|
|
258
251
|
|
|
259
252
|
def _check_and_convert_center(params):
|
|
260
|
-
|
|
261
|
-
char_idx = 19
|
|
262
|
-
obj_name = current_func_name[char_idx:]
|
|
253
|
+
obj_name = "center"
|
|
263
254
|
obj = params[obj_name]
|
|
264
255
|
|
|
265
256
|
param_name = "action_to_apply_to_input_signal"
|
|
@@ -267,6 +258,8 @@ def _check_and_convert_center(params):
|
|
|
267
258
|
|
|
268
259
|
param_name = "input_signal"
|
|
269
260
|
input_signal = params.get(param_name, None)
|
|
261
|
+
|
|
262
|
+
current_func_name = "_check_and_convert_center"
|
|
270
263
|
|
|
271
264
|
if obj is not None:
|
|
272
265
|
try:
|
|
@@ -331,7 +324,7 @@ def _calc_h_and_v_ranges(signal):
|
|
|
331
324
|
|
|
332
325
|
|
|
333
326
|
def _pre_serialize_center(center):
|
|
334
|
-
obj_to_pre_serialize =
|
|
327
|
+
obj_to_pre_serialize = center
|
|
335
328
|
serializable_rep = obj_to_pre_serialize
|
|
336
329
|
|
|
337
330
|
return serializable_rep
|
|
@@ -346,13 +339,13 @@ def _de_pre_serialize_center(serializable_rep):
|
|
|
346
339
|
|
|
347
340
|
|
|
348
341
|
def _check_and_convert_radial_range(params):
|
|
349
|
-
|
|
350
|
-
char_idx = 19
|
|
351
|
-
obj_name = current_func_name[char_idx:]
|
|
342
|
+
obj_name = "radial_range"
|
|
352
343
|
obj = params[obj_name]
|
|
353
344
|
|
|
354
345
|
param_name = "input_signal"
|
|
355
346
|
input_signal = params.get(param_name, None)
|
|
347
|
+
|
|
348
|
+
current_func_name = "_check_and_convert_radial_range"
|
|
356
349
|
|
|
357
350
|
if obj is not None:
|
|
358
351
|
try:
|
|
@@ -381,7 +374,7 @@ def _check_and_convert_radial_range(params):
|
|
|
381
374
|
|
|
382
375
|
|
|
383
376
|
def _pre_serialize_radial_range(radial_range):
|
|
384
|
-
obj_to_pre_serialize =
|
|
377
|
+
obj_to_pre_serialize = radial_range
|
|
385
378
|
serializable_rep = obj_to_pre_serialize
|
|
386
379
|
|
|
387
380
|
return serializable_rep
|
|
@@ -396,13 +389,13 @@ def _de_pre_serialize_radial_range(serializable_rep):
|
|
|
396
389
|
|
|
397
390
|
|
|
398
391
|
def _check_and_convert_num_bins(params):
|
|
399
|
-
|
|
400
|
-
char_idx = 19
|
|
401
|
-
obj_name = current_func_name[char_idx:]
|
|
392
|
+
obj_name = "num_bins"
|
|
402
393
|
obj = params[obj_name]
|
|
403
394
|
|
|
404
395
|
param_name = "input_signal"
|
|
405
396
|
input_signal = params.get(param_name, None)
|
|
397
|
+
|
|
398
|
+
current_func_name = "_check_and_convert_num_bins"
|
|
406
399
|
|
|
407
400
|
if obj is not None:
|
|
408
401
|
try:
|
|
@@ -433,7 +426,7 @@ def _signal_is_1d(signal):
|
|
|
433
426
|
|
|
434
427
|
|
|
435
428
|
def _pre_serialize_num_bins(num_bins):
|
|
436
|
-
obj_to_pre_serialize =
|
|
429
|
+
obj_to_pre_serialize = num_bins
|
|
437
430
|
serializable_rep = obj_to_pre_serialize
|
|
438
431
|
|
|
439
432
|
return serializable_rep
|
|
@@ -614,9 +607,7 @@ class OptionalAzimuthalAveragingParams(_cls_alias):
|
|
|
614
607
|
|
|
615
608
|
|
|
616
609
|
def _check_and_convert_optional_params(params):
|
|
617
|
-
|
|
618
|
-
char_idx = 19
|
|
619
|
-
obj_name = current_func_name[char_idx:]
|
|
610
|
+
obj_name = "optional_params"
|
|
620
611
|
obj = params[obj_name]
|
|
621
612
|
|
|
622
613
|
param_name = "action_to_apply_to_input_signal"
|
|
@@ -647,10 +638,11 @@ def _check_and_convert_optional_params(params):
|
|
|
647
638
|
{"input_signal": _check_and_convert_input_signal(params),
|
|
648
639
|
"action_to_apply_to_input_signal": action_to_apply_to_input_signal,
|
|
649
640
|
**optional_params_core_attrs}
|
|
650
|
-
|
|
641
|
+
|
|
642
|
+
global_symbol_table = globals()
|
|
651
643
|
for param_name in optional_params_core_attrs:
|
|
652
644
|
func_name = "_check_and_convert_" + param_name
|
|
653
|
-
func_alias =
|
|
645
|
+
func_alias = global_symbol_table[func_name]
|
|
654
646
|
optional_params_core_attrs[param_name] = func_alias(params)
|
|
655
647
|
|
|
656
648
|
kwargs = {"skip_validation_and_conversion": True,
|
|
@@ -711,17 +703,16 @@ def azimuthally_average(input_signal, optional_params=_default_optional_params):
|
|
|
711
703
|
|
|
712
704
|
"""
|
|
713
705
|
params = locals()
|
|
714
|
-
params["action_to_apply_to_input_signal"] =
|
|
706
|
+
params["action_to_apply_to_input_signal"] = "azimuthally_average"
|
|
707
|
+
global_symbol_table = globals()
|
|
715
708
|
for param_name in params:
|
|
716
709
|
func_name = "_check_and_convert_" + param_name
|
|
717
|
-
func_alias =
|
|
710
|
+
func_alias = global_symbol_table[func_name]
|
|
718
711
|
params[param_name] = func_alias(params)
|
|
719
712
|
|
|
720
|
-
func_name = "_" + inspect.stack()[0][3]
|
|
721
|
-
func_alias = globals()[func_name]
|
|
722
713
|
kwargs = params
|
|
723
714
|
del kwargs["action_to_apply_to_input_signal"]
|
|
724
|
-
output_signal =
|
|
715
|
+
output_signal = _azimuthally_average(**kwargs)
|
|
725
716
|
|
|
726
717
|
return output_signal
|
|
727
718
|
|
|
@@ -779,7 +770,11 @@ def _construct_azimuthal_integrator(signal, center):
|
|
|
779
770
|
v_pixel_size = abs(v_scale)
|
|
780
771
|
L = 10000 * max(v_pixel_size, h_pixel_size)
|
|
781
772
|
|
|
782
|
-
|
|
773
|
+
# ``integrators`` is an alias to a pyFAI submodule that was imported near
|
|
774
|
+
# the top of the current file using the ``importlib.import_module``
|
|
775
|
+
# function.
|
|
776
|
+
AzimuthalIntegrator = integrators.AzimuthalIntegrator
|
|
777
|
+
|
|
783
778
|
kwargs = {"dist": L,
|
|
784
779
|
"poni1": poni_1,
|
|
785
780
|
"poni2": poni_2,
|
|
@@ -794,8 +789,12 @@ def _construct_pyfai_detector(signal):
|
|
|
794
789
|
h_pixel_size = abs(signal.axes_manager[-2].scale)
|
|
795
790
|
v_pixel_size = abs(signal.axes_manager[-1].scale)
|
|
796
791
|
|
|
792
|
+
# ``detectors`` is an alias to a pyFAI submodule that was imported near the
|
|
793
|
+
# top of the current file using the ``importlib.import_module`` function.
|
|
794
|
+
Detector = detectors.Detector
|
|
795
|
+
|
|
797
796
|
kwargs = {"pixel1": v_pixel_size, "pixel2": h_pixel_size}
|
|
798
|
-
detector =
|
|
797
|
+
detector = Detector(**kwargs)
|
|
799
798
|
|
|
800
799
|
return detector
|
|
801
800
|
|
|
@@ -1305,17 +1304,16 @@ def azimuthally_integrate(input_signal,
|
|
|
1305
1304
|
|
|
1306
1305
|
"""
|
|
1307
1306
|
params = locals()
|
|
1308
|
-
params["action_to_apply_to_input_signal"] =
|
|
1307
|
+
params["action_to_apply_to_input_signal"] = "azimuthally_integrate"
|
|
1308
|
+
global_symbol_table = globals()
|
|
1309
1309
|
for param_name in params:
|
|
1310
1310
|
func_name = "_check_and_convert_" + param_name
|
|
1311
|
-
func_alias =
|
|
1311
|
+
func_alias = global_symbol_table[func_name]
|
|
1312
1312
|
params[param_name] = func_alias(params)
|
|
1313
1313
|
|
|
1314
|
-
func_name = "_" + inspect.stack()[0][3]
|
|
1315
|
-
func_alias = globals()[func_name]
|
|
1316
1314
|
kwargs = params
|
|
1317
1315
|
del kwargs["action_to_apply_to_input_signal"]
|
|
1318
|
-
output_signal =
|
|
1316
|
+
output_signal = _azimuthally_integrate(**kwargs)
|
|
1319
1317
|
|
|
1320
1318
|
return output_signal
|
|
1321
1319
|
|
|
@@ -1548,17 +1546,16 @@ def annularly_average(input_signal, optional_params=_default_optional_params):
|
|
|
1548
1546
|
|
|
1549
1547
|
"""
|
|
1550
1548
|
params = locals()
|
|
1551
|
-
params["action_to_apply_to_input_signal"] =
|
|
1549
|
+
params["action_to_apply_to_input_signal"] = "annularly_average"
|
|
1550
|
+
global_symbol_table = globals()
|
|
1552
1551
|
for param_name in params:
|
|
1553
1552
|
func_name = "_check_and_convert_" + param_name
|
|
1554
|
-
func_alias =
|
|
1553
|
+
func_alias = global_symbol_table[func_name]
|
|
1555
1554
|
params[param_name] = func_alias(params)
|
|
1556
1555
|
|
|
1557
|
-
func_name = "_" + inspect.stack()[0][3]
|
|
1558
|
-
func_alias = globals()[func_name]
|
|
1559
1556
|
kwargs = params
|
|
1560
1557
|
del kwargs["action_to_apply_to_input_signal"]
|
|
1561
|
-
output_signal =
|
|
1558
|
+
output_signal = _annularly_average(**kwargs)
|
|
1562
1559
|
|
|
1563
1560
|
return output_signal
|
|
1564
1561
|
|
|
@@ -1783,17 +1780,16 @@ def annularly_integrate(input_signal, optional_params=_default_optional_params):
|
|
|
1783
1780
|
|
|
1784
1781
|
"""
|
|
1785
1782
|
params = locals()
|
|
1786
|
-
params["action_to_apply_to_input_signal"] =
|
|
1783
|
+
params["action_to_apply_to_input_signal"] = "annularly_integrate"
|
|
1784
|
+
global_symbol_table = globals()
|
|
1787
1785
|
for param_name in params:
|
|
1788
1786
|
func_name = "_check_and_convert_" + param_name
|
|
1789
|
-
func_alias =
|
|
1787
|
+
func_alias = global_symbol_table[func_name]
|
|
1790
1788
|
params[param_name] = func_alias(params)
|
|
1791
1789
|
|
|
1792
|
-
func_name = "_" + inspect.stack()[0][3]
|
|
1793
|
-
func_alias = globals()[func_name]
|
|
1794
1790
|
kwargs = params
|
|
1795
1791
|
del kwargs["action_to_apply_to_input_signal"]
|
|
1796
|
-
output_signal =
|
|
1792
|
+
output_signal = _annularly_integrate(**kwargs)
|
|
1797
1793
|
|
|
1798
1794
|
return output_signal
|
|
1799
1795
|
|
|
@@ -1819,14 +1815,14 @@ def _annularly_integrate(input_signal, optional_params):
|
|
|
1819
1815
|
|
|
1820
1816
|
|
|
1821
1817
|
def _check_and_convert_limits(params):
|
|
1822
|
-
|
|
1823
|
-
char_idx = 19
|
|
1824
|
-
obj_name = current_func_name[char_idx:]
|
|
1818
|
+
obj_name = "limits"
|
|
1825
1819
|
obj = params[obj_name]
|
|
1826
1820
|
|
|
1827
1821
|
param_name = "input_signal"
|
|
1828
1822
|
input_signal = params.get(param_name, None)
|
|
1829
1823
|
|
|
1824
|
+
current_func_name = "_check_and_convert_limits"
|
|
1825
|
+
|
|
1830
1826
|
if obj is not None:
|
|
1831
1827
|
try:
|
|
1832
1828
|
kwargs = {"obj": obj, "obj_name": obj_name}
|
|
@@ -1862,7 +1858,7 @@ def _calc_u_coords_1d(signal):
|
|
|
1862
1858
|
|
|
1863
1859
|
|
|
1864
1860
|
def _pre_serialize_limits(limits):
|
|
1865
|
-
obj_to_pre_serialize =
|
|
1861
|
+
obj_to_pre_serialize = limits
|
|
1866
1862
|
serializable_rep = obj_to_pre_serialize
|
|
1867
1863
|
|
|
1868
1864
|
return serializable_rep
|
|
@@ -1877,9 +1873,7 @@ def _de_pre_serialize_limits(serializable_rep):
|
|
|
1877
1873
|
|
|
1878
1874
|
|
|
1879
1875
|
def _check_and_convert_normalize(params):
|
|
1880
|
-
|
|
1881
|
-
char_idx = 19
|
|
1882
|
-
obj_name = current_func_name[char_idx:]
|
|
1876
|
+
obj_name = "normalize"
|
|
1883
1877
|
kwargs = {"obj": params[obj_name], "obj_name": obj_name}
|
|
1884
1878
|
normalize = czekitout.convert.to_bool(**kwargs)
|
|
1885
1879
|
|
|
@@ -1888,7 +1882,7 @@ def _check_and_convert_normalize(params):
|
|
|
1888
1882
|
|
|
1889
1883
|
|
|
1890
1884
|
def _pre_serialize_normalize(normalize):
|
|
1891
|
-
obj_to_pre_serialize =
|
|
1885
|
+
obj_to_pre_serialize = normalize
|
|
1892
1886
|
serializable_rep = obj_to_pre_serialize
|
|
1893
1887
|
|
|
1894
1888
|
return serializable_rep
|
|
@@ -2137,17 +2131,16 @@ def cumulatively_integrate_1d(input_signal,
|
|
|
2137
2131
|
|
|
2138
2132
|
"""
|
|
2139
2133
|
params = locals()
|
|
2140
|
-
params["action_to_apply_to_input_signal"] =
|
|
2134
|
+
params["action_to_apply_to_input_signal"] = "cumulatively_integrate_1d"
|
|
2135
|
+
global_symbol_table = globals()
|
|
2141
2136
|
for param_name in params:
|
|
2142
2137
|
func_name = "_check_and_convert_" + param_name
|
|
2143
|
-
func_alias =
|
|
2138
|
+
func_alias = global_symbol_table[func_name]
|
|
2144
2139
|
params[param_name] = func_alias(params)
|
|
2145
2140
|
|
|
2146
|
-
func_name = "_" + inspect.stack()[0][3]
|
|
2147
|
-
func_alias = globals()[func_name]
|
|
2148
2141
|
kwargs = params
|
|
2149
2142
|
del kwargs["action_to_apply_to_input_signal"]
|
|
2150
|
-
output_signal =
|
|
2143
|
+
output_signal = _cumulatively_integrate_1d(**kwargs)
|
|
2151
2144
|
|
|
2152
2145
|
return output_signal
|
|
2153
2146
|
|
|
@@ -2264,14 +2257,14 @@ def _cumulatively_integrate_input_signal_datasubset(input_signal_datasubset,
|
|
|
2264
2257
|
|
|
2265
2258
|
|
|
2266
2259
|
def _check_and_convert_window_dims(params):
|
|
2267
|
-
|
|
2268
|
-
char_idx = 19
|
|
2269
|
-
obj_name = current_func_name[char_idx:]
|
|
2260
|
+
obj_name = "window_dims"
|
|
2270
2261
|
obj = params[obj_name]
|
|
2271
2262
|
|
|
2272
2263
|
param_name = "input_signal"
|
|
2273
2264
|
input_signal = params.get(param_name, None)
|
|
2274
2265
|
|
|
2266
|
+
current_func_name = "_check_and_convert_window_dims"
|
|
2267
|
+
|
|
2275
2268
|
if obj is not None:
|
|
2276
2269
|
try:
|
|
2277
2270
|
kwargs = {"obj": obj, "obj_name": obj_name}
|
|
@@ -2291,7 +2284,7 @@ def _check_and_convert_window_dims(params):
|
|
|
2291
2284
|
|
|
2292
2285
|
|
|
2293
2286
|
def _pre_serialize_window_dims(window_dims):
|
|
2294
|
-
obj_to_pre_serialize =
|
|
2287
|
+
obj_to_pre_serialize = window_dims
|
|
2295
2288
|
serializable_rep = obj_to_pre_serialize
|
|
2296
2289
|
|
|
2297
2290
|
return serializable_rep
|
|
@@ -2306,9 +2299,7 @@ def _de_pre_serialize_window_dims(serializable_rep):
|
|
|
2306
2299
|
|
|
2307
2300
|
|
|
2308
2301
|
def _check_and_convert_pad_mode(params):
|
|
2309
|
-
|
|
2310
|
-
char_idx = 19
|
|
2311
|
-
obj_name = current_func_name[char_idx:]
|
|
2302
|
+
obj_name = "pad_mode"
|
|
2312
2303
|
obj = params[obj_name]
|
|
2313
2304
|
|
|
2314
2305
|
kwargs = {"obj": obj, "obj_name": obj_name}
|
|
@@ -2322,7 +2313,7 @@ def _check_and_convert_pad_mode(params):
|
|
|
2322
2313
|
|
|
2323
2314
|
|
|
2324
2315
|
def _pre_serialize_pad_mode(pad_mode):
|
|
2325
|
-
obj_to_pre_serialize =
|
|
2316
|
+
obj_to_pre_serialize = pad_mode
|
|
2326
2317
|
serializable_rep = obj_to_pre_serialize
|
|
2327
2318
|
|
|
2328
2319
|
return serializable_rep
|
|
@@ -2337,9 +2328,7 @@ def _de_pre_serialize_pad_mode(serializable_rep):
|
|
|
2337
2328
|
|
|
2338
2329
|
|
|
2339
2330
|
def _check_and_convert_apply_symmetric_mask(params):
|
|
2340
|
-
|
|
2341
|
-
char_idx = 19
|
|
2342
|
-
obj_name = current_func_name[char_idx:]
|
|
2331
|
+
obj_name = "apply_symmetric_mask"
|
|
2343
2332
|
kwargs = {"obj": params[obj_name], "obj_name": obj_name}
|
|
2344
2333
|
apply_symmetric_mask = czekitout.convert.to_bool(**kwargs)
|
|
2345
2334
|
|
|
@@ -2348,7 +2337,7 @@ def _check_and_convert_apply_symmetric_mask(params):
|
|
|
2348
2337
|
|
|
2349
2338
|
|
|
2350
2339
|
def _pre_serialize_apply_symmetric_mask(apply_symmetric_mask):
|
|
2351
|
-
obj_to_pre_serialize =
|
|
2340
|
+
obj_to_pre_serialize = apply_symmetric_mask
|
|
2352
2341
|
serializable_rep = obj_to_pre_serialize
|
|
2353
2342
|
|
|
2354
2343
|
return serializable_rep
|
|
@@ -2608,25 +2597,22 @@ def crop(input_signal, optional_params=_default_optional_params):
|
|
|
2608
2597
|
|
|
2609
2598
|
"""
|
|
2610
2599
|
params = locals()
|
|
2611
|
-
params["action_to_apply_to_input_signal"] =
|
|
2600
|
+
params["action_to_apply_to_input_signal"] = "crop"
|
|
2601
|
+
global_symbol_table = globals()
|
|
2612
2602
|
for param_name in params:
|
|
2613
2603
|
func_name = "_check_and_convert_" + param_name
|
|
2614
|
-
func_alias =
|
|
2604
|
+
func_alias = global_symbol_table[func_name]
|
|
2615
2605
|
params[param_name] = func_alias(params)
|
|
2616
2606
|
|
|
2617
|
-
func_name = "_" + inspect.stack()[0][3]
|
|
2618
|
-
func_alias = globals()[func_name]
|
|
2619
2607
|
kwargs = params
|
|
2620
2608
|
del kwargs["action_to_apply_to_input_signal"]
|
|
2621
|
-
output_signal =
|
|
2609
|
+
output_signal = _crop(**kwargs)
|
|
2622
2610
|
|
|
2623
2611
|
return output_signal
|
|
2624
2612
|
|
|
2625
2613
|
|
|
2626
2614
|
|
|
2627
2615
|
def _crop(input_signal, optional_params):
|
|
2628
|
-
current_func_name = inspect.stack()[0][3]
|
|
2629
|
-
|
|
2630
2616
|
optional_params_core_attrs = optional_params.get_core_attrs(deep_copy=False)
|
|
2631
2617
|
title = optional_params_core_attrs["title"]
|
|
2632
2618
|
|
|
@@ -2637,6 +2623,8 @@ def _crop(input_signal, optional_params):
|
|
|
2637
2623
|
navigation_dims = input_signal.data.shape[:-2]
|
|
2638
2624
|
num_patterns = int(np.prod(navigation_dims))
|
|
2639
2625
|
|
|
2626
|
+
current_func_name = "_crop"
|
|
2627
|
+
|
|
2640
2628
|
for pattern_idx in range(0, num_patterns):
|
|
2641
2629
|
navigation_indices = np.unravel_index(pattern_idx, navigation_dims)
|
|
2642
2630
|
input_signal_datasubset = input_signal.data[navigation_indices]
|
|
@@ -2798,9 +2786,7 @@ def _crop_input_signal_datasubset(input_signal_datasubset,
|
|
|
2798
2786
|
|
|
2799
2787
|
|
|
2800
2788
|
def _check_and_convert_block_dims(params):
|
|
2801
|
-
|
|
2802
|
-
char_idx = 19
|
|
2803
|
-
obj_name = current_func_name[char_idx:]
|
|
2789
|
+
obj_name = "block_dims"
|
|
2804
2790
|
kwargs = {"obj": params[obj_name], "obj_name": obj_name}
|
|
2805
2791
|
block_dims = czekitout.convert.to_pair_of_positive_ints(**kwargs)
|
|
2806
2792
|
|
|
@@ -2809,7 +2795,7 @@ def _check_and_convert_block_dims(params):
|
|
|
2809
2795
|
|
|
2810
2796
|
|
|
2811
2797
|
def _pre_serialize_block_dims(block_dims):
|
|
2812
|
-
obj_to_pre_serialize =
|
|
2798
|
+
obj_to_pre_serialize = block_dims
|
|
2813
2799
|
serializable_rep = obj_to_pre_serialize
|
|
2814
2800
|
|
|
2815
2801
|
return serializable_rep
|
|
@@ -2824,9 +2810,7 @@ def _de_pre_serialize_block_dims(serializable_rep):
|
|
|
2824
2810
|
|
|
2825
2811
|
|
|
2826
2812
|
def _check_and_convert_padding_const(params):
|
|
2827
|
-
|
|
2828
|
-
char_idx = 19
|
|
2829
|
-
obj_name = current_func_name[char_idx:]
|
|
2813
|
+
obj_name = "padding_const"
|
|
2830
2814
|
kwargs = {"obj": params[obj_name], "obj_name": obj_name}
|
|
2831
2815
|
padding_const = czekitout.convert.to_float(**kwargs)
|
|
2832
2816
|
|
|
@@ -2835,7 +2819,7 @@ def _check_and_convert_padding_const(params):
|
|
|
2835
2819
|
|
|
2836
2820
|
|
|
2837
2821
|
def _pre_serialize_padding_const(padding_const):
|
|
2838
|
-
obj_to_pre_serialize =
|
|
2822
|
+
obj_to_pre_serialize = padding_const
|
|
2839
2823
|
serializable_rep = obj_to_pre_serialize
|
|
2840
2824
|
|
|
2841
2825
|
return serializable_rep
|
|
@@ -2850,9 +2834,7 @@ def _de_pre_serialize_padding_const(serializable_rep):
|
|
|
2850
2834
|
|
|
2851
2835
|
|
|
2852
2836
|
def _check_and_convert_downsample_mode(params):
|
|
2853
|
-
|
|
2854
|
-
char_idx = 19
|
|
2855
|
-
obj_name = current_func_name[char_idx:]
|
|
2837
|
+
obj_name = "downsample_mode"
|
|
2856
2838
|
kwargs = {"obj": params[obj_name], "obj_name": obj_name}
|
|
2857
2839
|
downsample_mode = czekitout.convert.to_str_from_str_like(**kwargs)
|
|
2858
2840
|
|
|
@@ -2864,7 +2846,7 @@ def _check_and_convert_downsample_mode(params):
|
|
|
2864
2846
|
|
|
2865
2847
|
|
|
2866
2848
|
def _pre_serialize_downsample_mode(downsample_mode):
|
|
2867
|
-
obj_to_pre_serialize =
|
|
2849
|
+
obj_to_pre_serialize = downsample_mode
|
|
2868
2850
|
serializable_rep = obj_to_pre_serialize
|
|
2869
2851
|
|
|
2870
2852
|
return serializable_rep
|
|
@@ -3059,17 +3041,16 @@ def downsample(input_signal, optional_params=_default_optional_params):
|
|
|
3059
3041
|
|
|
3060
3042
|
"""
|
|
3061
3043
|
params = locals()
|
|
3062
|
-
params["action_to_apply_to_input_signal"] =
|
|
3044
|
+
params["action_to_apply_to_input_signal"] = "downsample"
|
|
3045
|
+
global_symbol_table = globals()
|
|
3063
3046
|
for param_name in params:
|
|
3064
3047
|
func_name = "_check_and_convert_" + param_name
|
|
3065
|
-
func_alias =
|
|
3048
|
+
func_alias = global_symbol_table[func_name]
|
|
3066
3049
|
params[param_name] = func_alias(params)
|
|
3067
3050
|
|
|
3068
|
-
func_name = "_" + inspect.stack()[0][3]
|
|
3069
|
-
func_alias = globals()[func_name]
|
|
3070
3051
|
kwargs = params
|
|
3071
3052
|
del kwargs["action_to_apply_to_input_signal"]
|
|
3072
|
-
output_signal =
|
|
3053
|
+
output_signal = _downsample(**kwargs)
|
|
3073
3054
|
|
|
3074
3055
|
return output_signal
|
|
3075
3056
|
|
|
@@ -3134,14 +3115,14 @@ def _downsample_input_signal_datasubset(input_signal_datasubset,
|
|
|
3134
3115
|
|
|
3135
3116
|
|
|
3136
3117
|
def _check_and_convert_new_signal_space_sizes(params):
|
|
3137
|
-
|
|
3138
|
-
char_idx = 19
|
|
3139
|
-
obj_name = current_func_name[char_idx:]
|
|
3118
|
+
obj_name = "new_signal_space_sizes"
|
|
3140
3119
|
obj = params[obj_name]
|
|
3141
3120
|
|
|
3142
3121
|
param_name = "input_signal"
|
|
3143
3122
|
input_signal = params.get(param_name, None)
|
|
3144
3123
|
|
|
3124
|
+
current_func_name = "_check_and_convert_new_signal_space_sizes"
|
|
3125
|
+
|
|
3145
3126
|
if obj is not None:
|
|
3146
3127
|
try:
|
|
3147
3128
|
func_alias = czekitout.convert.to_pair_of_positive_ints
|
|
@@ -3162,7 +3143,7 @@ def _check_and_convert_new_signal_space_sizes(params):
|
|
|
3162
3143
|
|
|
3163
3144
|
|
|
3164
3145
|
def _pre_serialize_new_signal_space_sizes(new_signal_space_sizes):
|
|
3165
|
-
obj_to_pre_serialize =
|
|
3146
|
+
obj_to_pre_serialize = new_signal_space_sizes
|
|
3166
3147
|
serializable_rep = obj_to_pre_serialize
|
|
3167
3148
|
|
|
3168
3149
|
return serializable_rep
|
|
@@ -3177,14 +3158,14 @@ def _de_pre_serialize_new_signal_space_sizes(serializable_rep):
|
|
|
3177
3158
|
|
|
3178
3159
|
|
|
3179
3160
|
def _check_and_convert_new_signal_space_scales(params):
|
|
3180
|
-
|
|
3181
|
-
char_idx = 19
|
|
3182
|
-
obj_name = current_func_name[char_idx:]
|
|
3161
|
+
obj_name = "new_signal_space_scales"
|
|
3183
3162
|
obj = params[obj_name]
|
|
3184
3163
|
|
|
3185
3164
|
param_name = "input_signal"
|
|
3186
3165
|
input_signal = params.get(param_name, None)
|
|
3187
3166
|
|
|
3167
|
+
current_func_name = "_check_and_convert_new_signal_space_scales"
|
|
3168
|
+
|
|
3188
3169
|
if obj is not None:
|
|
3189
3170
|
try:
|
|
3190
3171
|
func_alias = czekitout.convert.to_pair_of_floats
|
|
@@ -3209,7 +3190,7 @@ def _check_and_convert_new_signal_space_scales(params):
|
|
|
3209
3190
|
|
|
3210
3191
|
|
|
3211
3192
|
def _pre_serialize_new_signal_space_scales(new_signal_space_scales):
|
|
3212
|
-
obj_to_pre_serialize =
|
|
3193
|
+
obj_to_pre_serialize = new_signal_space_scales
|
|
3213
3194
|
serializable_rep = obj_to_pre_serialize
|
|
3214
3195
|
|
|
3215
3196
|
return serializable_rep
|
|
@@ -3224,14 +3205,14 @@ def _de_pre_serialize_new_signal_space_scales(serializable_rep):
|
|
|
3224
3205
|
|
|
3225
3206
|
|
|
3226
3207
|
def _check_and_convert_new_signal_space_offsets(params):
|
|
3227
|
-
|
|
3228
|
-
char_idx = 19
|
|
3229
|
-
obj_name = current_func_name[char_idx:]
|
|
3208
|
+
obj_name = "new_signal_space_offsets"
|
|
3230
3209
|
obj = params[obj_name]
|
|
3231
3210
|
|
|
3232
3211
|
param_name = "input_signal"
|
|
3233
3212
|
input_signal = params.get(param_name, None)
|
|
3234
3213
|
|
|
3214
|
+
current_func_name = "_check_and_convert_new_signal_space_offsets"
|
|
3215
|
+
|
|
3235
3216
|
if obj is not None:
|
|
3236
3217
|
try:
|
|
3237
3218
|
func_alias = czekitout.convert.to_pair_of_floats
|
|
@@ -3252,7 +3233,7 @@ def _check_and_convert_new_signal_space_offsets(params):
|
|
|
3252
3233
|
|
|
3253
3234
|
|
|
3254
3235
|
def _pre_serialize_new_signal_space_offsets(new_signal_space_offsets):
|
|
3255
|
-
obj_to_pre_serialize =
|
|
3236
|
+
obj_to_pre_serialize = new_signal_space_offsets
|
|
3256
3237
|
serializable_rep = obj_to_pre_serialize
|
|
3257
3238
|
|
|
3258
3239
|
return serializable_rep
|
|
@@ -3267,12 +3248,12 @@ def _de_pre_serialize_new_signal_space_offsets(serializable_rep):
|
|
|
3267
3248
|
|
|
3268
3249
|
|
|
3269
3250
|
def _check_and_convert_spline_degrees(params):
|
|
3270
|
-
|
|
3271
|
-
char_idx = 19
|
|
3272
|
-
obj_name = current_func_name[char_idx:]
|
|
3251
|
+
obj_name = "spline_degrees"
|
|
3273
3252
|
kwargs = {"obj": params[obj_name], "obj_name": obj_name}
|
|
3274
3253
|
spline_degrees = czekitout.convert.to_pair_of_positive_ints(**kwargs)
|
|
3275
3254
|
|
|
3255
|
+
current_func_name = "_check_and_convert_spline_degrees"
|
|
3256
|
+
|
|
3276
3257
|
if (spline_degrees[0] > 5) or (spline_degrees[1] > 5):
|
|
3277
3258
|
err_msg = globals()[current_func_name+"_err_msg_1"]
|
|
3278
3259
|
raise ValueError(err_msg)
|
|
@@ -3282,7 +3263,7 @@ def _check_and_convert_spline_degrees(params):
|
|
|
3282
3263
|
|
|
3283
3264
|
|
|
3284
3265
|
def _pre_serialize_spline_degrees(spline_degrees):
|
|
3285
|
-
obj_to_pre_serialize =
|
|
3266
|
+
obj_to_pre_serialize = spline_degrees
|
|
3286
3267
|
serializable_rep = obj_to_pre_serialize
|
|
3287
3268
|
|
|
3288
3269
|
return serializable_rep
|
|
@@ -3297,9 +3278,7 @@ def _de_pre_serialize_spline_degrees(serializable_rep):
|
|
|
3297
3278
|
|
|
3298
3279
|
|
|
3299
3280
|
def _check_and_convert_interpolate_polar_cmpnts(params):
|
|
3300
|
-
|
|
3301
|
-
char_idx = 19
|
|
3302
|
-
obj_name = current_func_name[char_idx:]
|
|
3281
|
+
obj_name = "interpolate_polar_cmpnts"
|
|
3303
3282
|
kwargs = {"obj": params[obj_name], "obj_name": obj_name}
|
|
3304
3283
|
interpolate_polar_cmpnts = czekitout.convert.to_bool(**kwargs)
|
|
3305
3284
|
|
|
@@ -3308,7 +3287,7 @@ def _check_and_convert_interpolate_polar_cmpnts(params):
|
|
|
3308
3287
|
|
|
3309
3288
|
|
|
3310
3289
|
def _pre_serialize_interpolate_polar_cmpnts(interpolate_polar_cmpnts):
|
|
3311
|
-
obj_to_pre_serialize =
|
|
3290
|
+
obj_to_pre_serialize = interpolate_polar_cmpnts
|
|
3312
3291
|
serializable_rep = obj_to_pre_serialize
|
|
3313
3292
|
|
|
3314
3293
|
return serializable_rep
|
|
@@ -3521,17 +3500,16 @@ def resample(input_signal, optional_params=_default_optional_params):
|
|
|
3521
3500
|
|
|
3522
3501
|
"""
|
|
3523
3502
|
params = locals()
|
|
3524
|
-
params["action_to_apply_to_input_signal"] =
|
|
3503
|
+
params["action_to_apply_to_input_signal"] = "resample"
|
|
3504
|
+
global_symbol_table = globals()
|
|
3525
3505
|
for param_name in params:
|
|
3526
3506
|
func_name = "_check_and_convert_" + param_name
|
|
3527
|
-
func_alias =
|
|
3507
|
+
func_alias = global_symbol_table[func_name]
|
|
3528
3508
|
params[param_name] = func_alias(params)
|
|
3529
3509
|
|
|
3530
|
-
func_name = "_" + inspect.stack()[0][3]
|
|
3531
|
-
func_alias = globals()[func_name]
|
|
3532
3510
|
kwargs = params
|
|
3533
3511
|
del kwargs["action_to_apply_to_input_signal"]
|
|
3534
|
-
output_signal =
|
|
3512
|
+
output_signal = _resample(**kwargs)
|
|
3535
3513
|
|
|
3536
3514
|
return output_signal
|
|
3537
3515
|
|
empix/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: empix
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary: Contains tools for analyzing electron microscopy data that are not available in ``hyperspy``.
|
|
5
5
|
Author-email: Matthew Fitzpatrick <matthew.rc.fitzpatrick@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://mrfitzpa.github.io/empix
|
|
@@ -25,19 +25,19 @@ Requires-Dist: czekitout
|
|
|
25
25
|
Requires-Dist: fancytypes>=1.0.0
|
|
26
26
|
Requires-Dist: hyperspy[all]
|
|
27
27
|
Requires-Dist: pyFAI
|
|
28
|
-
Provides-Extra:
|
|
29
|
-
Requires-Dist:
|
|
28
|
+
Provides-Extra: tests
|
|
29
|
+
Requires-Dist: pytest-cov; extra == "tests"
|
|
30
|
+
Provides-Extra: examples
|
|
31
|
+
Requires-Dist: jupyter; extra == "examples"
|
|
32
|
+
Requires-Dist: ipympl; extra == "examples"
|
|
30
33
|
Provides-Extra: docs
|
|
31
34
|
Requires-Dist: sphinx<7; extra == "docs"
|
|
32
|
-
Requires-Dist:
|
|
35
|
+
Requires-Dist: sphinx_rtd_theme; extra == "docs"
|
|
33
36
|
Requires-Dist: sphinx-autodoc-typehints; extra == "docs"
|
|
34
37
|
Requires-Dist: numpydoc; extra == "docs"
|
|
35
38
|
Requires-Dist: docutils; extra == "docs"
|
|
36
|
-
Provides-Extra:
|
|
37
|
-
Requires-Dist:
|
|
38
|
-
Requires-Dist: ipympl; extra == "examples"
|
|
39
|
-
Provides-Extra: tests
|
|
40
|
-
Requires-Dist: pytest-cov; extra == "tests"
|
|
39
|
+
Provides-Extra: all
|
|
40
|
+
Requires-Dist: empix[docs,examples,tests]; extra == "all"
|
|
41
41
|
|
|
42
42
|
# empix
|
|
43
43
|
|
|
@@ -52,7 +52,7 @@ Requires-Dist: pytest-cov; extra == "tests"
|
|
|
52
52
|
microscopy data that are not available in
|
|
53
53
|
[`hyperspy`](https://hyperspy.org/hyperspy-doc/current/index.html).
|
|
54
54
|
|
|
55
|
-
Visit the `empix` [website](https://mrfitzpa.
|
|
55
|
+
Visit the `empix` [website](https://mrfitzpa.github.io/empix) for a web version
|
|
56
56
|
of the installation instructions, the reference guide, and the examples archive.
|
|
57
57
|
|
|
58
58
|
<!--
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
empix/__init__.py,sha256=7Lo1f3w6dIc5ZSzjcrSNr8p9hSriZpYoaeeWdje-NPw,146382
|
|
2
|
+
empix/version.py,sha256=hB095avW4HuDZxn8qPHRG1UMzSSonb8ZDAsLxt9hmk8,411
|
|
3
|
+
empix-0.0.3.dist-info/LICENSE,sha256=N0P3pKtRMvfb64jmgJdlerg3TnS0a2QC776AzPsbZIg,35128
|
|
4
|
+
empix-0.0.3.dist-info/METADATA,sha256=1OhGkdbxKsHx1RM8HblXY7DugPeAPaWIj1vTXVOQI-s,3062
|
|
5
|
+
empix-0.0.3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
6
|
+
empix-0.0.3.dist-info/top_level.txt,sha256=6tteq_gpCW5Q3p1mBQfWv4h9jSqHMOyUrpe7PEXYdso,6
|
|
7
|
+
empix-0.0.3.dist-info/RECORD,,
|
empix-0.0.1.dist-info/RECORD
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
empix/__init__.py,sha256=cja_zG-KePl0a8J3ETC4BkT85DaZMtuBMJt0oTp4Lqc,147515
|
|
2
|
-
empix/version.py,sha256=pMnmqZnpVmaqR5nqHztNWzbbtb1oy5bPN_v7uhOH8K8,411
|
|
3
|
-
empix-0.0.1.dist-info/LICENSE,sha256=N0P3pKtRMvfb64jmgJdlerg3TnS0a2QC776AzPsbZIg,35128
|
|
4
|
-
empix-0.0.1.dist-info/METADATA,sha256=r7-1SSt0TudUNRgI1T7PWJpzqUtK3O_kGpLaq9dXz94,3062
|
|
5
|
-
empix-0.0.1.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
6
|
-
empix-0.0.1.dist-info/top_level.txt,sha256=6tteq_gpCW5Q3p1mBQfWv4h9jSqHMOyUrpe7PEXYdso,6
|
|
7
|
-
empix-0.0.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|