malcolm.modules.pmac.util
- malcolm.modules.pmac.util.get_motion_axes(generator: scanpointgenerator.core.compoundgenerator.CompoundGenerator, axes_to_move: Sequence[str]) List[str] [source]
Filter axes_to_move to only contain motion axes
- malcolm.modules.pmac.util.cs_axis_mapping(context: malcolm.core.context.Context, layout_table: malcolm.modules.builtin.util.LayoutTable, axes_to_move: Sequence[str]) Dict[str, malcolm.modules.pmac.infos.MotorInfo] [source]
Given the layout table of a PMAC, create a MotorInfo for every axis in axes_to_move that isn’t generated by a StaticPointGenerator. Check that they are all in the same CS
- malcolm.modules.pmac.util.cs_axis_numbers(context: malcolm.core.context.Context, layout_table: malcolm.modules.builtin.util.LayoutTable, cs_port: str) Dict[str, int] [source]
Given the layout table of a PMAC, get the axis number for each name in the table which is in the specified CS
- malcolm.modules.pmac.util.all_points_same_velocities(points: scanpointgenerator.core.point.Points) annotypes._array.Array[bool] [source]
return a numpy array of bool where each element is true if the corresponding element is points has the same velocity as the next element (for all axes at this point)
- malcolm.modules.pmac.util.all_points_joined(points: scanpointgenerator.core.point.Points) annotypes._array.Array[bool] [source]
Check for axes that need to move within the space between points this check is performed on all points and returns an array of bool where True implies that the point at this index is joined to the point at the next index
- malcolm.modules.pmac.util.point_velocities(axis_mapping: Dict[str, malcolm.modules.pmac.infos.MotorInfo], point: scanpointgenerator.core.point.Point, entry: bool = True) Dict[str, float] [source]
Find the velocities of each axis over the entry/exit of current point
- malcolm.modules.pmac.util.profile_between_points(axis_mapping: Dict[str, malcolm.modules.pmac.infos.MotorInfo], point: scanpointgenerator.core.point.Point, next_point: scanpointgenerator.core.point.Point, min_time: float = 0.002, min_interval: float = 0.002)[source]
Make consistent time and velocity arrays for each axis
Try to create velocity profiles for all axes that all arrive at ‘distance’ in the same time period. The profiles will contain the following points:-
in the following description acceleration can be -ve or +ve depending on the relative sign of v1 and v2. fabs(vm) is <= maximum velocity - start point at 0 secs with velocity v1 start accelerating - middle velocity start reached speed vm - middle velocity end start accelerating - end point with velocity v2 reached target speed
Time at vm may be 0 in which case there are only 3 points and acceleration to v2 starts as soon as vm is reached.
If the profile has to be stretched to achieve min_time then the the middle period at speed vm is extended accordingly.
After generating all the profiles this function checks to ensure they have all achieved min_time. If not min_time is reset to the slowest profile and all profiles are recalculated.
Note that for each profile the area under the velocity/time plot must equal ‘distance’. The class VelocityProfile implements the math to achieve this.
- class malcolm.modules.pmac.util.MinTurnaround(time: Anno(name='AMinTurnaround', typ=<class 'float'>, description='Minimum turnaround time for non-joined points'), interval: Anno(name='AMinInterval', typ=<class 'float'>, description='Minimum interval between turnaround points'))[source]
Dataclass for the Minimum turnaround information.
This may come from a MinTurnaroundInfo if the scan block has a MinTurnaroundPart otherwise MIN_TIME and MIN_INTERVAL are used as default values.
- class malcolm.modules.pmac.util.AlternatingDelayAfterMutator(even_delay_after: Anno(name='AEvenDelayAfter', typ=<class 'float'>, description='Delay after value to add to even points'), odd_delay_after: Anno(name='AOddDelayAfter', typ=<class 'float'>, description='Delay after value to add to odd points'))[source]
Mutator to add alternating delay_after values based on the index of each point