fakecbed 0.5.1__tar.gz → 0.5.3__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.5.1 → fakecbed-0.5.3}/.gitignore +2 -1
- fakecbed-0.5.3/.zenodo.json +38 -0
- fakecbed-0.5.3/CITATION.cff +30 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/PKG-INFO +2 -1
- {fakecbed-0.5.1 → fakecbed-0.5.3}/README.md +1 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/docs/build_docs.py +19 -7
- {fakecbed-0.5.1 → fakecbed-0.5.3}/docs/conf.py +34 -13
- {fakecbed-0.5.1 → fakecbed-0.5.3}/docs/index.rst +5 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/fakecbed/discretized.py +42 -28
- {fakecbed-0.5.1 → fakecbed-0.5.3}/fakecbed/shapes.py +149 -74
- {fakecbed-0.5.1 → fakecbed-0.5.3}/fakecbed/tds.py +6 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/fakecbed/version.py +3 -3
- {fakecbed-0.5.1 → fakecbed-0.5.3}/fakecbed.egg-info/PKG-INFO +2 -1
- {fakecbed-0.5.1 → fakecbed-0.5.3}/fakecbed.egg-info/SOURCES.txt +2 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/.coveragerc +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/.github/workflows/measure_code_coverage.yml +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/.github/workflows/publish_documentation_website.yml +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/.github/workflows/publish_release_to_pypi.yml +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/.github/workflows/test_library.yml +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/LICENSE +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/docs/INSTALL.rst +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/docs/Makefile +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/docs/_static/readthedocs_custom.css +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/docs/_templates/custom_class_template.rst +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/docs/_templates/custom_module_template.rst +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/docs/_templates/versions.html +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/docs/api.rst +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/docs/examples.rst +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/docs/license.rst +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/docs/literature.rst +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/docs/make.bat +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/docs/private_members_to_publish_to_docs.rst +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/examples/basic_usage.ipynb +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/fakecbed/__init__.py +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/fakecbed.egg-info/dependency_links.txt +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/fakecbed.egg-info/requires.txt +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/fakecbed.egg-info/top_level.txt +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/pyproject.toml +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/run_tests.sh +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/setup.cfg +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/setup.py +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/tests/test_discretized.py +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/tests/test_shapes.py +0 -0
- {fakecbed-0.5.1 → fakecbed-0.5.3}/tox.ini +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"creators": [
|
|
3
|
+
{
|
|
4
|
+
"name": "Fitzpatrick, Matthew R. C.",
|
|
5
|
+
"affiliation": "University of Victoria",
|
|
6
|
+
"orcid": "0000-0001-5347-0629"
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
"contributors": [
|
|
10
|
+
{
|
|
11
|
+
"name": "Blackburn, Arthur",
|
|
12
|
+
"affiliation": "University of Victoria",
|
|
13
|
+
"type": "Supervisor",
|
|
14
|
+
"orcid": "0000-0001-6874-9729"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"description": "<p>FakeCBED is Python library for generating quickly images that imitate convergent beam electron diffraction patterns.</p><p>This work was part-funded by the Natural Sciences and Engineering Research Council of Canada (NSERC), from Collaborative Research and Development grant (CRDPJ 543431), partnering with Hitachi High-Tech Canada.</p>",
|
|
18
|
+
"keywords": [
|
|
19
|
+
"pytorch",
|
|
20
|
+
"microscopy",
|
|
21
|
+
"diffraction",
|
|
22
|
+
"cbed",
|
|
23
|
+
"gpu"
|
|
24
|
+
],
|
|
25
|
+
"license": {
|
|
26
|
+
"id": "GPL-3.0"
|
|
27
|
+
},
|
|
28
|
+
"publication_date": "2026-01-18",
|
|
29
|
+
"title": "FakeCBED",
|
|
30
|
+
"version": "0.5.3",
|
|
31
|
+
"access_right": "open",
|
|
32
|
+
"upload_type": "software",
|
|
33
|
+
"language": "eng",
|
|
34
|
+
"communities": [
|
|
35
|
+
{"identifier": "tem"},
|
|
36
|
+
{"identifier": "4d-stem"}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
title: FakeCBED
|
|
3
|
+
message: >-
|
|
4
|
+
If you use this software, please cite it using the
|
|
5
|
+
metadata from this file.
|
|
6
|
+
type: software
|
|
7
|
+
authors:
|
|
8
|
+
- given-names: Matthew R. C.
|
|
9
|
+
family-names: Fitzpatrick
|
|
10
|
+
email: matthew.rc.fitzpatrick@gmail.com
|
|
11
|
+
affiliation: University of Victoria
|
|
12
|
+
orcid: 'https://orcid.org/0000-0001-5347-0629'
|
|
13
|
+
repository-code: 'https://github.com/mrfitzpa/fakecbed'
|
|
14
|
+
url: 'https://mrfitzpa.github.io/fakecbed/'
|
|
15
|
+
abstract: >-
|
|
16
|
+
FakeCBED is Python library for generating quickly images that imitate
|
|
17
|
+
convergent beam electron diffraction patterns.
|
|
18
|
+
keywords:
|
|
19
|
+
- pytorch
|
|
20
|
+
- microscopy
|
|
21
|
+
- diffraction
|
|
22
|
+
- cbed
|
|
23
|
+
- gpu
|
|
24
|
+
license: GPL-3.0
|
|
25
|
+
version: 0.5.3
|
|
26
|
+
date-released: '2026-01-18'
|
|
27
|
+
identifiers:
|
|
28
|
+
- description: "This is the collection of archived snapshots of all versions."
|
|
29
|
+
type: doi
|
|
30
|
+
value: 10.5281/zenodo.18297325
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fakecbed
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.3
|
|
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
|
|
@@ -46,6 +46,7 @@ Dynamic: license-file
|
|
|
46
46
|
[](https://pypi.org/project/fakecbed)
|
|
47
47
|
[](https://anaconda.org/conda-forge/fakecbed)
|
|
48
48
|
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
49
|
+
[](https://doi.org/10.5281/zenodo.18297325)
|
|
49
50
|
|
|
50
51
|
`fakecbed` is a Python library for generating quickly images that imitate
|
|
51
52
|
convergent beam electron diffraction patterns.
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
[](https://pypi.org/project/fakecbed)
|
|
7
7
|
[](https://anaconda.org/conda-forge/fakecbed)
|
|
8
8
|
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
9
|
+
[](https://doi.org/10.5281/zenodo.18297325)
|
|
9
10
|
|
|
10
11
|
`fakecbed` is a Python library for generating quickly images that imitate
|
|
11
12
|
convergent beam electron diffraction patterns.
|
|
@@ -98,16 +98,28 @@ _mvdir("./_build/html/", "./pages/")
|
|
|
98
98
|
|
|
99
99
|
cmd_output_as_bytes = subprocess.check_output("git tag", shell=True)
|
|
100
100
|
cmd_output = cmd_output_as_bytes.decode("utf-8")
|
|
101
|
-
|
|
101
|
+
tag_set = cmd_output.rstrip("\n").split("\n")
|
|
102
102
|
|
|
103
|
-
pattern = r"v[0-9]+\.[0
|
|
104
|
-
|
|
103
|
+
pattern = r"v[0-9]+\.[0-9]+\.[0-9]+"
|
|
104
|
+
release_tag_set = tuple(tag for tag in tag_set if re.fullmatch(pattern, tag))
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
version_subset = dict()
|
|
107
|
+
for tag in release_tag_set:
|
|
107
108
|
version = tag[1:]
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
major, minor, patch = [int(int_as_str) for int_as_str in version.split(".")]
|
|
110
|
+
version_subset.setdefault(major, dict())
|
|
111
|
+
version_subset[major].setdefault(minor, 0)
|
|
112
|
+
version_subset[major][minor] = max(version_subset[major][minor], patch)
|
|
113
|
+
|
|
114
|
+
for major in sorted(version_subset.keys()):
|
|
115
|
+
for minor in sorted(version_subset[major].keys()):
|
|
116
|
+
patch = version_subset[major][minor]
|
|
117
|
+
version = "{}.{}.{}".format(major, minor, patch)
|
|
118
|
+
tag = "v"+version
|
|
119
|
+
major_minor = "{}.{}".format(major, minor)
|
|
120
|
+
language = "en"
|
|
121
|
+
_build_doc(version, language, tag)
|
|
122
|
+
_mvdir("./_build/html/", "./pages/"+major_minor+"/"+language+"/")
|
|
111
123
|
|
|
112
124
|
subprocess.run("cd ..; pip install .; cd docs", shell=True)
|
|
113
125
|
_mvdir("./pages/", "../pages/")
|
|
@@ -172,33 +172,54 @@ build_all_docs = os.environ.get("build_all_docs", None)
|
|
|
172
172
|
pages_root = os.environ.get("pages_root", "")
|
|
173
173
|
|
|
174
174
|
if build_all_docs is not None:
|
|
175
|
-
current_language = os.environ.get("current_language")
|
|
175
|
+
current_language = os.environ.get("current_language")
|
|
176
176
|
current_version = os.environ.get("current_version")
|
|
177
177
|
|
|
178
|
+
major, minor, patch = ((None, None, None)
|
|
179
|
+
if (current_version == "latest")
|
|
180
|
+
else current_version.split("."))
|
|
181
|
+
current_major_minor = ("latest"
|
|
182
|
+
if (major is None)
|
|
183
|
+
else "{}.{}".format(major, minor))
|
|
184
|
+
|
|
178
185
|
html_context = {"current_language" : current_language,
|
|
179
186
|
"languages" : [],
|
|
180
|
-
"current_version" :
|
|
187
|
+
"current_version" : current_major_minor,
|
|
181
188
|
"versions" : []}
|
|
182
189
|
|
|
183
|
-
if
|
|
190
|
+
if current_version == "latest":
|
|
184
191
|
html_context["languages"].append(["en", pages_root])
|
|
185
192
|
|
|
186
|
-
if
|
|
193
|
+
if current_language == "en":
|
|
187
194
|
html_context["versions"].append(["latest", pages_root])
|
|
188
195
|
|
|
189
196
|
cmd_output_as_bytes = subprocess.check_output("git tag", shell=True)
|
|
190
197
|
cmd_output = cmd_output_as_bytes.decode("utf-8")
|
|
191
|
-
|
|
198
|
+
tag_set = cmd_output.rstrip("\n").split("\n")
|
|
192
199
|
|
|
193
|
-
pattern = r"v[0-9]+\.[0
|
|
194
|
-
|
|
200
|
+
pattern = r"v[0-9]+\.[0-9]+\.[0-9]+"
|
|
201
|
+
release_tag_set = tuple(tag
|
|
202
|
+
for tag
|
|
203
|
+
in tag_set
|
|
204
|
+
if re.fullmatch(pattern, tag))
|
|
195
205
|
|
|
196
|
-
|
|
206
|
+
version_subset = dict()
|
|
207
|
+
for tag in release_tag_set:
|
|
208
|
+
version = tag[1:]
|
|
209
|
+
major, minor, patch = [int(int_as_str)
|
|
210
|
+
for int_as_str
|
|
211
|
+
in version.split(".")]
|
|
212
|
+
version_subset.setdefault(major, dict())
|
|
213
|
+
version_subset[major].setdefault(minor, 0)
|
|
214
|
+
version_subset[major][minor] = max(version_subset[major][minor], patch)
|
|
215
|
+
|
|
216
|
+
if current_version != "latest":
|
|
197
217
|
language = "en"
|
|
198
|
-
path = pages_root+"/"+
|
|
218
|
+
path = pages_root+"/"+current_major_minor+"/"+language
|
|
199
219
|
html_context["languages"].append([language, path])
|
|
200
220
|
|
|
201
|
-
for
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
221
|
+
for major in sorted(version_subset.keys()):
|
|
222
|
+
for minor in sorted(version_subset[major].keys()):
|
|
223
|
+
major_minor = "{}.{}".format(major, minor)
|
|
224
|
+
path = pages_root+"/"+major_minor+"/"+current_language
|
|
225
|
+
html_context["versions"].append([major_minor, path])
|
|
@@ -635,14 +635,17 @@ class CBEDPattern(fancytypes.PreSerializableAndUpdatable):
|
|
|
635
635
|
|
|
636
636
|
Let :math:`u_{x}` and :math:`u_{y}` be the fractional horizontal and
|
|
637
637
|
vertical coordinates, respectively, of a point in an undistorted image,
|
|
638
|
-
where :math:`\left(u_{x},u_{y}\right)=\left(0,0\right)`
|
|
639
|
-
|
|
638
|
+
where :math:`\left(u_{x},u_{y}\right)=\left(0,0\right)`
|
|
639
|
+
:math:`\left[\left(u_{x},u_{y}\right)=\left(1,1\right)\right]` is the lower
|
|
640
|
+
left [upper right] corner of the lower left [upper right] pixel of the
|
|
641
|
+
undistorted image. Secondly, let :math:`q_{x}` and :math:`q_{y}` be the
|
|
640
642
|
fractional horizontal and vertical coordinates, respectively, of a point in
|
|
641
643
|
a distorted image, where :math:`\left(q_{x},q_{y}\right)=\left(0,0\right)`
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
644
|
+
:math:`\left[\left(q_{x},q_{y}\right)=\left(1,1\right)\right]` is the lower
|
|
645
|
+
left [upper right] corner of the lower left [upper right] pixel of the
|
|
646
|
+
distorted image.. When users specify the distortion model, represented by an
|
|
647
|
+
instance of the class :class:`distoptica.DistortionModel`, they also specify
|
|
648
|
+
a coordinate transformation, :math:`\left(T_{⌑;x}\left(u_{x},u_{y}\right),
|
|
646
649
|
T_{⌑;y}\left(u_{x},u_{y}\right)\right)`, which maps a given coordinate pair
|
|
647
650
|
:math:`\left(u_{x},u_{y}\right)` to a corresponding coordinate pair
|
|
648
651
|
:math:`\left(q_{x},q_{y}\right)`, and implicitly a right-inverse to said
|
|
@@ -867,7 +870,18 @@ class CBEDPattern(fancytypes.PreSerializableAndUpdatable):
|
|
|
867
870
|
\end{cases}
|
|
868
871
|
:label: LD_I_MF__1
|
|
869
872
|
|
|
870
|
-
4.
|
|
873
|
+
4. Calculate
|
|
874
|
+
|
|
875
|
+
.. math ::
|
|
876
|
+
\mathring{\mathcal{I}}_{\text{CBED};⌑;i,j}\leftarrow
|
|
877
|
+
\mathcal{I}_{\text{TDS}}\left(T_{\square;x}\left(
|
|
878
|
+
q_{\mathring{\mathcal{I}};x;j},
|
|
879
|
+
q_{\mathring{\mathcal{I}};y;i}\right),
|
|
880
|
+
T_{\square;y}\left(q_{\mathring{\mathcal{I}};x;j},
|
|
881
|
+
q_{\mathring{\mathcal{I}};y;i}\right)\right),
|
|
882
|
+
:label: HD_I_CBED__1
|
|
883
|
+
|
|
884
|
+
5. For :math:`0\le k<N_{\text{D}}`, calculate
|
|
871
885
|
|
|
872
886
|
.. math ::
|
|
873
887
|
\mathring{\mathcal{I}}_{\text{CBED};⌑;i,j}&
|
|
@@ -876,7 +890,7 @@ class CBEDPattern(fancytypes.PreSerializableAndUpdatable):
|
|
|
876
890
|
q_{\mathring{\mathcal{I}};x;j},q_{\mathring{\mathcal{I}};y;i}\right),
|
|
877
891
|
T_{\square;y}\left(q_{\mathring{\mathcal{I}};x;j},
|
|
878
892
|
q_{\mathring{\mathcal{I}};y;i}\right)\right),
|
|
879
|
-
:label:
|
|
893
|
+
:label: HD_I_CBED__2
|
|
880
894
|
|
|
881
895
|
.. math ::
|
|
882
896
|
\mathring{\mathcal{I}}_{k;\text{DS};⌑;i,j}\leftarrow
|
|
@@ -905,7 +919,7 @@ class CBEDPattern(fancytypes.PreSerializableAndUpdatable):
|
|
|
905
919
|
\mathcal{I}_{\text{DOM};⌑;n,m}+\mathcal{I}_{k;\text{DS};⌑;n,m}.
|
|
906
920
|
:label: LD_I_DOM__2
|
|
907
921
|
|
|
908
|
-
|
|
922
|
+
6. Calculate
|
|
909
923
|
|
|
910
924
|
.. math ::
|
|
911
925
|
\mathcal{I}_{\text{DOM};⌑;n,m}\leftarrow
|
|
@@ -914,7 +928,7 @@ class CBEDPattern(fancytypes.PreSerializableAndUpdatable):
|
|
|
914
928
|
\mathcal{I}_{\text{DOM};⌑;n,m}.
|
|
915
929
|
:label: LD_I_DOM__3
|
|
916
930
|
|
|
917
|
-
|
|
931
|
+
7. For :math:`0\le k<N_{\text{M}}`, calculate
|
|
918
932
|
|
|
919
933
|
.. math ::
|
|
920
934
|
\mathring{\mathcal{I}}_{\text{CBED};⌑;i,j}&
|
|
@@ -923,9 +937,9 @@ class CBEDPattern(fancytypes.PreSerializableAndUpdatable):
|
|
|
923
937
|
q_{\mathring{\mathcal{I}};x;j},q_{\mathring{\mathcal{I}};y;i}\right),
|
|
924
938
|
T_{\square;y}\left(q_{\mathring{\mathcal{I}};x;j},
|
|
925
939
|
q_{\mathring{\mathcal{I}};y;i}\right)\right).
|
|
926
|
-
:label:
|
|
940
|
+
:label: HD_I_CBED__3
|
|
927
941
|
|
|
928
|
-
|
|
942
|
+
8. Calculate
|
|
929
943
|
|
|
930
944
|
.. math ::
|
|
931
945
|
\mathring{\mathcal{I}}_{\text{CBED};⌑;i,j}\leftarrow
|
|
@@ -933,21 +947,21 @@ class CBEDPattern(fancytypes.PreSerializableAndUpdatable):
|
|
|
933
947
|
q_{\mathring{\mathcal{I}};x;j},
|
|
934
948
|
q_{\mathring{\mathcal{I}};y;i}\right)\right)
|
|
935
949
|
\left|\mathring{\mathcal{I}}_{\text{CBED};⌑;i,j}\right|.
|
|
936
|
-
:label:
|
|
950
|
+
:label: HD_I_CBED__4
|
|
937
951
|
|
|
938
|
-
|
|
952
|
+
9. Apply average pooling to
|
|
939
953
|
:math:`\mathring{\mathcal{I}}_{\text{CBED};⌑;i,j}` with a kernel of
|
|
940
954
|
dimensions :math:`\left(N_{\mathring{\mathcal{I}};y}/N_{\mathcal{I};y},
|
|
941
955
|
N_{\mathring{\mathcal{I}};x}/N_{\mathcal{I};x}\right)`, and store the result
|
|
942
956
|
in :math:`\mathcal{I}_{\text{CBED};⌑;n,m}`.
|
|
943
957
|
|
|
944
|
-
|
|
958
|
+
10. Apply a Gaussian filter to :math:`\mathcal{I}_{\text{CBED};⌑;n,m}` that
|
|
945
959
|
is identical in outcome to that implemented by the function
|
|
946
960
|
:func:`scipy.ndimage.gaussian_filter`, with ``sigma`` set to
|
|
947
961
|
``gaussian_filter_std_dev`` and ``truncate`` set to ``4``, and store the
|
|
948
962
|
result in :math:`\mathcal{I}_{\text{CBED};⌑;n,m}`.
|
|
949
963
|
|
|
950
|
-
|
|
964
|
+
11. Calculate
|
|
951
965
|
|
|
952
966
|
.. math ::
|
|
953
967
|
k_{\text{I};1}\leftarrow
|
|
@@ -961,18 +975,18 @@ class CBEDPattern(fancytypes.PreSerializableAndUpdatable):
|
|
|
961
975
|
k_{\text{I};2}\leftarrow k_{\text{I};1}+N_{\text{DPW}}-1.
|
|
962
976
|
:label: k_I_2__1
|
|
963
977
|
|
|
964
|
-
|
|
978
|
+
12. If ``apply_shot_noise`` is set to ``True``, then apply shot/Poisson
|
|
965
979
|
noise to :math:`\mathcal{I}_{\text{CBED};⌑;n,m}`, and store the result in
|
|
966
980
|
:math:`\mathcal{I}_{\text{CBED};⌑;n,m}`.
|
|
967
981
|
|
|
968
|
-
|
|
982
|
+
13. If :math:`N_{\text{DPW}}>0`, then inpaint the pixels in the rows indexed
|
|
969
983
|
from :math:`k_{\text{I};1}` to :math:`k_{\text{I};2}` and the columns
|
|
970
984
|
indexed from :math:`k_{\text{I};1}` to :math:`k_{\text{I};2}` of the image
|
|
971
985
|
:math:`\mathcal{I}_{\text{CBED};⌑;n,m}` using the function
|
|
972
986
|
:func:`skimage.restoration.inpaint_biharmonic`, and store the result in
|
|
973
987
|
:math:`\mathcal{I}_{\text{CBED};⌑;n,m}`.
|
|
974
988
|
|
|
975
|
-
|
|
989
|
+
14. Calculate
|
|
976
990
|
|
|
977
991
|
.. math ::
|
|
978
992
|
\mathcal{I}_{\text{CBED};⌑;n,m}\leftarrow
|
|
@@ -981,25 +995,25 @@ class CBEDPattern(fancytypes.PreSerializableAndUpdatable):
|
|
|
981
995
|
\mathcal{I}_{\text{CBED};⌑;n,m}.
|
|
982
996
|
:label: LD_I_CBED__1
|
|
983
997
|
|
|
984
|
-
|
|
998
|
+
15. Update pixels of :math:`\mathcal{I}_{\text{CBED};⌑;n,m}` at pixel
|
|
985
999
|
locations specified by ``cold_pixels`` to the value of zero.
|
|
986
1000
|
|
|
987
|
-
|
|
1001
|
+
16. Apply min-max normalization of :math:`\mathcal{I}_{\text{CBED};⌑;n,m}`,
|
|
988
1002
|
and store result in :math:`\mathcal{I}_{\text{CBED};⌑;n,m}`.
|
|
989
1003
|
|
|
990
|
-
|
|
1004
|
+
17. Calculate
|
|
991
1005
|
|
|
992
1006
|
.. math ::
|
|
993
1007
|
\mathcal{I}_{\text{CS};⌑;n,m}\leftarrow1
|
|
994
1008
|
-\mathcal{I}_{\text{MF};⌑;n,m}\mathcal{I}_{\text{OI};⌑;n,m}.
|
|
995
1009
|
:label: LD_I_CS__1
|
|
996
1010
|
|
|
997
|
-
|
|
1011
|
+
18. Convolve a :math:`3 \times 3` filter of ones over a symmetrically unity-padded
|
|
998
1012
|
:math:`\mathcal{I}_{\text{CS};⌑;n,m}` to yield an output matrix with the
|
|
999
1013
|
same dimensions of :math:`\mathcal{I}_{\text{CBED};⌑;n,m}`, and store said
|
|
1000
1014
|
output matrix in :math:`\mathcal{I}_{\text{CS};⌑;n,m}`.
|
|
1001
1015
|
|
|
1002
|
-
|
|
1016
|
+
19. For :math:`0\le k<N_{\text{D}}`, calculate
|
|
1003
1017
|
|
|
1004
1018
|
.. math ::
|
|
1005
1019
|
\mathcal{I}_{k;\text{DCM};⌑;n,m}\leftarrow
|
|
@@ -1008,8 +1022,8 @@ class CBEDPattern(fancytypes.PreSerializableAndUpdatable):
|
|
|
1008
1022
|
|
|
1009
1023
|
.. math ::
|
|
1010
1024
|
\Omega_{k;\text{DCR};⌑}\leftarrow\begin{cases}
|
|
1011
|
-
\text{True}, & \text{if }
|
|
1012
|
-
\
|
|
1025
|
+
\text{True}, & \text{if }\left.\left(\sum_{n,m}
|
|
1026
|
+
\mathcal{I}_{k;\text{DCM};⌑;n,m}\neq0\right)\right\Vert
|
|
1013
1027
|
\left(\sum_{n,m}\mathcal{I}_{k;\text{DS};⌑;n,m}=0\right),\\
|
|
1014
1028
|
\text{False}, & \text{otherwise},
|
|
1015
1029
|
\end{cases}
|
|
@@ -3493,8 +3507,8 @@ class CroppedCBEDPattern(fancytypes.PreSerializableAndUpdatable):
|
|
|
3493
3507
|
N_{\mathcal{I};x}=N_{\mathcal{I};y},
|
|
3494
3508
|
:label: N_I_x_eq_N_I_y__2
|
|
3495
3509
|
|
|
3496
|
-
Furthermore, let :math:`N_{\text{max-iter}}=30
|
|
3497
|
-
be ``disk_boundary_sample_size``.
|
|
3510
|
+
Furthermore, let :math:`N_{\text{max-iter}}=30`, and let
|
|
3511
|
+
:math:`N_{\text{SS}}` be ``disk_boundary_sample_size``.
|
|
3498
3512
|
|
|
3499
3513
|
Next, let :math:`\partial S_{\text{PDS};x;l}` and :math:`\partial
|
|
3500
3514
|
S_{\text{PDS};y;l}` denote
|
|
@@ -36,12 +36,16 @@ nonnegative.
|
|
|
36
36
|
|
|
37
37
|
Let :math:`u_{x}` and :math:`u_{y}` be the fractional horizontal and vertical
|
|
38
38
|
coordinates, respectively, of a point in an undistorted image, where
|
|
39
|
-
:math:`\left(u_{x},u_{y}\right)=\left(0,0\right)`
|
|
40
|
-
|
|
39
|
+
:math:`\left(u_{x},u_{y}\right)=\left(0,0\right)`
|
|
40
|
+
:math:`\left[\left(u_{x},u_{y}\right)=\left(1,1\right)\right]` is the lower left
|
|
41
|
+
[upper right] corner of the lower left [upper right] pixel of the undistorted
|
|
42
|
+
image. Secondly, let :math:`q_{x}` and :math:`q_{y}` be the fractional
|
|
41
43
|
horizontal and vertical coordinates, respectively, of a point in a distorted
|
|
42
|
-
image, where :math:`\left(q_{x},q_{y}\right)=\left(0,0\right)`
|
|
43
|
-
left
|
|
44
|
-
|
|
44
|
+
image, where :math:`\left(q_{x},q_{y}\right)=\left(0,0\right)`
|
|
45
|
+
:math:`\left[\left(q_{x},q_{y}\right)=\left(1,1\right)\right]` is the lower left
|
|
46
|
+
[upper right] corner of the lower left [upper right] pixel of the distorted
|
|
47
|
+
image. When users specify a distortion model, represented by an
|
|
48
|
+
:obj:`distoptica.DistortionModel` object, they also specify a coordinate
|
|
45
49
|
transformation which maps a given coordinate pair
|
|
46
50
|
:math:`\left(u_{x},u_{y}\right)` to a corresponding coordinate pair
|
|
47
51
|
:math:`\left(q_{x},q_{y}\right)`, and implicitly a right-inverse to said
|
|
@@ -277,10 +281,11 @@ class BaseShape(fancytypes.PreSerializableAndUpdatable):
|
|
|
277
281
|
r"""Evaluate the intensity pattern of the undistorted shape.
|
|
278
282
|
|
|
279
283
|
Let :math:`u_{x}` and :math:`u_{y}` be the fractional horizontal and
|
|
280
|
-
vertical coordinates, respectively, of a point in an undistorted image
|
|
281
|
-
|
|
282
|
-
:math:`\left(u_{x},u_{y}\right)=\left(
|
|
283
|
-
corner of
|
|
284
|
+
vertical coordinates, respectively, of a point in an undistorted image,
|
|
285
|
+
where :math:`\left(u_{x},u_{y}\right)=\left(0,0\right)`
|
|
286
|
+
:math:`\left[\left(u_{x},u_{y}\right)=\left(1,1\right)\right]` is the
|
|
287
|
+
lower left [upper right] corner of the lower left [upper right] pixel of
|
|
288
|
+
the undistorted image.
|
|
284
289
|
|
|
285
290
|
Parameters
|
|
286
291
|
----------
|
|
@@ -452,14 +457,23 @@ class Circle(BaseShape):
|
|
|
452
457
|
|
|
453
458
|
.. math ::
|
|
454
459
|
\mathcal{I}_{\text{C}}\left(u_{x},u_{y}\right)=
|
|
455
|
-
A_{\text{C}}\Theta\left(R_{\text{C}}
|
|
456
|
-
-\sqrt{\left(u_{x}-u_{x;c;\text{C}}\right)^{2}
|
|
457
|
-
+\left(u_{y}-u_{y;c;\text{C}}\right)^{2}}\right),
|
|
460
|
+
A_{\text{C}}\Theta\left(R_{\text{C}}-u_{r;\text{C}}\right),
|
|
458
461
|
:label: intensity_pattern_of_circle__1
|
|
459
462
|
|
|
460
463
|
where :math:`u_{x}` and :math:`u_{y}` are fractional horizontal and vertical
|
|
461
|
-
coordinates of the undistorted intensity pattern of the circle respectively
|
|
462
|
-
|
|
464
|
+
coordinates of the undistorted intensity pattern of the circle respectively;
|
|
465
|
+
:math:`\Theta\left(\cdots\right)` is the Heaviside step function; and
|
|
466
|
+
|
|
467
|
+
.. math ::
|
|
468
|
+
u_{r;\text{C}}=\sqrt{\left(u_{x}-u_{x;c;\text{C}}\right)^{2}
|
|
469
|
+
+\left(u_{y}-u_{y;c;\text{C}}\right)^{2}};
|
|
470
|
+
:label: u_r_C__1
|
|
471
|
+
|
|
472
|
+
By fractional coordinates, we mean that
|
|
473
|
+
:math:`\left(u_{x},u_{y}\right)=\left(0,0\right)`
|
|
474
|
+
:math:`\left[\left(u_{x},u_{y}\right)=\left(1,1\right)\right]` is the lower
|
|
475
|
+
left [upper right] corner of the lower left [upper right] pixel of an image
|
|
476
|
+
of the undistorted intensity pattern.
|
|
463
477
|
|
|
464
478
|
Parameters
|
|
465
479
|
----------
|
|
@@ -567,8 +581,10 @@ class Circle(BaseShape):
|
|
|
567
581
|
delta_u_y = u_y-u_y_c
|
|
568
582
|
|
|
569
583
|
u_r = torch.sqrt(delta_u_x*delta_u_x + delta_u_y*delta_u_y)
|
|
584
|
+
|
|
585
|
+
one = torch.tensor(1.0, device=u_r.device)
|
|
570
586
|
|
|
571
|
-
result = A * (u_r
|
|
587
|
+
result = A * torch.heaviside(R-u_r, one)
|
|
572
588
|
|
|
573
589
|
return result
|
|
574
590
|
|
|
@@ -670,27 +686,47 @@ class Ellipse(BaseShape):
|
|
|
670
686
|
|
|
671
687
|
.. math ::
|
|
672
688
|
\mathcal{I}_{\text{E}}\left(u_{x},u_{y}\right)=
|
|
673
|
-
A_{\text{E}}\Theta\left(
|
|
674
|
-
u_{
|
|
689
|
+
A_{\text{E}}\Theta\left(
|
|
690
|
+
R_{\text{E}}\left(u_{\theta;\text{E}}\right)-u_{r;\text{E}}\right),
|
|
675
691
|
:label: intensity_pattern_of_ellipse__1
|
|
676
692
|
|
|
677
693
|
where :math:`u_{x}` and :math:`u_{y}` are fractional horizontal and vertical
|
|
678
694
|
coordinates of the undistorted intensity pattern of the ellipse
|
|
679
|
-
respectively
|
|
680
|
-
function
|
|
695
|
+
respectively; :math:`\Theta\left(\cdots\right)` is the Heaviside step
|
|
696
|
+
function;
|
|
681
697
|
|
|
682
698
|
.. math ::
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
\
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
699
|
+
u_{r;\text{E}}=\sqrt{\left(u_{x}-u_{x;c;\text{E}}\right)^{2}
|
|
700
|
+
+\left(u_{y}-u_{y;c;\text{E}}\right)^{2}};
|
|
701
|
+
:label: u_r_E__1
|
|
702
|
+
|
|
703
|
+
.. math ::
|
|
704
|
+
u_{\theta;\text{E}}=
|
|
705
|
+
\tan^{-1}\left(\frac{u_{y}
|
|
706
|
+
-u_{y;c;\text{E}}}{u_{x}-u_{x;c;\text{E}}}\right);
|
|
707
|
+
:label: u_theta_E__1
|
|
708
|
+
|
|
709
|
+
and
|
|
710
|
+
|
|
711
|
+
.. math ::
|
|
712
|
+
R_{\text{E}}\left(u_{\theta;\text{E}}\right)=a_{\text{E}}
|
|
713
|
+
\sqrt{\frac{1-e_{\text{E}}^{2}}{1
|
|
714
|
+
-\left\{ e_{\text{E}}\cos\left(u_{\theta;\text{E}}
|
|
715
|
+
+\theta_{\text{E}}\right)\right\} ^{2}}}.
|
|
716
|
+
:label: R_E__1
|
|
717
|
+
|
|
718
|
+
By fractional coordinates, we mean that
|
|
719
|
+
:math:`\left(u_{x},u_{y}\right)=\left(0,0\right)`
|
|
720
|
+
:math:`\left[\left(u_{x},u_{y}\right)=\left(1,1\right)\right]` is the lower
|
|
721
|
+
left [upper right] corner of the lower left [upper right] pixel of an image
|
|
722
|
+
of the undistorted intensity pattern.
|
|
723
|
+
|
|
724
|
+
Note that if :math:`\theta_{\text{E}}=0`, then the longest chord of the
|
|
725
|
+
ellipse is horizontal. Let us refer to this ellipse with
|
|
726
|
+
:math:`\theta_{\text{E}}=0` as the "reference shape". If
|
|
727
|
+
:math:`\theta_{\text{E}} \neq 0`, then the ellipse is equal to the reference
|
|
728
|
+
shape after rotating the latter shape clockwise by :math:`\theta_{\text{E}}`
|
|
729
|
+
about its center.
|
|
694
730
|
|
|
695
731
|
Parameters
|
|
696
732
|
----------
|
|
@@ -802,42 +838,33 @@ class Ellipse(BaseShape):
|
|
|
802
838
|
|
|
803
839
|
|
|
804
840
|
def _eval(self, u_x, u_y):
|
|
805
|
-
A = self._intra_shape_val
|
|
806
|
-
support_arg = self._calc_support_arg(u_x, u_y)
|
|
807
|
-
one = torch.tensor(1.0, device=support_arg.device)
|
|
808
|
-
result = A * torch.heaviside(support_arg, one)
|
|
809
|
-
|
|
810
|
-
return result
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
def _calc_support_arg(self, u_x, u_y):
|
|
815
841
|
u_x_c, u_y_c = self._center
|
|
816
842
|
a = self._semi_major_axis
|
|
817
843
|
e = self._eccentricity
|
|
818
|
-
|
|
844
|
+
rotation_angle = self._rotation_angle
|
|
845
|
+
A = self._intra_shape_val
|
|
819
846
|
|
|
820
847
|
delta_u_x = u_x-u_x_c
|
|
821
848
|
delta_u_y = u_y-u_y_c
|
|
822
849
|
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
850
|
+
u_r = torch.sqrt(delta_u_x*delta_u_x + delta_u_y*delta_u_y)
|
|
851
|
+
u_theta = torch.atan2(delta_u_y, delta_u_x) % (2*np.pi)
|
|
852
|
+
|
|
853
|
+
theta = torch.tensor(rotation_angle, dtype=u_r.dtype)
|
|
854
|
+
|
|
855
|
+
u_theta_shifted = u_theta + theta
|
|
856
|
+
cos_u_theta_shifted = torch.cos(u_theta_shifted)
|
|
826
857
|
|
|
827
|
-
|
|
828
|
-
sin_theta = torch.sin(theta)
|
|
858
|
+
e_sq = e*e
|
|
829
859
|
|
|
830
|
-
|
|
831
|
-
|
|
860
|
+
R = a * torch.sqrt((1 - e_sq)
|
|
861
|
+
/ (1 - e_sq*cos_u_theta_shifted*cos_u_theta_shifted))
|
|
832
862
|
|
|
833
|
-
|
|
834
|
-
delta_u_y_prime_sq = delta_u_y_prime*delta_u_y_prime
|
|
863
|
+
one = torch.tensor(1.0, device=u_theta.device)
|
|
835
864
|
|
|
836
|
-
|
|
837
|
-
- (b_sq/a_sq)*delta_u_x_prime_sq
|
|
838
|
-
- delta_u_y_prime_sq)
|
|
865
|
+
result = A * torch.heaviside(R-u_r, one)
|
|
839
866
|
|
|
840
|
-
return
|
|
867
|
+
return result
|
|
841
868
|
|
|
842
869
|
|
|
843
870
|
|
|
@@ -945,7 +972,7 @@ class Peak(BaseShape):
|
|
|
945
972
|
:label: intensity_pattern_of_peak__1
|
|
946
973
|
|
|
947
974
|
where :math:`u_{x}` and :math:`u_{y}` are fractional horizontal and vertical
|
|
948
|
-
coordinates of the undistorted intensity pattern of the peak respectively
|
|
975
|
+
coordinates of the undistorted intensity pattern of the peak respectively;
|
|
949
976
|
|
|
950
977
|
.. math ::
|
|
951
978
|
F_{\beta;\text{P}}\left(\omega\right)=\begin{cases}
|
|
@@ -987,6 +1014,12 @@ class Peak(BaseShape):
|
|
|
987
1014
|
|
|
988
1015
|
with :math:`\Theta\left(\cdots\right)` being the Heaviside step function.
|
|
989
1016
|
|
|
1017
|
+
By fractional coordinates, we mean that
|
|
1018
|
+
:math:`\left(u_{x},u_{y}\right)=\left(0,0\right)`
|
|
1019
|
+
:math:`\left[\left(u_{x},u_{y}\right)=\left(1,1\right)\right]` is the lower
|
|
1020
|
+
left [upper right] corner of the lower left [upper right] pixel of an image
|
|
1021
|
+
of the undistorted intensity pattern.
|
|
1022
|
+
|
|
990
1023
|
Parameters
|
|
991
1024
|
----------
|
|
992
1025
|
center : `array_like` (`float`, shape=(``2``,)), optional
|
|
@@ -1298,7 +1331,7 @@ class Band(BaseShape):
|
|
|
1298
1331
|
:label: intensity_pattern_of_band__1
|
|
1299
1332
|
|
|
1300
1333
|
where :math:`u_{x}` and :math:`u_{y}` are fractional horizontal and vertical
|
|
1301
|
-
coordinates of the undistorted intensity pattern of the band respectively
|
|
1334
|
+
coordinates of the undistorted intensity pattern of the band respectively;
|
|
1302
1335
|
|
|
1303
1336
|
.. math ::
|
|
1304
1337
|
\Theta\left(\omega\right)=\begin{cases}
|
|
@@ -1316,7 +1349,7 @@ class Band(BaseShape):
|
|
|
1316
1349
|
.. math ::
|
|
1317
1350
|
d_{\text{B};1}\left(u_{x},u_{y}\right)=
|
|
1318
1351
|
\frac{a_{\text{B};1}u_{x}+b_{\text{B};1}u_{y}
|
|
1319
|
-
+c_{\text{B};1}}{\sqrt{a_{\text{B};1}^{2}+b_{\text{B};1}^{2}}}
|
|
1352
|
+
+c_{\text{B};1}}{\sqrt{a_{\text{B};1}^{2}+b_{\text{B};1}^{2}}},
|
|
1320
1353
|
:label: d_1_of_band__1
|
|
1321
1354
|
|
|
1322
1355
|
with
|
|
@@ -1400,6 +1433,12 @@ class Band(BaseShape):
|
|
|
1400
1433
|
\end{cases}
|
|
1401
1434
|
:label: c_2_of_band__1
|
|
1402
1435
|
|
|
1436
|
+
By fractional coordinates, we mean that
|
|
1437
|
+
:math:`\left(u_{x},u_{y}\right)=\left(0,0\right)`
|
|
1438
|
+
:math:`\left[\left(u_{x},u_{y}\right)=\left(1,1\right)\right]` is the lower
|
|
1439
|
+
left [upper right] corner of the lower left [upper right] pixel of an image
|
|
1440
|
+
of the undistorted intensity pattern.
|
|
1441
|
+
|
|
1403
1442
|
Parameters
|
|
1404
1443
|
----------
|
|
1405
1444
|
end_pt_1 : `array_like` (`float`, shape=(``2``,)), optional
|
|
@@ -1697,11 +1736,11 @@ class PlaneWave(BaseShape):
|
|
|
1697
1736
|
|
|
1698
1737
|
where :math:`u_{x}` and :math:`u_{y}` are fractional horizontal and vertical
|
|
1699
1738
|
coordinates of the undistorted intensity pattern of the plane wave
|
|
1700
|
-
respectively
|
|
1739
|
+
respectively;
|
|
1701
1740
|
|
|
1702
1741
|
.. math ::
|
|
1703
1742
|
k_{x;\text{PW}}=\frac{2\pi}{\lambda_{\text{PW}}}
|
|
1704
|
-
\cos\left(\theta_{\text{PW}}\right)
|
|
1743
|
+
\cos\left(\theta_{\text{PW}}\right);
|
|
1705
1744
|
:label: k_x_of_plane_wave__1
|
|
1706
1745
|
|
|
1707
1746
|
and
|
|
@@ -1711,6 +1750,12 @@ class PlaneWave(BaseShape):
|
|
|
1711
1750
|
\sin\left(\theta_{\text{PW}}\right).
|
|
1712
1751
|
:label: k_y_of_plane_wave__1
|
|
1713
1752
|
|
|
1753
|
+
By fractional coordinates, we mean that
|
|
1754
|
+
:math:`\left(u_{x},u_{y}\right)=\left(0,0\right)`
|
|
1755
|
+
:math:`\left[\left(u_{x},u_{y}\right)=\left(1,1\right)\right]` is the lower
|
|
1756
|
+
left [upper right] corner of the lower left [upper right] pixel of an image
|
|
1757
|
+
of the undistorted intensity pattern.
|
|
1758
|
+
|
|
1714
1759
|
Parameters
|
|
1715
1760
|
----------
|
|
1716
1761
|
amplitude : `float`, optional
|
|
@@ -1944,12 +1989,12 @@ class Arc(BaseShape):
|
|
|
1944
1989
|
|
|
1945
1990
|
where :math:`u_{x}` and :math:`u_{y}` are fractional horizontal and vertical
|
|
1946
1991
|
coordinates of the undistorted intensity pattern of the circular arc
|
|
1947
|
-
respectively
|
|
1948
|
-
function
|
|
1992
|
+
respectively; :math:`\Theta\left(\cdots\right)` is the Heaviside step
|
|
1993
|
+
function;
|
|
1949
1994
|
|
|
1950
1995
|
.. math ::
|
|
1951
1996
|
u_{r;\text{A}}=\sqrt{\left(u_{x}-u_{x;c;\text{A}}\right)^{2}
|
|
1952
|
-
+\left(u_{y}-u_{y;c;\text{A}}\right)^{2}}
|
|
1997
|
+
+\left(u_{y}-u_{y;c;\text{A}}\right)^{2}};
|
|
1953
1998
|
:label: u_r_UA__1
|
|
1954
1999
|
|
|
1955
2000
|
and
|
|
@@ -1960,6 +2005,12 @@ class Arc(BaseShape):
|
|
|
1960
2005
|
-\theta_{\text{A}}\right\} \mod 2\pi.
|
|
1961
2006
|
:label: u_theta_UA__1
|
|
1962
2007
|
|
|
2008
|
+
By fractional coordinates, we mean that
|
|
2009
|
+
:math:`\left(u_{x},u_{y}\right)=\left(0,0\right)`
|
|
2010
|
+
:math:`\left[\left(u_{x},u_{y}\right)=\left(1,1\right)\right]` is the lower
|
|
2011
|
+
left [upper right] corner of the lower left [upper right] pixel of an image
|
|
2012
|
+
of the undistorted intensity pattern.
|
|
2013
|
+
|
|
1963
2014
|
Parameters
|
|
1964
2015
|
----------
|
|
1965
2016
|
center : `array_like` (`float`, shape=(``2``,)), optional
|
|
@@ -2218,24 +2269,24 @@ class GenericBlob(BaseShape):
|
|
|
2218
2269
|
.. math ::
|
|
2219
2270
|
\mathcal{I}_{\text{GB}}\left(u_{x},u_{y}\right)=
|
|
2220
2271
|
A_{\text{GB}}\Theta\left(
|
|
2221
|
-
R_{\text{GB}}\left(u_{\theta;\text{
|
|
2272
|
+
R_{\text{GB}}\left(u_{\theta;\text{GB}}\right)-u_{r;\text{GB}}\right),
|
|
2222
2273
|
:label: intensity_pattern_of_generic_blob__1
|
|
2223
2274
|
|
|
2224
2275
|
where :math:`u_{x}` and :math:`u_{y}` are fractional horizontal and vertical
|
|
2225
2276
|
coordinates of the undistorted intensity pattern of the generic blob
|
|
2226
|
-
respectively
|
|
2227
|
-
function
|
|
2277
|
+
respectively; :math:`\Theta\left(\cdots\right)` is the Heaviside step
|
|
2278
|
+
function;
|
|
2228
2279
|
|
|
2229
2280
|
.. math ::
|
|
2230
2281
|
u_{r;\text{GB}}=\sqrt{\left(u_{x}-u_{x;c;\text{GB}}\right)^{2}
|
|
2231
2282
|
+\left(u_{y}-u_{y;c;\text{GB}}\right)^{2}};
|
|
2232
|
-
:label:
|
|
2283
|
+
:label: u_r_GB__1
|
|
2233
2284
|
|
|
2234
2285
|
.. math ::
|
|
2235
2286
|
u_{\theta;\text{GB}}=
|
|
2236
2287
|
\tan^{-1}\left(\frac{u_{y}
|
|
2237
2288
|
-u_{y;c;\text{GB}}}{u_{x}-u_{x;c;\text{GB}}}\right);
|
|
2238
|
-
:label:
|
|
2289
|
+
:label: u_theta_GB__1
|
|
2239
2290
|
|
|
2240
2291
|
and
|
|
2241
2292
|
|
|
@@ -2244,20 +2295,26 @@ class GenericBlob(BaseShape):
|
|
|
2244
2295
|
D_{\text{GB};0}\\&\quad\mathop{+}\min\left(1,N_{\text{GB}}\right)
|
|
2245
2296
|
\sum_{n=1}^{N_{\text{GB}}}D_{\text{GB};n}
|
|
2246
2297
|
\cos\left(nu_{\theta;\text{GB}}-\phi_{\text{GB};n-1}\right),
|
|
2247
|
-
:label:
|
|
2298
|
+
:label: R_GB__1
|
|
2248
2299
|
|
|
2249
2300
|
with
|
|
2250
2301
|
|
|
2251
2302
|
.. math ::
|
|
2252
2303
|
D_{\text{GB};n} \ge 0,
|
|
2253
2304
|
\quad\forall n\in\left\{ 1,\ldots,N_{\text{GB}}\right\},
|
|
2254
|
-
:label:
|
|
2305
|
+
:label: D_GB_n__1
|
|
2255
2306
|
|
|
2256
2307
|
and
|
|
2257
2308
|
|
|
2258
2309
|
.. math ::
|
|
2259
2310
|
D_{\text{GB};0}>\sum_{n=1}^{N_{\text{GB}}}D_{\text{GB};n}.
|
|
2260
|
-
:label:
|
|
2311
|
+
:label: D_GB_n__2
|
|
2312
|
+
|
|
2313
|
+
By fractional coordinates, we mean that
|
|
2314
|
+
:math:`\left(u_{x},u_{y}\right)=\left(0,0\right)`
|
|
2315
|
+
:math:`\left[\left(u_{x},u_{y}\right)=\left(1,1\right)\right]` is the lower
|
|
2316
|
+
left [upper right] corner of the lower left [upper right] pixel of an image
|
|
2317
|
+
of the undistorted intensity pattern.
|
|
2261
2318
|
|
|
2262
2319
|
Parameters
|
|
2263
2320
|
----------
|
|
@@ -2377,12 +2434,12 @@ class GenericBlob(BaseShape):
|
|
|
2377
2434
|
|
|
2378
2435
|
N = len(phi)
|
|
2379
2436
|
|
|
2380
|
-
one = torch.tensor(1.0, device=u_x.device)
|
|
2381
|
-
|
|
2382
2437
|
R = D[0]*torch.ones_like(u_theta)
|
|
2383
2438
|
for n in range(1, N+1):
|
|
2384
2439
|
R += D[n]*torch.cos(n*u_theta - phi[n-1])
|
|
2385
2440
|
|
|
2441
|
+
one = torch.tensor(1.0, device=u_r.device)
|
|
2442
|
+
|
|
2386
2443
|
result = A * torch.heaviside(R-u_r, one)
|
|
2387
2444
|
|
|
2388
2445
|
return result
|
|
@@ -2555,11 +2612,11 @@ class Orbital(BaseShape):
|
|
|
2555
2612
|
|
|
2556
2613
|
where :math:`u_{x}` and :math:`u_{y}` are fractional horizontal and vertical
|
|
2557
2614
|
coordinates of the undistorted intensity pattern of the orbital
|
|
2558
|
-
respectively
|
|
2615
|
+
respectively;
|
|
2559
2616
|
|
|
2560
2617
|
.. math ::
|
|
2561
2618
|
u_{r;\text{O}}=\sqrt{\left(u_{x}-u_{x;c;\text{O}}\right)^{2}
|
|
2562
|
-
+\left(u_{y}-u_{y;c;\text{O}}\right)^{2}}
|
|
2619
|
+
+\left(u_{y}-u_{y;c;\text{O}}\right)^{2}};
|
|
2563
2620
|
:label: u_r_O__1
|
|
2564
2621
|
|
|
2565
2622
|
.. math ::
|
|
@@ -2594,6 +2651,12 @@ class Orbital(BaseShape):
|
|
|
2594
2651
|
u_{\phi;\text{O}}\right)` is the spherical harmonic function of degree
|
|
2595
2652
|
:math:`l_{\text{O}}` and order :math:`m_{\text{O}}`.
|
|
2596
2653
|
|
|
2654
|
+
By fractional coordinates, we mean that
|
|
2655
|
+
:math:`\left(u_{x},u_{y}\right)=\left(0,0\right)`
|
|
2656
|
+
:math:`\left[\left(u_{x},u_{y}\right)=\left(1,1\right)\right]` is the lower
|
|
2657
|
+
left [upper right] corner of the lower left [upper right] pixel of an image
|
|
2658
|
+
of the undistorted intensity pattern.
|
|
2659
|
+
|
|
2597
2660
|
Parameters
|
|
2598
2661
|
----------
|
|
2599
2662
|
center : `array_like` (`float`, shape=(``2``,)), optional
|
|
@@ -3037,6 +3100,12 @@ class Lune(BaseShape):
|
|
|
3037
3100
|
where :math:`u_{x}` and :math:`u_{y}` are fractional horizontal and vertical
|
|
3038
3101
|
coordinates of the undistorted intensity pattern of the lune respectively.
|
|
3039
3102
|
|
|
3103
|
+
By fractional coordinates, we mean that
|
|
3104
|
+
:math:`\left(u_{x},u_{y}\right)=\left(0,0\right)`
|
|
3105
|
+
:math:`\left[\left(u_{x},u_{y}\right)=\left(1,1\right)\right]` is the lower
|
|
3106
|
+
left [upper right] corner of the lower left [upper right] pixel of an image
|
|
3107
|
+
of the undistorted intensity pattern.
|
|
3108
|
+
|
|
3040
3109
|
Parameters
|
|
3041
3110
|
----------
|
|
3042
3111
|
bg_ellipse : :class:`fakecbed.shapes.Circle` | :class:`fakecbed.shapes.Ellipse` | `None`, optional
|
|
@@ -3293,6 +3362,12 @@ class NonuniformBoundedShape(BaseShape):
|
|
|
3293
3362
|
coordinates of the undistorted intensity pattern of the nonuniform bounded
|
|
3294
3363
|
shape respectively.
|
|
3295
3364
|
|
|
3365
|
+
By fractional coordinates, we mean that
|
|
3366
|
+
:math:`\left(u_{x},u_{y}\right)=\left(0,0\right)`
|
|
3367
|
+
:math:`\left[\left(u_{x},u_{y}\right)=\left(1,1\right)\right]` is the lower
|
|
3368
|
+
left [upper right] corner of the lower left [upper right] pixel of an image
|
|
3369
|
+
of the undistorted intensity pattern.
|
|
3370
|
+
|
|
3296
3371
|
Parameters
|
|
3297
3372
|
----------
|
|
3298
3373
|
support : :class:`fakecbed.shapes.Circle` | :class:`fakecbed.shapes.Ellipse` | :class:`fakecbed.shapes.Band` | :class:`fakecbed.shapes.Arc` | :class:`fakecbed.shapes.GenericBlob` | :class:`fakecbed.shapes.Lune` | `None`, optional
|
|
@@ -142,6 +142,12 @@ class Model(fakecbed.shapes.BaseShape):
|
|
|
142
142
|
coordinates of the undistorted intensity pattern of the TDS model
|
|
143
143
|
respectively.
|
|
144
144
|
|
|
145
|
+
By fractional coordinates, we mean that
|
|
146
|
+
:math:`\left(u_{x},u_{y}\right)=\left(0,0\right)`
|
|
147
|
+
:math:`\left[\left(u_{x},u_{y}\right)=\left(1,1\right)\right]` is the lower
|
|
148
|
+
left [upper right] corner of the lower left [upper right] pixel of an image
|
|
149
|
+
of the undistorted intensity pattern.
|
|
150
|
+
|
|
145
151
|
Parameters
|
|
146
152
|
----------
|
|
147
153
|
peaks : `array_like` (`fakecbed.shapes.Peak`, ndim=1), optional
|
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.5.
|
|
32
|
-
__version_tuple__ = version_tuple = (0, 5,
|
|
31
|
+
__version__ = version = '0.5.3'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 5, 3)
|
|
33
33
|
|
|
34
|
-
__commit_id__ = commit_id = '
|
|
34
|
+
__commit_id__ = commit_id = 'gdd6869a60'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fakecbed
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.3
|
|
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
|
|
@@ -46,6 +46,7 @@ Dynamic: license-file
|
|
|
46
46
|
[](https://pypi.org/project/fakecbed)
|
|
47
47
|
[](https://anaconda.org/conda-forge/fakecbed)
|
|
48
48
|
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
49
|
+
[](https://doi.org/10.5281/zenodo.18297325)
|
|
49
50
|
|
|
50
51
|
`fakecbed` is a Python library for generating quickly images that imitate
|
|
51
52
|
convergent beam electron diffraction patterns.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|