def test_axis(n, width, left_position, right_position): left = triangle(n, width, left_position) right = triangle(n, width, right_position, left=False) center = compute_rotation_axis(left, right) truth = (left_position + right_position + width) / 2.0 * q.px assert_almost_equal(center, truth)
def test_axis(n, width, left_position, right_position): left = triangle(n, width, left_position) right = triangle(n, width, right_position, left=False) center = compute_rotation_axis(left, right) truth = (left_position + right_position + width) / 2 * q.px assert_almost_equal(center, truth)
def determine_rotation_axis(camera, shutter, flat_motor, rotation_motor, flat_position, radio_position): """Determine tomographic rotation axis using *camera*, *shutter*, *rotation_motor* and *flat_motor* devices. *flat_position* is the position for making a flat field, *radio_position* is the position with the sample in the field of view. """ dark = acquire_dark(camera, shutter).result().astype(np.float32) flat = acquire_image_with_beam(camera, shutter, flat_motor, flat_position).result() first = acquire_image_with_beam(camera, shutter, flat_motor, radio_position).result() rotation_motor.move(180 * q.deg).join() last = acquire_image_with_beam(camera, shutter, flat_motor, radio_position).result() # flat correct flat_corr_first = flat_correct(first, flat, dark=dark) flat_corr_last = flat_correct(last, flat, dark=dark) return compute_rotation_axis(flat_corr_first, flat_corr_last)