Commit e94f6181 authored by Caillat Michel's avatar Caillat Michel
Browse files

Improvements, debugging

parent d77344b2
......@@ -623,21 +623,31 @@ class DataBlock:
def getSlice(self, sliceNumb, step):
self.__logger.debug("getSlice: entering")
self.__logger.debug( "Getting slice: %d of %s with shape %r" % (sliceNumb, self.__relFITSFilePath, self.__data.shape))
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:
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
result["status"]=True
result["message"]=""
result["result"]=x.tolist()
except Exception as e:
result["message"]=f"An exception occurred with message {e}"
result["status"]= False
result["result"]=None
result = None
if numDimensions == 2:
result = self.__data[0:self.__data.shape[0]:step, 0:self.__data.shape[1]:step]
elif numDimensions == 3:
result = self.__data[sliceNumb, 0:self.__data.shape[1]:step, 0:self.__data.shape[2]:step]
else:
self.__logger.debug("Can't process data with such a shape: %r" % self.__data.shape);
result[np.isnan(result)] = None
self.__logger.debug("getSlice: exiting")
return {"status": True, "message": "", "result": result.tolist()}
return result
def getFreq(self, x=None, y=None, startZ=None, endZ=None):
# y x ou x y
......
......@@ -190,9 +190,10 @@ class DataManagerImpl :
def getSlice(self, sliceNumb, step, relFITSFilePath):
self.__logger.debug("getSlice : entering")
result = self.__checkPresence(relFITSFilePath)
if result["status"]:
result = self.__dataBlocks[relFITSFilePath].getSlice(sliceNumb, step)
self.__logger.debug("getSlice : entering")
self.__logger.debug("getSlice : exiting")
return result
def getFreq(self, relFITSFilePath, x=None, y=None, startZ=None, endZ=None):
......
......@@ -251,7 +251,7 @@ def getPixelValueAtiFreqiRAiDEC():
def getSlice():
logger.debug("getSlice - wrapper : entering" )
relFITSFilePath = rebuildFilename(request.GET['fileName'])
relFITSFilePath = rebuildFilename(request.GET['relFITSFilePath'])
sessionID = request.GET['sessionID']
sliceNumb = int(request.GET['sliceNumb'])
step = int(request.GET['step'])
......
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