Skip to content

Commit

Permalink
Removed extra point in turnaround, and corrected user programs
Browse files Browse the repository at this point in the history
  • Loading branch information
tomtrafford committed Dec 3, 2024
1 parent 109bcc9 commit 77d8e6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 41 deletions.
32 changes: 4 additions & 28 deletions src/ophyd_async/epics/pmac/_pmac_trajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,36 +133,12 @@ async def prepare(self, value: PmacTrajInfo):
profile_gap : profile_gap + len_gap
] = vel_gap[axis]

positions[cs_axes[axis]][profile_gap + len_gap] = chunk.lower[
axis
][gap]
positions[cs_axes[axis]][profile_gap + len_gap + 1] = (
chunk.upper[axis][gap]
)

velocities[cs_axes[axis]][
profile_gap + len_gap : profile_gap + len_gap + 2
] = np.repeat(
(chunk.upper[axis][gap] - chunk.lower[axis][gap])
/ chunk.midpoints["DURATION"][gap],
2,
axis=0,
)

else:
time_array[profile_gap : profile_gap + len_gap] = time_gap
user_array[profile_gap : profile_gap + len_gap] = 2

time_array[
profile_gap + len_gap : profile_gap + len_gap + 2
] = np.repeat(
chunk.midpoints["DURATION"][gap] / (2 * TICK_S), 2
)
user_array[
profile_gap + len_gap : profile_gap + len_gap + 2
] = 1

added_point += len_gap + 1
user_array[profile_gap : profile_gap + len_gap - 1] = 2
user_array[profile_gap + len_gap - 1] = 1

added_point += len_gap
start = gap

# Calculate Starting and end Position to allow ramp up and trail off velocity
Expand Down
14 changes: 1 addition & 13 deletions tests/epics/pmac/test_pmac.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ async def test_sim_grid_trajectory(sim_x_motor, sim_y_motor, sim_pmac) -> None:
5.55,
5.55,
5.5,
5.5,
5.0,
4.5,
4.0,
Expand All @@ -193,7 +192,6 @@ async def test_sim_grid_trajectory(sim_x_motor, sim_y_motor, sim_pmac) -> None:
0.45,
0.45,
0.5,
0.5,
1.0,
1.5,
2.0,
Expand Down Expand Up @@ -233,7 +231,6 @@ async def test_sim_grid_trajectory(sim_x_motor, sim_y_motor, sim_pmac) -> None:
-1.0,
-1.0,
-1.0,
-1.0,
-0.0,
0.0,
-0.0,
Expand All @@ -248,7 +245,6 @@ async def test_sim_grid_trajectory(sim_x_motor, sim_y_motor, sim_pmac) -> None:
1.0,
1.0,
1.0,
1.0,
0.0,
]
)
Expand Down Expand Up @@ -278,7 +274,6 @@ async def test_sim_grid_trajectory(sim_x_motor, sim_y_motor, sim_pmac) -> None:
11.0,
11.0,
11.0,
11.0,
11.05,
11.5,
11.95,
Expand All @@ -294,7 +289,6 @@ async def test_sim_grid_trajectory(sim_x_motor, sim_y_motor, sim_pmac) -> None:
12.0,
12.0,
12.0,
12.0,
]
)
assert await trigger_logic.pmac.velocities[8].get_value() == pytest.approx(
Expand Down Expand Up @@ -323,7 +317,6 @@ async def test_sim_grid_trajectory(sim_x_motor, sim_y_motor, sim_pmac) -> None:
0.0,
0.0,
0.0,
0.0,
1.0,
3.16227766,
1.0,
Expand All @@ -339,7 +332,6 @@ async def test_sim_grid_trajectory(sim_x_motor, sim_y_motor, sim_pmac) -> None:
0.0,
0.0,
0.0,
0.0,
]
)
assert await trigger_logic.pmac.time_array.get_value() == pytest.approx(
Expand Down Expand Up @@ -368,7 +360,6 @@ async def test_sim_grid_trajectory(sim_x_motor, sim_y_motor, sim_pmac) -> None:
500000,
500000,
500000,
500000,
100000,
216227,
216227,
Expand All @@ -383,7 +374,6 @@ async def test_sim_grid_trajectory(sim_x_motor, sim_y_motor, sim_pmac) -> None:
500000,
500000,
500000,
500000,
100000,
]
)
Expand All @@ -402,7 +392,6 @@ async def test_sim_grid_trajectory(sim_x_motor, sim_y_motor, sim_pmac) -> None:
2,
2,
2,
2,
1,
1,
1,
Expand All @@ -417,7 +406,6 @@ async def test_sim_grid_trajectory(sim_x_motor, sim_y_motor, sim_pmac) -> None:
2,
2,
2,
2,
1,
1,
1,
Expand All @@ -432,7 +420,7 @@ async def test_sim_grid_trajectory(sim_x_motor, sim_y_motor, sim_pmac) -> None:
8,
]
)
assert await trigger_logic.pmac.points_to_build.get_value() == 41
assert await trigger_logic.pmac.points_to_build.get_value() == 39
assert await sim_x_motor.user_setpoint.get_value() == 0.45
assert trigger_logic.scantime == 15.2

Expand Down

0 comments on commit 77d8e6e

Please sign in to comment.