Commit 55ebc4c5 authored by Julia Garriga Ferrer's avatar Julia Garriga Ferrer
Browse files

[core][mapping] Cast to float64 for applying median filter

parent 6f00f61b
......@@ -26,7 +26,7 @@
__authors__ = ["J. Garriga"]
__license__ = "MIT"
__date__ = "22/02/2020"
__date__ = "27/05/2021"
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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment