fakecbed 0.1.0__tar.gz → 0.2.1__tar.gz
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.
- {fakecbed-0.1.0 → fakecbed-0.2.1}/PKG-INFO +3 -3
- {fakecbed-0.1.0 → fakecbed-0.2.1}/fakecbed/discretized.py +50 -63
- {fakecbed-0.1.0 → fakecbed-0.2.1}/fakecbed/shapes.py +146 -137
- {fakecbed-0.1.0 → fakecbed-0.2.1}/fakecbed/tds.py +12 -15
- {fakecbed-0.1.0 → fakecbed-0.2.1}/fakecbed/version.py +2 -2
- {fakecbed-0.1.0 → fakecbed-0.2.1}/fakecbed.egg-info/PKG-INFO +3 -3
- {fakecbed-0.1.0 → fakecbed-0.2.1}/fakecbed.egg-info/requires.txt +1 -1
- {fakecbed-0.1.0 → fakecbed-0.2.1}/pyproject.toml +1 -1
- {fakecbed-0.1.0 → fakecbed-0.2.1}/.coveragerc +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/.github/workflows/measure_code_coverage.yml +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/.github/workflows/publish_documentation_website.yml +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/.github/workflows/publish_release_to_pypi.yml +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/.github/workflows/test_library.yml +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/.gitignore +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/LICENSE +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/README.md +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/docs/INSTALL.rst +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/docs/Makefile +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/docs/_static/readthedocs_custom.css +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/docs/_templates/custom_class_template.rst +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/docs/_templates/custom_module_template.rst +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/docs/_templates/versions.html +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/docs/api.rst +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/docs/build_docs.py +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/docs/conf.py +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/docs/examples.rst +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/docs/index.rst +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/docs/license.rst +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/docs/literature.rst +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/docs/make.bat +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/docs/private_members_to_publish_to_docs.rst +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/examples/basic_usage.ipynb +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/fakecbed/__init__.py +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/fakecbed.egg-info/SOURCES.txt +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/fakecbed.egg-info/dependency_links.txt +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/fakecbed.egg-info/top_level.txt +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/setup.cfg +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/setup.py +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/tests/test_discretized.py +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/tests/test_shapes.py +0 -0
- {fakecbed-0.1.0 → fakecbed-0.2.1}/tox.ini +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: fakecbed
|
|
3
|
-
Version: 0.1
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: A Python library for generating quickly images that imitate convergent beam electron diffraction patterns.
|
|
5
5
|
Author-email: Matthew Fitzpatrick <matthew.rc.fitzpatrick@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://mrfitzpa.github.io/fakecbed
|
|
@@ -21,7 +21,7 @@ Classifier: Natural Language :: English
|
|
|
21
21
|
Requires-Python: >=3.8
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
License-File: LICENSE
|
|
24
|
-
Requires-Dist: distoptica>=0.
|
|
24
|
+
Requires-Dist: distoptica>=0.3.0
|
|
25
25
|
Requires-Dist: hyperspy[all]
|
|
26
26
|
Provides-Extra: tests
|
|
27
27
|
Requires-Dist: pytest-cov; extra == "tests"
|
|
@@ -21,12 +21,6 @@
|
|
|
21
21
|
## Load libraries/packages/modules ##
|
|
22
22
|
#####################################
|
|
23
23
|
|
|
24
|
-
# For accessing attributes of functions.
|
|
25
|
-
import inspect
|
|
26
|
-
|
|
27
|
-
# For randomly selecting items in dictionaries.
|
|
28
|
-
import random
|
|
29
|
-
|
|
30
24
|
# For performing deep copies.
|
|
31
25
|
import copy
|
|
32
26
|
|
|
@@ -74,9 +68,7 @@ __all__ = ["CBEDPattern"]
|
|
|
74
68
|
|
|
75
69
|
|
|
76
70
|
def _check_and_convert_undistorted_tds_model(params):
|
|
77
|
-
|
|
78
|
-
char_idx = 19
|
|
79
|
-
obj_name = current_func_name[char_idx:]
|
|
71
|
+
obj_name = "undistorted_tds_model"
|
|
80
72
|
obj = params[obj_name]
|
|
81
73
|
|
|
82
74
|
accepted_types = (fakecbed.tds.Model, type(None))
|
|
@@ -95,7 +87,7 @@ def _check_and_convert_undistorted_tds_model(params):
|
|
|
95
87
|
|
|
96
88
|
|
|
97
89
|
def _pre_serialize_undistorted_tds_model(undistorted_tds_model):
|
|
98
|
-
obj_to_pre_serialize =
|
|
90
|
+
obj_to_pre_serialize = undistorted_tds_model
|
|
99
91
|
serializable_rep = obj_to_pre_serialize.pre_serialize()
|
|
100
92
|
|
|
101
93
|
return serializable_rep
|
|
@@ -111,11 +103,11 @@ def _de_pre_serialize_undistorted_tds_model(serializable_rep):
|
|
|
111
103
|
|
|
112
104
|
|
|
113
105
|
def _check_and_convert_undistorted_disks(params):
|
|
114
|
-
|
|
115
|
-
char_idx = 19
|
|
116
|
-
obj_name = current_func_name[char_idx:]
|
|
106
|
+
obj_name = "undistorted_disks"
|
|
117
107
|
obj = params[obj_name]
|
|
118
108
|
|
|
109
|
+
current_func_name = "_check_and_convert_undistorted_disks"
|
|
110
|
+
|
|
119
111
|
try:
|
|
120
112
|
for undistorted_disk in obj:
|
|
121
113
|
accepted_types = (fakecbed.shapes.NonuniformBoundedShape,)
|
|
@@ -147,7 +139,7 @@ def _check_and_convert_undistorted_disks(params):
|
|
|
147
139
|
|
|
148
140
|
|
|
149
141
|
def _pre_serialize_undistorted_disks(undistorted_disks):
|
|
150
|
-
obj_to_pre_serialize =
|
|
142
|
+
obj_to_pre_serialize = undistorted_disks
|
|
151
143
|
serializable_rep = tuple()
|
|
152
144
|
for elem in obj_to_pre_serialize:
|
|
153
145
|
serializable_rep += (elem.pre_serialize(),)
|
|
@@ -172,9 +164,7 @@ def _de_pre_serialize_undistorted_disks(serializable_rep):
|
|
|
172
164
|
|
|
173
165
|
|
|
174
166
|
def _check_and_convert_undistorted_misc_shapes(params):
|
|
175
|
-
|
|
176
|
-
char_idx = 19
|
|
177
|
-
obj_name = current_func_name[char_idx:]
|
|
167
|
+
obj_name = "undistorted_misc_shapes"
|
|
178
168
|
obj = params[obj_name]
|
|
179
169
|
|
|
180
170
|
accepted_types = (fakecbed.shapes.Circle,
|
|
@@ -188,6 +178,8 @@ def _check_and_convert_undistorted_misc_shapes(params):
|
|
|
188
178
|
fakecbed.shapes.Lune,
|
|
189
179
|
fakecbed.shapes.NonuniformBoundedShape)
|
|
190
180
|
|
|
181
|
+
current_func_name = "_check_and_convert_undistorted_misc_shapes"
|
|
182
|
+
|
|
191
183
|
try:
|
|
192
184
|
for undistorted_misc_shape in obj:
|
|
193
185
|
kwargs = {"obj": undistorted_misc_shape,
|
|
@@ -205,7 +197,7 @@ def _check_and_convert_undistorted_misc_shapes(params):
|
|
|
205
197
|
|
|
206
198
|
|
|
207
199
|
def _pre_serialize_undistorted_misc_shapes(undistorted_misc_shapes):
|
|
208
|
-
obj_to_pre_serialize =
|
|
200
|
+
obj_to_pre_serialize = undistorted_misc_shapes
|
|
209
201
|
serializable_rep = tuple()
|
|
210
202
|
for elem in obj_to_pre_serialize:
|
|
211
203
|
serializable_rep += (elem.pre_serialize(),)
|
|
@@ -249,9 +241,7 @@ def _de_pre_serialize_undistorted_misc_shapes(serializable_rep):
|
|
|
249
241
|
|
|
250
242
|
|
|
251
243
|
def _check_and_convert_undistorted_outer_illumination_shape(params):
|
|
252
|
-
|
|
253
|
-
char_idx = 19
|
|
254
|
-
obj_name = current_func_name[char_idx:]
|
|
244
|
+
obj_name = "undistorted_outer_illumination_shape"
|
|
255
245
|
obj = params[obj_name]
|
|
256
246
|
|
|
257
247
|
accepted_types = (fakecbed.shapes.Circle,
|
|
@@ -275,7 +265,7 @@ def _check_and_convert_undistorted_outer_illumination_shape(params):
|
|
|
275
265
|
|
|
276
266
|
def _pre_serialize_undistorted_outer_illumination_shape(
|
|
277
267
|
undistorted_outer_illumination_shape):
|
|
278
|
-
obj_to_pre_serialize =
|
|
268
|
+
obj_to_pre_serialize = undistorted_outer_illumination_shape
|
|
279
269
|
serializable_rep = obj_to_pre_serialize.pre_serialize()
|
|
280
270
|
|
|
281
271
|
return serializable_rep
|
|
@@ -298,8 +288,7 @@ def _de_pre_serialize_undistorted_outer_illumination_shape(serializable_rep):
|
|
|
298
288
|
|
|
299
289
|
|
|
300
290
|
def _check_and_convert_gaussian_filter_std_dev(params):
|
|
301
|
-
|
|
302
|
-
obj_name = current_func_name[19:]
|
|
291
|
+
obj_name = "gaussian_filter_std_dev"
|
|
303
292
|
func_alias = czekitout.convert.to_nonnegative_float
|
|
304
293
|
kwargs = {"obj": params[obj_name], "obj_name": obj_name}
|
|
305
294
|
gaussian_filter_std_dev = func_alias(**kwargs)
|
|
@@ -308,9 +297,8 @@ def _check_and_convert_gaussian_filter_std_dev(params):
|
|
|
308
297
|
|
|
309
298
|
|
|
310
299
|
|
|
311
|
-
def _pre_serialize_gaussian_filter_std_dev(
|
|
312
|
-
|
|
313
|
-
obj_to_pre_serialize = random.choice(list(locals().values()))
|
|
300
|
+
def _pre_serialize_gaussian_filter_std_dev(gaussian_filter_std_dev):
|
|
301
|
+
obj_to_pre_serialize = gaussian_filter_std_dev
|
|
314
302
|
serializable_rep = obj_to_pre_serialize
|
|
315
303
|
|
|
316
304
|
return serializable_rep
|
|
@@ -325,9 +313,7 @@ def _de_pre_serialize_gaussian_filter_std_dev(serializable_rep):
|
|
|
325
313
|
|
|
326
314
|
|
|
327
315
|
def _check_and_convert_distortion_model(params):
|
|
328
|
-
|
|
329
|
-
char_idx = 19
|
|
330
|
-
obj_name = current_func_name[char_idx:]
|
|
316
|
+
obj_name = "distortion_model"
|
|
331
317
|
obj = params[obj_name]
|
|
332
318
|
|
|
333
319
|
num_pixels_across_pattern = \
|
|
@@ -351,6 +337,8 @@ def _check_and_convert_distortion_model(params):
|
|
|
351
337
|
sampling_grid_dims_in_pixels = \
|
|
352
338
|
distortion_model_core_attrs["sampling_grid_dims_in_pixels"]
|
|
353
339
|
|
|
340
|
+
current_func_name = "_check_and_convert_distortion_model"
|
|
341
|
+
|
|
354
342
|
if ((sampling_grid_dims_in_pixels[0]%num_pixels_across_pattern != 0)
|
|
355
343
|
or (sampling_grid_dims_in_pixels[1]%num_pixels_across_pattern != 0)):
|
|
356
344
|
err_msg = globals()[current_func_name+"_err_msg_1"]
|
|
@@ -361,7 +349,7 @@ def _check_and_convert_distortion_model(params):
|
|
|
361
349
|
|
|
362
350
|
|
|
363
351
|
def _pre_serialize_distortion_model(distortion_model):
|
|
364
|
-
obj_to_pre_serialize =
|
|
352
|
+
obj_to_pre_serialize = distortion_model
|
|
365
353
|
serializable_rep = obj_to_pre_serialize.pre_serialize()
|
|
366
354
|
|
|
367
355
|
return serializable_rep
|
|
@@ -377,8 +365,7 @@ def _de_pre_serialize_distortion_model(serializable_rep):
|
|
|
377
365
|
|
|
378
366
|
|
|
379
367
|
def _check_and_convert_num_pixels_across_pattern(params):
|
|
380
|
-
|
|
381
|
-
obj_name = current_func_name[19:]
|
|
368
|
+
obj_name = "num_pixels_across_pattern"
|
|
382
369
|
kwargs = {"obj": params[obj_name], "obj_name": obj_name}
|
|
383
370
|
num_pixels_across_pattern = czekitout.convert.to_positive_int(**kwargs)
|
|
384
371
|
|
|
@@ -387,7 +374,7 @@ def _check_and_convert_num_pixels_across_pattern(params):
|
|
|
387
374
|
|
|
388
375
|
|
|
389
376
|
def _pre_serialize_num_pixels_across_pattern(num_pixels_across_pattern):
|
|
390
|
-
obj_to_pre_serialize =
|
|
377
|
+
obj_to_pre_serialize = num_pixels_across_pattern
|
|
391
378
|
serializable_rep = obj_to_pre_serialize
|
|
392
379
|
|
|
393
380
|
return serializable_rep
|
|
@@ -402,8 +389,7 @@ def _de_pre_serialize_num_pixels_across_pattern(serializable_rep):
|
|
|
402
389
|
|
|
403
390
|
|
|
404
391
|
def _check_and_convert_apply_shot_noise(params):
|
|
405
|
-
|
|
406
|
-
obj_name = current_func_name[19:]
|
|
392
|
+
obj_name = "apply_shot_noise"
|
|
407
393
|
kwargs = {"obj": params[obj_name], "obj_name": obj_name}
|
|
408
394
|
apply_shot_noise = czekitout.convert.to_bool(**kwargs)
|
|
409
395
|
|
|
@@ -412,7 +398,7 @@ def _check_and_convert_apply_shot_noise(params):
|
|
|
412
398
|
|
|
413
399
|
|
|
414
400
|
def _pre_serialize_apply_shot_noise(apply_shot_noise):
|
|
415
|
-
obj_to_pre_serialize =
|
|
401
|
+
obj_to_pre_serialize = apply_shot_noise
|
|
416
402
|
serializable_rep = obj_to_pre_serialize
|
|
417
403
|
|
|
418
404
|
return serializable_rep
|
|
@@ -427,8 +413,7 @@ def _de_pre_serialize_apply_shot_noise(serializable_rep):
|
|
|
427
413
|
|
|
428
414
|
|
|
429
415
|
def _check_and_convert_detector_partition_width_in_pixels(params):
|
|
430
|
-
|
|
431
|
-
obj_name = current_func_name[19:]
|
|
416
|
+
obj_name = "detector_partition_width_in_pixels"
|
|
432
417
|
func_alias = czekitout.convert.to_nonnegative_int
|
|
433
418
|
kwargs = {"obj": params[obj_name], "obj_name": obj_name}
|
|
434
419
|
detector_partition_width_in_pixels = func_alias(**kwargs)
|
|
@@ -439,7 +424,7 @@ def _check_and_convert_detector_partition_width_in_pixels(params):
|
|
|
439
424
|
|
|
440
425
|
def _pre_serialize_detector_partition_width_in_pixels(
|
|
441
426
|
detector_partition_width_in_pixels):
|
|
442
|
-
obj_to_pre_serialize =
|
|
427
|
+
obj_to_pre_serialize = detector_partition_width_in_pixels
|
|
443
428
|
serializable_rep = obj_to_pre_serialize
|
|
444
429
|
|
|
445
430
|
return serializable_rep
|
|
@@ -454,14 +439,15 @@ def _de_pre_serialize_detector_partition_width_in_pixels(serializable_rep):
|
|
|
454
439
|
|
|
455
440
|
|
|
456
441
|
def _check_and_convert_cold_pixels(params):
|
|
457
|
-
|
|
458
|
-
obj_name = current_func_name[19:]
|
|
442
|
+
obj_name = "cold_pixels"
|
|
459
443
|
kwargs = {"obj": params[obj_name], "obj_name": obj_name}
|
|
460
444
|
cold_pixels = czekitout.convert.to_pairs_of_ints(**kwargs)
|
|
461
445
|
|
|
462
446
|
num_pixels_across_pattern = \
|
|
463
447
|
_check_and_convert_num_pixels_across_pattern(params)
|
|
464
448
|
|
|
449
|
+
current_func_name = "_check_and_convert_cold_pixels"
|
|
450
|
+
|
|
465
451
|
coords_of_cold_pixels = cold_pixels
|
|
466
452
|
for coords_of_cold_pixel in coords_of_cold_pixels:
|
|
467
453
|
row, col = coords_of_cold_pixel
|
|
@@ -491,8 +477,7 @@ def _de_pre_serialize_cold_pixels(serializable_rep):
|
|
|
491
477
|
|
|
492
478
|
|
|
493
479
|
def _check_and_convert_mask_frame(params):
|
|
494
|
-
|
|
495
|
-
obj_name = current_func_name[19:]
|
|
480
|
+
obj_name = "mask_frame"
|
|
496
481
|
kwargs = {"obj": params[obj_name], "obj_name": obj_name}
|
|
497
482
|
mask_frame = czekitout.convert.to_quadruplet_of_nonnegative_ints(**kwargs)
|
|
498
483
|
|
|
@@ -501,7 +486,7 @@ def _check_and_convert_mask_frame(params):
|
|
|
501
486
|
|
|
502
487
|
|
|
503
488
|
def _pre_serialize_mask_frame(mask_frame):
|
|
504
|
-
obj_to_pre_serialize =
|
|
489
|
+
obj_to_pre_serialize = mask_frame
|
|
505
490
|
serializable_rep = obj_to_pre_serialize
|
|
506
491
|
|
|
507
492
|
return serializable_rep
|
|
@@ -516,8 +501,7 @@ def _de_pre_serialize_mask_frame(serializable_rep):
|
|
|
516
501
|
|
|
517
502
|
|
|
518
503
|
def _check_and_convert_deep_copy(params):
|
|
519
|
-
|
|
520
|
-
obj_name = current_func_name[19:]
|
|
504
|
+
obj_name = "deep_copy"
|
|
521
505
|
kwargs = {"obj": params[obj_name], "obj_name": obj_name}
|
|
522
506
|
deep_copy = czekitout.convert.to_bool(**kwargs)
|
|
523
507
|
|
|
@@ -526,9 +510,7 @@ def _check_and_convert_deep_copy(params):
|
|
|
526
510
|
|
|
527
511
|
|
|
528
512
|
def _check_and_convert_overriding_image(params):
|
|
529
|
-
|
|
530
|
-
char_idx = 19
|
|
531
|
-
obj_name = current_func_name[char_idx:]
|
|
513
|
+
obj_name = "overriding_image"
|
|
532
514
|
obj = params[obj_name]
|
|
533
515
|
|
|
534
516
|
func_alias = fakecbed.shapes._check_and_convert_real_torch_matrix
|
|
@@ -542,6 +524,8 @@ def _check_and_convert_overriding_image(params):
|
|
|
542
524
|
num_pixels_across_pattern = params["num_pixels_across_pattern"]
|
|
543
525
|
expected_image_dims_in_pixels = 2*(num_pixels_across_pattern,)
|
|
544
526
|
|
|
527
|
+
current_func_name = "_check_and_convert_overriding_image"
|
|
528
|
+
|
|
545
529
|
if overriding_image.shape != expected_image_dims_in_pixels:
|
|
546
530
|
unformatted_err_msg = globals()[current_func_name+"_err_msg_1"]
|
|
547
531
|
args = expected_image_dims_in_pixels
|
|
@@ -908,7 +892,7 @@ class CBEDPattern(fancytypes.PreSerializableAndUpdatable):
|
|
|
908
892
|
\text{det}\left(\mathbf{J}_{\square}\left(
|
|
909
893
|
q_{\mathring{\mathcal{I}};x;j},
|
|
910
894
|
q_{\mathring{\mathcal{I}};y;i}\right)\right)
|
|
911
|
-
\mathring{\mathcal{I}}_{\text{CBED};⌑;i,j}
|
|
895
|
+
\left|\mathring{\mathcal{I}}_{\text{CBED};⌑;i,j}\right|.
|
|
912
896
|
:label: HD_I_CBED__3
|
|
913
897
|
|
|
914
898
|
8. Apply average pooling to
|
|
@@ -1178,8 +1162,12 @@ class CBEDPattern(fancytypes.PreSerializableAndUpdatable):
|
|
|
1178
1162
|
|
|
1179
1163
|
|
|
1180
1164
|
|
|
1181
|
-
def update(self,
|
|
1182
|
-
|
|
1165
|
+
def update(self,
|
|
1166
|
+
new_core_attr_subset_candidate,
|
|
1167
|
+
skip_validation_and_conversion=\
|
|
1168
|
+
_default_skip_validation_and_conversion):
|
|
1169
|
+
super().update(new_core_attr_subset_candidate,
|
|
1170
|
+
skip_validation_and_conversion)
|
|
1183
1171
|
self.execute_post_core_attrs_update_actions()
|
|
1184
1172
|
|
|
1185
1173
|
return None
|
|
@@ -1666,21 +1654,20 @@ class CBEDPattern(fancytypes.PreSerializableAndUpdatable):
|
|
|
1666
1654
|
method_name = ("_calc_maskless_and_noiseless_image"
|
|
1667
1655
|
"_and_cache_select_intermediates")
|
|
1668
1656
|
method_alias = getattr(self, method_name)
|
|
1669
|
-
|
|
1657
|
+
image = method_alias(u_x, u_y)
|
|
1658
|
+
|
|
1659
|
+
apply_shot_noise = self._apply_shot_noise
|
|
1660
|
+
image = torch.poisson(image) if (apply_shot_noise == True) else image
|
|
1670
1661
|
|
|
1662
|
+
image = self._apply_detector_partition_inpainting(input_image=image)
|
|
1663
|
+
|
|
1671
1664
|
if self._illumination_support is None:
|
|
1672
1665
|
method_name = "_calc_illumination_support"
|
|
1673
1666
|
method_alias = getattr(self, method_name)
|
|
1674
1667
|
self._illumination_support = method_alias(u_x, u_y)
|
|
1675
1668
|
illumination_support = self._illumination_support
|
|
1676
1669
|
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
apply_shot_noise = self._apply_shot_noise
|
|
1680
|
-
|
|
1681
|
-
image = (torch.poisson(noiseless_image)
|
|
1682
|
-
if (apply_shot_noise == True)
|
|
1683
|
-
else noiseless_image)
|
|
1670
|
+
image = image*illumination_support
|
|
1684
1671
|
|
|
1685
1672
|
coords_of_cold_pixels = self._cold_pixels
|
|
1686
1673
|
L, R, B, T = self._mask_frame
|
|
@@ -1694,8 +1681,6 @@ class CBEDPattern(fancytypes.PreSerializableAndUpdatable):
|
|
|
1694
1681
|
for coords_of_cold_pixel in coords_of_cold_pixels:
|
|
1695
1682
|
image[coords_of_cold_pixel] = 0
|
|
1696
1683
|
|
|
1697
|
-
image = self._apply_detector_partition_inpainting(input_image=image)
|
|
1698
|
-
|
|
1699
1684
|
image = self._normalize_matrix(input_matrix=image)
|
|
1700
1685
|
|
|
1701
1686
|
image = torch.clip(image, min=0)
|
|
@@ -1728,6 +1713,8 @@ class CBEDPattern(fancytypes.PreSerializableAndUpdatable):
|
|
|
1728
1713
|
+ (disk_supports
|
|
1729
1714
|
* intra_disk_shapes).sum(dim=0))
|
|
1730
1715
|
|
|
1716
|
+
maskless_and_noiseless_image = torch.abs(maskless_and_noiseless_image)
|
|
1717
|
+
|
|
1731
1718
|
kwargs = {"input_matrix": maskless_and_noiseless_image,
|
|
1732
1719
|
"truncate": 4}
|
|
1733
1720
|
maskless_and_noiseless_image = self._apply_2d_guassian_filter(**kwargs)
|