def test_outer_product_dscan_snaked(): scan = OuterProductDeltaScan([det], motor1, 1, 3, 3, motor2, 10, 20, 2, True) # Note: motor1 is the first motor specified, and so it is the "slow" # axis, matching the numpy convention. motor.set(0) motor1.set(5) motor2.set(8) expected_data = [{ 'motor2': 18.0, 'det': 1.0, 'motor1': 6.0 }, { 'motor2': 28.0, 'det': 1.0, 'motor1': 6.0 }, { 'motor2': 28.0, 'det': 1.0, 'motor1': 7.0 }, { 'motor2': 18.0, 'det': 1.0, 'motor1': 7.0 }, { 'motor2': 18.0, 'det': 1.0, 'motor1': 8.0 }, { 'motor2': 28.0, 'det': 1.0, 'motor1': 8.0 }] yield multi_traj_checker, scan, expected_data
def test_inner_product_dscan(): motor.set(0) motor1.set(5) motor2.set(8) scan = InnerProductDeltaScan([det], 3, motor1, 1, 3, motor2, 10, 30) # Note: motor1 is the first motor specified, and so it is the "slow" # axis, matching the numpy convention. expected_data = [ {'motor2': 18.0, 'det': 1.0, 'motor1': 6.0}, {'motor2': 28.0, 'det': 1.0, 'motor1': 7.0}, {'motor2': 38.0, 'det': 1.0, 'motor1': 8.0}] yield multi_traj_checker, scan, expected_data
def test_mvr(): # special-case mv because the group is not configurable # move motors first to ensure that movement is relative, not absolute motor1.set(10) motor2.set(10) actual = list(mvr(motor1, 1, motor2, 2)) expected = [ Msg('set', motor1, 11, group=None), Msg('set', motor2, 12, group=None), Msg('wait', None, group=None) ] strip_group(actual) strip_group(expected) assert actual == expected
def test_absolute_spiral(fresh_RE): motor = Mover('motor', {'motor': lambda x: x}, {'x': 0}) motor1 = Mover('motor1', {'motor1': lambda x: x}, {'x': 0}) motor2 = Mover('motor2', {'motor2': lambda x: x}, {'x': 0}) det = SynGauss('det', motor, 'motor', center=0, Imax=1, sigma=1) motor1.set(1.0) motor2.set(1.0) scan = SpiralScan([det], motor1, motor2, 0.0, 0.0, 1.0, 1.0, 0.1, 1.0, 0.0) approx_multi_traj_checker(fresh_RE, scan, _get_spiral_data(0.0, 0.0), decimal=2) scan = SpiralScan([det], motor1, motor2, 0.5, 0.5, 1.0, 1.0, 0.1, 1.0, 0.0) approx_multi_traj_checker(fresh_RE, scan, _get_spiral_data(0.5, 0.5), decimal=2)
def test_relative_spiral(fresh_RE): motor = Mover('motor', {'motor': lambda x: x}, {'x': 0}) motor1 = Mover('motor1', {'motor1': lambda x: x}, {'x': 0}) motor2 = Mover('motor2', {'motor2': lambda x: x}, {'x': 0}) det = SynGauss('det', motor, 'motor', center=0, Imax=1, sigma=1) start_x = 1.0 start_y = 1.0 motor1.set(start_x) motor2.set(start_y) scan = RelativeSpiralScan([det], motor1, motor2, 1.0, 1.0, 0.1, 1.0, 0.0) approx_multi_traj_checker(fresh_RE, scan, _get_spiral_data(start_x, start_y), decimal=2)
def test_outer_product_dscan_snaked(): scan = OuterProductDeltaScanPlan([det], motor1, 1, 3, 3, motor2, 10, 20, 2, True) # Note: motor1 is the first motor specified, and so it is the "slow" # axis, matching the numpy convention. motor.set(0) motor1.set(5) motor2.set(8) expected_data = [ {'motor2': 18.0, 'det': 1.0, 'motor1': 6.0}, {'motor2': 28.0, 'det': 1.0, 'motor1': 6.0}, {'motor2': 28.0, 'det': 1.0, 'motor1': 7.0}, {'motor2': 18.0, 'det': 1.0, 'motor1': 7.0}, {'motor2': 18.0, 'det': 1.0, 'motor1': 8.0}, {'motor2': 28.0, 'det': 1.0, 'motor1': 8.0}] multi_traj_checker(scan, expected_data)
def test_outer_product_dscan(): scan = OuterProductDeltaScanPlan([det], motor1, 1, 3, 3, motor2, 10, 20, 2, False) # Note: motor1 is the first motor specified, and so it is the "slow" # axis, matching the numpy convention. motor.set(0) motor1.set(5) motor2.set(8) expected_data = [ {'motor2': 18.0, 'det': 1.0, 'motor1': 6.0}, {'motor2': 28.0, 'det': 1.0, 'motor1': 6.0}, {'motor2': 18.0, 'det': 1.0, 'motor1': 7.0}, {'motor2': 28.0, 'det': 1.0, 'motor1': 7.0}, {'motor2': 18.0, 'det': 1.0, 'motor1': 8.0}, {'motor2': 28.0, 'det': 1.0, 'motor1': 8.0}] for d in expected_data: d.update({'motor1_setpoint': d['motor1']}) d.update({'motor2_setpoint': d['motor2']}) multi_traj_checker(scan, expected_data)
def test_outer_product_dscan(): scan = OuterProductDeltaScanPlan([det], motor1, 1, 3, 3, motor2, 10, 20, 2, False) # Note: motor1 is the first motor specified, and so it is the "slow" # axis, matching the numpy convention. motor.set(0) motor1.set(5) motor2.set(8) expected_data = [{ 'motor2': 18.0, 'det': 1.0, 'motor1': 6.0 }, { 'motor2': 28.0, 'det': 1.0, 'motor1': 6.0 }, { 'motor2': 18.0, 'det': 1.0, 'motor1': 7.0 }, { 'motor2': 28.0, 'det': 1.0, 'motor1': 7.0 }, { 'motor2': 18.0, 'det': 1.0, 'motor1': 8.0 }, { 'motor2': 28.0, 'det': 1.0, 'motor1': 8.0 }] for d in expected_data: d.update({'motor1_setpoint': d['motor1']}) d.update({'motor2_setpoint': d['motor2']}) multi_traj_checker(scan, expected_data)