@@ -37,31 +37,37 @@ async def prepare(self, stack: list[Frames[PmacCSMotor]]):
37
37
scanSize = len (stack [0 ])
38
38
scanAxes = stack [0 ].axes ()
39
39
40
+ cs_ports = set ()
40
41
self .profile = {}
41
42
for axis in scanAxes :
42
43
if axis != "DURATION" :
43
- self .profile [axis .csAxis ] = []
44
- self .profile [axis .csAxis + "_velocity" ] = []
44
+ await axis .get_cs_info ()
45
+ self .profile [axis .cs_axis ] = []
46
+ self .profile [axis .cs_axis + "_velocity" ] = []
47
+ cs_ports .add (axis .cs_port )
45
48
else :
46
49
self .profile [axis .lower ()] = []
50
+ cs_port = cs_ports .pop ()
47
51
48
52
# Calc Velocity
49
53
50
54
for axis in scanAxes :
51
55
for i in range (scanSize - 1 ):
52
56
if axis != "DURATION" :
53
- self .profile [axis .csAxis + "_velocity" ].append (
57
+ self .profile [axis .cs_axis + "_velocity" ].append (
54
58
(stack [0 ].midpoints [axis ][i + 1 ] - stack [0 ].midpoints [axis ][i ])
55
59
/ (stack [0 ].midpoints ["DURATION" ][i ])
56
60
)
57
- self .profile [axis .csAxis ].append (stack [0 ].midpoints [axis ][i ])
61
+ self .profile [axis .cs_axis ].append (stack [0 ].midpoints [axis ][i ])
58
62
else :
59
63
self .profile [axis .lower ()].append (
60
64
int (stack [0 ].midpoints [axis ][i ] / TICK_S )
61
65
)
62
66
if axis != "DURATION" :
63
- self .profile [axis .csAxis ].append (stack [0 ].midpoints [axis ][scanSize - 1 ])
64
- self .profile [axis .csAxis + "_velocity" ].append (0 )
67
+ self .profile [axis .cs_axis ].append (
68
+ stack [0 ].midpoints [axis ][scanSize - 1 ]
69
+ )
70
+ self .profile [axis .cs_axis + "_velocity" ].append (0 )
65
71
else :
66
72
self .profile [axis .lower ()].append (
67
73
int (stack [0 ].midpoints [axis ][scanSize - 1 ] / TICK_S )
@@ -75,30 +81,30 @@ async def prepare(self, stack: list[Frames[PmacCSMotor]]):
75
81
run_up_disp , run_up_time = await self ._ramp_up_velocity_pos (
76
82
0 ,
77
83
axis ,
78
- self .profile [axis .csAxis + "_velocity" ][0 ],
84
+ self .profile [axis .cs_axis + "_velocity" ][0 ],
79
85
)
80
- self .initial_pos [axis .csAxis ] = (
81
- self .profile [axis .csAxis ][0 ] - run_up_disp
86
+ self .initial_pos [axis .cs_axis ] = (
87
+ self .profile [axis .cs_axis ][0 ] - run_up_disp
82
88
)
83
89
self .profile ["duration" ][0 ] += run_up_time / TICK_S
84
90
85
91
# Send trajectory to brick
86
92
for axis in scanAxes :
87
93
if axis != "DURATION" :
88
- self .profile_cs_name .set (self . cs )
94
+ self .profile_cs_name .set (cs_port )
89
95
self .points_to_build .set (scanSize )
90
- getattr (self , "use_" + axis .csAxis ).set (True )
91
- getattr (self , axis .csAxis ).set (self .profile [axis .csAxis ])
92
- getattr (self , axis .csAxis + "_vel" ).set (
93
- self .profile [axis .csAxis + "_velocity" ]
96
+ getattr (self , "use_" + axis .cs_axis ).set (True )
97
+ getattr (self , axis .cs_axis ).set (self .profile [axis .cs_axis ])
98
+ getattr (self , axis .cs_axis + "_vel" ).set (
99
+ self .profile [axis .cs_axis + "_velocity" ]
94
100
)
95
101
else :
96
102
self .timeArray .set (self .profile ["duration" ])
97
103
98
104
# MOVE TO START
99
105
for axis in scanAxes :
100
106
if axis != "DURATION" :
101
- await axis .set (self .initial_pos [axis .csAxis ])
107
+ await axis .set (self .initial_pos [axis .cs_axis ])
102
108
103
109
# Set No Of Points
104
110
0 commit comments