Commit 74579679 authored by Thomas Vincent's avatar Thomas Vincent

rework get sample pos API

parent 17481245
......@@ -86,8 +86,7 @@ class DropPlotWidget(XsocsPlot2D):
def plotFitResult(self, fitH5Name, entry, process, result, q_axis):
with FitH5(fitH5Name) as h5f:
data = h5f.get_axis_result(entry, process, result, q_axis)
scan_x = h5f.scan_x(entry)
scan_y = h5f.scan_y(entry)
scan_x, scan_y = h5f.sample_positions(entry)
xBorder = np.array([scan_x.min(), scan_x.max()])
yBorder = np.array([scan_y.min(), scan_y.max()])
......@@ -108,8 +107,9 @@ class DropPlotWidget(XsocsPlot2D):
errorPts = np.where(data != FitStatus.OK)[0]
if len(errorPts) == 0:
return
scan_x = h5f.scan_x(entry)[errorPts]
scan_y = h5f.scan_y(entry)[errorPts]
scan_x, scan_y = h5f.sample_positions(entry)
scan_x = scan_x[errorPts]
scan_y = scan_y[errorPts]
data = data[errorPts]
self.__legend = self.setPlotData(scan_x, scan_y,
......
......@@ -154,8 +154,7 @@ class FitStatusNode(FitEntryNode):
qApp.processEvents()
with FitH5(self.h5File) as fitH5:
x = fitH5.scan_x(self.entry)
y = fitH5.scan_y(self.entry)
x, y = fitH5.sample_positions(self.entry)
for iax, axis in enumerate(FitH5QAxis.axis_names):
status = fitH5.get_status(self.entry,iax)
......@@ -213,8 +212,7 @@ class FitResultNode(FitProcessNode):
qApp.processEvents()
with FitH5(self.h5File) as fitH5:
x = fitH5.scan_x(self.entry)
y = fitH5.scan_y(self.entry)
x, y = fitH5.sample_positions(self.entry)
xBorder = np.array([x.min(), x.max()])
yBorder = np.array([y.min(), y.max()])
......
......@@ -51,7 +51,7 @@ class BackgroundTypes(object):
ALLOWED = NONE, CONSTANT, LINEAR, SNIP
class FitH5QAxis(object):
class FitH5QAxis(object): # TODO remove
axis_values = range(3)
qx_axis, qy_axis, qz_axis = axis_values
axis_names = ('qx', 'qy', 'qz')
......@@ -151,6 +151,16 @@ class FitH5(XsocsH5Base):
axis=axis_name))
return status
def sample_positions(self, entry):
"""Return the sample points coordinates (x, y) for the given entry.
:param str entry:
:return: 2 arrays: x and y
:rtype: List[numpy.ndarray]
"""
return (self._get_array_data(self._SCAN_X_PATH.format(entry=entry)),
self._get_array_data(self._SCAN_Y_PATH.format(entry=entry)))
def scan_x(self, entry):
"""Return the sample points coordinates along x for the given entry.
......@@ -269,8 +279,7 @@ class FitH5(XsocsH5Base):
:param str entry:
:param str filename:
"""
x, y = self.scan_x(entry), self.scan_y(entry)
x, y = self.sample_positions(entry)
processes = self.processes(entry)
......
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