Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
XRD
darfix
Commits
a55d83d5
Commit
a55d83d5
authored
Jun 04, 2021
by
Julia Garriga Ferrer
Browse files
[core][mapping] Add functions for computing rsm and magnification axes transformations
parent
31386782
Changes
1
Hide whitespace changes
Inline
Side-by-side
darfix/core/mapping.py
View file @
a55d83d5
...
...
@@ -26,7 +26,7 @@
__authors__
=
[
"J. Garriga"
]
__license__
=
"MIT"
__date__
=
"
27
/0
5
/2021"
__date__
=
"
04
/0
6
/2021"
import
numpy
try
:
...
...
@@ -148,3 +148,25 @@ def compute_moments(values, data):
kurt
=
kurtosis
(
stack
,
axis
=
0
)
return
com
,
std
,
skews
,
kurt
def
compute_rsm
(
H
,
W
,
d
,
ffz
,
mainx
):
pix_arr
=
numpy
.
meshgrid
(
numpy
.
arange
(
H
),
numpy
.
arange
(
W
))
pix_arr
[
0
]
=
(
pix_arr
[
0
]
-
W
/
2
)
*
d
pix_arr
[
1
]
=
(
H
/
2
-
pix_arr
[
1
])
*
d
pix_arr
[
0
]
=
numpy
.
arctan2
((
ffz
-
W
/
2
)
*
pix_arr
[
0
],
mainx
)
pix_arr
[
1
]
=
numpy
.
arctan2
(
pix_arr
[
1
],
numpy
.
sqrt
(
ffz
*
ffz
+
mainx
*
mainx
))
return
pix_arr
def
compute_magnification
(
H
,
W
,
d
,
obx
,
obpitch
,
mainx
):
pix_arr
=
numpy
.
meshgrid
(
numpy
.
arange
(
H
),
numpy
.
arange
(
W
))
d1
=
obx
/
numpy
.
cos
(
obpitch
)
d2
=
mainx
/
numpy
.
cos
(
obpitch
)
-
d1
M
=
d2
/
d1
d
/=
M
pix_arr
[
0
]
=
(
pix_arr
[
0
]
-
W
/
2
)
*
d
pix_arr
[
1
]
=
(
H
/
2
-
pix_arr
[
1
])
*
d
return
pix_arr
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment