Commit 4138114f authored by Thomas Vincent's avatar Thomas Vincent

normalize with min value only if qspace is normalized

parent 66ab9ba8
......@@ -29,6 +29,7 @@ __authors__ = ["D. Naudet"]
__license__ = "MIT"
__date__ = "15/09/2016"
import logging
import os
import numpy as np
......@@ -49,6 +50,8 @@ from ..process.FitWidget import FitWidget
from ..Utils import nextFileName
_logger = logging.getLogger(__name__)
class PlotIntensityMap(XsocsPlot2D):
"""Plot intensities as a scatter plot
......@@ -260,7 +263,7 @@ class QSpaceView(Qt.QMainWindow):
self.__qy = qspaceH5.qy
self.__qz = qspaceH5.qz
self.__histo = qspaceH5.histo
self.__mask = self.__histo>0
self.__mask = self.__histo > 0
firstX = sampleX[0]
firstY = sampleY[0]
......@@ -446,11 +449,16 @@ class QSpaceView(Qt.QMainWindow):
qspace = qspaceH5.qspace_slice(idx)
histo = self.__histo
mask = self.__mask
# Normalize values with histogram counts
qspace[mask] /= histo[mask]
# TODO what is that (__minVal?)? + not updated when changing qspace
if not hasattr(self, "__minVal"):
self.__minVal = qspace[mask*(qspace>0)].min()
qspace /= self.__minVal
# When QSpace was computed with normalized value,
# Normalize values with min
# to get a value in the range of "photon count"
if qspaceH5.image_normalizer:
_logger.info("Normalize displayed values with the minimum")
qspace /= np.nanmin(qspace[np.logical_and(mask, qspace > 0)])
# Set scale and translation
# Do it before setting data as corresponding
......
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