Commit 9ce59720 authored by Caillat Michel's avatar Caillat Michel
Browse files

Keep trying to fix the contour measurements problems

parent ef7a8b4b
......@@ -1123,7 +1123,8 @@ class DataBlock:
# Produce the contours.
features = []
fig, ax = pp.subplots()
CS = ax.contour(np.arange(slice.shape[1]), np.arange(slice.shape[0]), slice, levels)
#CS = ax.contour(np.arange(slice.shape[1]), np.arange(slice.shape[0]), slice, levels)
CS = ax.contour(slice, levels)
for level, set in zip(CS.levels, CS.allsegs):
......@@ -1152,16 +1153,14 @@ class DataBlock:
if theMask[j][i] :
numpix += 1
self.__logger.debug("numpix = %d" % numpix)
result = {}
result["sum"] = np.nansum(slice[theMask]).item()
result["min"] = np.nanmin(slice[theMask]).item()
result["max"] = np.nanmax(slice[theMask]).item()
result["mean"] = np.nanmean(slice[theMask]).item()
result["var"] = np.nanvar(slice[theMask]).item()
result["sum"] = "%11.4g" % (np.nansum(slice[theMask]).item() / self.__convert * self.__cdelt);
result["min"] = "%11.4g" % (np.nanmin(slice[theMask]).item())
result["max"] = "%11.4g" % (np.nanmax(slice[theMask]).item())
result["mean"] = "%11.4g" % (np.nanmean(slice[theMask]).item())
result["var"] = "%11.4g" % (np.nanvar(slice[theMask]).item())
result["numpix"] = numpix
result["percent"] = numpix / (shape[0]*shape[1]) * 100
result["percent"] = "%9.2g" % (numpix / (shape[0]*shape[1]) * 100)
result["boundingRect"] = cv2.boundingRect(contour)
result = {"status":True, "message":"", "result":result}
......
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