Motor-based geometry

The configuration of some multi-module detectors can be adjusted by moving certain groups, such as quadrants, with motors. In this case, we need to update the geometry we use in data analysis according to changes in motor position.

[1]:
%matplotlib inline
from extra_geom import AGIPD_1MGeometry
from extra_geom.motors import AGIPD_1MMotors

Define reference geometry and motor positions and instantiate the motor tracker

[2]:
ref_geom = AGIPD_1MGeometry.from_quad_positions([
    (-542, 660), (-608, -35), (534, -221), (588, 474)
])
tracker = AGIPD_1MMotors(ref_geom)

Define changes in motor positions and get a new geometry

[3]:
motor_pos_diff = [[0, 0], [-10, 4], [2, 5], [-5, -2]]
geom = tracker.move_geom_by(motor_pos_diff)

geom.compare(ref_geom)
[3]:
<Axes: title={'center': 'Geometry comparison: No file → No file'}, xlabel='pixels', ylabel='pixels'>
_images/motor_based_geometry_5_1.png

The reference geometry can be defined together with corresponding motor positions (reference positions)

[4]:
ref_motor_positions = [[10, 10], [10, 10], [10, 10], [10, 10]]
tracker = AGIPD_1MMotors(ref_geom, ref_motor_positions)

In this case, a new geometry can be generated for the absolute positions of the motors.

[5]:
motor_pos_actual = [[10, 10], [0, 14], [12, 15], [5, 8]]
geom = tracker.geom_at(motor_pos_actual)

geom.compare(ref_geom)
[5]:
<Axes: title={'center': 'Geometry comparison: No file → No file'}, xlabel='pixels', ylabel='pixels'>
_images/motor_based_geometry_9_1.png