pcdsdevices.utils.generate_scan_points

pcdsdevices.utils.generate_scan_points(start: int | float | Decimal, end: int | float | Decimal, step: int | float | Decimal, prec: int, bidirectional: bool)

Generate scan positions in the forward and optionally reverse directions.

Example

positions = list(generate_scan_points(1, 10, 0.1, 9, True))
RE(list_scan(dets, motor, positions))
Parameters:
  • start (int, float, or Decimal) – Starting scan position. Must be nonnegative and less than end.

  • end (int, float, or Decimal) – Upper scan boundary.

  • step (int, float, or Decimal) – Positive spacing between consecutive positions. Must be less than both start and end.

  • prec (int) – Generated scan points precision.

  • bidirectional (bool) – If True, generate a reverse pass after the forward pass.

Yields:

Decimal – Scan positions, beginning at start and increasing by step while less than or equal to end. If bidirectional is True, additional positions begin at end - step and decrease by step while greater than or equal to start.

Raises:

ValueError – If start is negative, start is greater than or equal to end, prec is smaller than 1 or step is greater than or equal to either boundary.

Notes

Sets the active decimal context precision to nine significant digits. Inputs are converted directly to Decimal; float inputs may retain binary floating-point representation artifacts.

The forward pass includes end only if stepping reaches it exactly. The reverse pass is anchored to end, so its positions may differ from the forward positions if the interval is not divisible by step.