Skip to content
Snippets Groups Projects
Commit c31b593d authored by Edoardo Zatterin's avatar Edoardo Zatterin :snowboarder:
Browse files

handle ROIs in qconv correctly

parent ac640acd
No related branches found
No related tags found
No related merge requests found
Pipeline #168438 failed
......@@ -47,6 +47,7 @@ def qspace_conversion(
det_ip="y+",
det_oop="z-",
sampleor='det',
det_roi=None,
):
"""Returns array of Q vectors corresponding to each pixel
......@@ -100,7 +101,8 @@ def qspace_conversion(
for a in angles:
off = offsets.get(a, 0)
angles[a] = angles[a] - off
print(f"Subtracting {off:<5.3f} from {a}")
if off != 0:
print(f"Subtracting {off:<5.3f} from {a}")
print("\n")
eta, phi, rx, ry, nu, delta = angles.values()
......@@ -123,6 +125,9 @@ def qspace_conversion(
# y to the "outside"
# (righthanded)
hxrd = xu.HXRD(sample_ip, sample_oop, qconv=qconv, sampleor=sampleor)
if det_roi is None: # TODO
det_roi = [0, img_size[0], 0, img_size[1]]
# Maxipix detector reference frame
hxrd.Ang2Q.init_area(
......@@ -134,6 +139,8 @@ def qspace_conversion(
Nch2=img_size[1],
chpdeg1=chan_per_deg[0],
chpdeg2=chan_per_deg[1],
roi=det_roi # TODO IMPLEMENT needs to cut det frames too, not just qvals
# see image_roi_offset
)
# shape of the array that will store the q vectors for all
......@@ -252,6 +259,7 @@ class QSpaceConverter(object):
det_ip="y+",
det_oop="z-",
sampleor='det',
det_roi=None,
):
"""Merger for the Kmap SPEC and EDF files.
......@@ -294,6 +302,7 @@ class QSpaceConverter(object):
self.__det_ip = det_ip
self.__det_oop = det_oop
self.__sampleor = sampleor
self.__det_roi = det_roi
xsocsH5 = XsocsH5.XsocsH5(xsocsH5_f)
......@@ -912,6 +921,7 @@ class QSpaceConverter(object):
det_ip=self.__det_ip,
det_oop=self.__det_oop,
sampleor=self.__sampleor,
det_roi=self.__det_roi,
)
# Reshape array to flatten image
......
......@@ -5,4 +5,4 @@ It provides a helper function :func:`kmap_2_qspace` to run the conversion
from .QSpaceConverter import QSpaceConverter, qspace_conversion # noqa
from .QSpaceConverter import QSpaceCoordinates # noqa
from .helpers import kmap_2_qspace # noqa
# from .helpers import kmap_2_qspace # noqa
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment