Commit cf49b212 authored by Julia Garriga Ferrer's avatar Julia Garriga Ferrer Committed by Julia Garriga Ferrer
Browse files

[gui][rsm] Fix rsm angle transformations

parent eabfd65d
......@@ -26,7 +26,7 @@
__authors__ = ["J. Garriga"]
__license__ = "MIT"
__date__ = "31/05/2021"
__date__ = "01/06/2021"
import numpy
......@@ -80,17 +80,19 @@ class RSMWidget(qt.QMainWindow):
if self._thread.data is not None:
self._moments = self._thread.data
ffz = self.dataset.get_metadata_values(POSITIONER_METADATA, "ffz")
mainx = self.dataset.get_metadata_values(POSITIONER_METADATA, "mainx")
mainx = -self.dataset.get_metadata_values(POSITIONER_METADATA, "mainx")
d = 0.051
s, h, w = self.dataset.get_data().shape
X = numpy.arange(-int(h / 2), int(h / 2), dtype=numpy.float64) * d
Y = numpy.arange(-(w / 2), w / 2, dtype=numpy.float64) * d
teta = numpy.arctan2(ffz + X, mainx)
az = numpy.arctan2(Y, mainx)
xscale = (teta[-1] - teta[0]) / h
yscale = (az[-1] - az[0]) / w
teta_min = (180 / numpy.pi) * numpy.arctan2(ffz - d * h / 2, mainx)
teta_max = (180 / numpy.pi) * numpy.arctan2(ffz + d * h / 2, mainx)
az_min = -(180 / numpy.pi) * numpy.arctan2(d * w / 2, numpy.sqrt(ffz * ffz + mainx * mainx))
az_max = (180 / numpy.pi) * numpy.arctan2(d * w / 2, numpy.sqrt(ffz * ffz + mainx * mainx))
xscale = (teta_max - teta_min) / h
yscale = (az_max - az_min) / w
self._plotWidget.addImage(self._moments[0][0], ylabel="2 theta", xlabel="Azimuth",
origin=(az[0], teta[0]), scale=(yscale, xscale))
origin=(az_min, teta_min), scale=(yscale, xscale))
else:
print("\nComputation aborted")
......
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