Commit 7734c79f authored by Thomas Vincent's avatar Thomas Vincent

Remove use of fit axes type

parent b7de02ac
......@@ -33,7 +33,7 @@ import numpy as np
from silx.gui import qt as Qt
from ....io.FitH5 import FitH5, FitH5QAxis
from ....io.FitH5 import FitH5
from ....process.fit import FitStatus
from ...widgets.XsocsPlot2D import XsocsPlot2D
......@@ -87,6 +87,7 @@ class DropPlotWidget(XsocsPlot2D):
with FitH5(fitH5Name) as h5f:
data = h5f.get_axis_result(entry, process, result, q_axis)
scan_x, scan_y = h5f.sample_positions(entry)
axis_name = h5f.get_qspace_dimension_names(entry)[q_axis]
xBorder = np.array([scan_x.min(), scan_x.max()])
yBorder = np.array([scan_y.min(), scan_y.max()])
......@@ -99,10 +100,11 @@ class DropPlotWidget(XsocsPlot2D):
z=-1)
self.__legend = self.setPlotData(scan_x, scan_y, data)
self.setGraphTitle(result + '[' + FitH5QAxis.axis_names[q_axis] + ']')
self.setGraphTitle(result + '[' + axis_name + ']')
def plotFitStatus(self, fitH5Name, entry, q_axis):
with FitH5(fitH5Name) as h5f:
axis_name = h5f.get_qspace_dimension_names(entry)[q_axis]
data = h5f.get_status(entry, q_axis)
errorPts = np.where(data != FitStatus.OK)[0]
if len(errorPts) == 0:
......@@ -114,4 +116,4 @@ class DropPlotWidget(XsocsPlot2D):
self.__legend = self.setPlotData(scan_x, scan_y,
data, dataIndices=errorPts)
self.setGraphTitle('Errors[qx]' + FitH5QAxis.axis_names[q_axis])
self.setGraphTitle('Errors[qx]' + axis_name)
......@@ -42,7 +42,7 @@ from ...model.Model import Model, RootNode
from ...project.Hdf5Nodes import H5File
from ...project.Hdf5Nodes import H5Base, H5NodeClassDef
from ....io.FitH5 import FitH5, FitH5QAxis
from ....io.FitH5 import FitH5
from ....process.fit import FitStatus
......@@ -92,15 +92,9 @@ class FitEntryNode(H5Base):
return children
def mimeData(self, column, stream):
# TODO : put column value in enum
if column == 1:
q_axis = FitH5QAxis.qx_axis
elif column == 2:
q_axis = FitH5QAxis.qy_axis
elif column == 3:
q_axis = FitH5QAxis.qz_axis
else:
if column not in (1, 2, 3):
raise ValueError('Unexpected column.')
q_axis = column - 1
h5file = self.h5File
entry = self.entry
......@@ -156,7 +150,8 @@ class FitStatusNode(FitEntryNode):
with FitH5(self.h5File) as fitH5:
x, y = fitH5.sample_positions(self.entry)
for iax, axis in enumerate(FitH5QAxis.axis_names):
for iax, axis in enumerate(
fitH5.get_qspace_dimension_names(self.entry)):
status = fitH5.get_status(self.entry,iax)
errorPts = np.where(status != FitStatus.OK)[0]
self.__nErrors[iax] = len(errorPts)
......@@ -217,7 +212,8 @@ class FitResultNode(FitProcessNode):
xBorder = np.array([x.min(), x.max()])
yBorder = np.array([y.min(), y.max()])
for iax, axis in enumerate(FitH5QAxis.axis_names):
for iax, axis in enumerate(
fitH5.get_qspace_dimension_names(self.entry)):
data = fitH5.get_axis_result(self.entry,
self.process,
......
......@@ -53,16 +53,6 @@ class BackgroundTypes(object):
ALLOWED = NONE, CONSTANT, LINEAR, SNIP
class FitH5QAxis(object): # TODO remove
axis_values = range(3)
qx_axis, qy_axis, qz_axis = axis_values
axis_names = ('qx', 'qy', 'qz')
@staticmethod
def axis_name(axis):
return FitH5QAxis.axis_names[axis]
def _find_NX_class(group, nx_class):
"""Yield name of items in group of nx_class NX_class
......
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