Commit 0d97d049 authored by Caillat Michel's avatar Caillat Michel
Browse files

Finally could apply a boolean slice on the slice performed by getSlice

parent 927a4df1
......@@ -626,18 +626,26 @@ class DataBlock:
self.__logger.debug( "getting slice: %d of %s with shape %r" % (sliceNumb, self.__relFITSFilePath, self.__data.shape))
numDimensions = len(self.__data.shape)
result = dict()
try :
if numDimensions > 3 or numDimensions < 2:
message = f"Can't process data with such a shape: {self.__data.shape}"
result["status"]=False
result["message"]= message
else:
x = None
if numDimensions == 2:
x = self.__data[0:self.__data.shape[0]:step, 0:self.__data.shape[1]:step]
elif numDimensions == 3:
x = self.__data[sliceNumb, 0:self.__data.shape[1]:step, 0:self.__data.shape[2]:step]
self.__logger.debug(f"shape of x = {x.shape}, type of x = {type(x)}")
x[da.isnan(x)] = None
self.__logger.debug(f"type self.__data = {type(self.__data)}, type x = {type(x)}")
self.__logger.debug("Avant isnan")
self.__logger.debug(x.shape)
x = x.compute()
b = np.isnan(x)
self.__logger.debug(b.shape)
x[b]=None
self.__logger.debug("Apres isnan")
result["status"]=True
result["message"]=""
result["result"]=x.tolist()
......
Supports Markdown
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