diff --git a/src/pyFAI/geometry/imaged11.py b/src/pyFAI/geometry/imaged11.py index 557900aec..4904d4b03 100644 --- a/src/pyFAI/geometry/imaged11.py +++ b/src/pyFAI/geometry/imaged11.py @@ -131,11 +131,18 @@ def convert_to_ImageD11(poni, distance_unit="µm", wavelength_unit="nm"): distance_unit = to_unit(distance_unit, LENGTH_UNITS) wavelength_unit = to_unit(wavelength_unit, LENGTH_UNITS) f2d = convert_to_Fit2d(poni) - # TODO: manage orientation here - id11 = {"o11": 1, - "o12": 0, - "o21": 0, - "o22": -1} + orientation = detector.orientation + if orientation == 3: + (o11, o12, o21, o22) = (1, 0, 0, -1) + elif orientation == 1: + (o11, o12, o21, o22) = (1, 0, 0, +1) + elif orientation == 4: + (o11, o12, o21, o22) = (-1, 0, 0, -1) + elif orientation == 2: + (o11, o12, o21, o22) = (-1, 0, 0, +1) + else: + raise ValueError("Invalid orientation") + id11 = {"o11": o11, "o12": o12, "o21": o21, "o22": o22} id11["distance"] = (f2d.directDist or 0) * 1e-3 * distance_unit.scale id11["y_center"] = (f2d.centerX or 0) # in pixel id11["z_center"] = (f2d.centerY or 0) # in pixel