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
55ebc4c5
Commit
55ebc4c5
authored
May 27, 2021
by
Julia Garriga Ferrer
Browse files
[core][mapping] Cast to float64 for applying median filter
parent
6f00f61b
Changes
1
Hide whitespace changes
Inline
Side-by-side
darfix/core/mapping.py
View file @
55ebc4c5
...
...
@@ -26,7 +26,7 @@
__authors__
=
[
"J. Garriga"
]
__license__
=
"MIT"
__date__
=
"2
2
/0
2
/202
0
"
__date__
=
"2
7
/0
5
/202
1
"
import
numpy
try
:
...
...
@@ -138,11 +138,11 @@ def compute_moments(values, data):
stack
=
[
values
[
i
]
*
data
[
i
]
for
i
in
range
(
len
(
data
))]
zsum
=
numpy
.
sum
(
data
,
axis
=
0
)
com
=
numpy
.
sum
(
stack
,
axis
=
0
)
/
zsum
com
=
medfilt2d
(
com
)
com
=
medfilt2d
(
com
.
astype
(
numpy
.
float64
)
)
com
[
numpy
.
isnan
(
com
)]
=
numpy
.
min
(
com
[
~
numpy
.
isnan
(
com
)])
repeat_values
=
numpy
.
repeat
(
values
,
com
.
shape
[
0
]
*
com
.
shape
[
1
]).
reshape
(
len
(
values
),
com
.
shape
[
0
],
com
.
shape
[
1
])
std
=
numpy
.
sqrt
(
numpy
.
sum
((
data
[
i
]
*
((
repeat_values
[
i
]
-
com
)
**
2
)
for
i
in
range
(
len
(
data
))),
axis
=
0
))
/
zsum
std
=
medfilt2d
(
std
)
std
=
medfilt2d
(
std
.
astype
(
numpy
.
float64
)
)
std
[
numpy
.
isnan
(
std
)]
=
numpy
.
min
(
std
[
~
numpy
.
isnan
(
std
)])
skews
=
skew
(
stack
,
axis
=
0
)
kurt
=
kurtosis
(
stack
,
axis
=
0
)
...
...
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