def tst_forward_and_reverse_transform(): from dxtbx.model import Panel from scitbx import matrix # The input parameters (from a GXPARM.XDS file) fast_axis = (0.000000, -0.939693, -0.342020) slow_axis = (1.000000, 0.000000, 0.000000) normal = (0.000000, -0.342020, 0.939693) pixel_size = (0.172000, 0.172000) pixel_origin = (244.836136, 320.338531) image_size = (487, 619) distance = 122.124901 wavelength = 0.689400 # Calculate the vector to the detector (0, 0) pixel origin = ((matrix.col(fast_axis).normalize() * pixel_size[0]) * (0 - pixel_origin[0]) + (matrix.col(slow_axis).normalize() * pixel_size[1]) * (0 - pixel_origin[1]) + (distance * matrix.col(normal).normalize())) # Create a detector object panel = Panel("", "", fast_axis, slow_axis, origin, pixel_size, image_size, (0, 0), 0.0, "") # Create the intersection object and transform object intersection = lambda x: panel.get_ray_intersection(x) transform = lambda x: panel.get_lab_coord(x) # Do a test tst_fwd_rev_random(intersection, transform, panel)