Skip to content

Run Your First Scan

Goal

In this tutorial you will submit a simple line scan and observe the result.

Before you start

Continue in the same session with the demo configuration loaded and the tutorial motor samx available.

Tab completion for scans

BEC provides tab completion for the full scan interface. Type scans. and press TAB to discover available scan commands and their names.

If you are not sure which parameters a scan expects, ask the IPython client directly with ?:

scans.line_scan?

This will display the scan documentation, including its signature and an example of use:

 default@bec [4/19] ❯❯ scans.line_scan?
Signature:
scans.line_scan(
    *args,
    exp_time: float = 0,
    steps: int = None,
    relative: bool = False,
    burst_at_each_point: int = 1,
    **kwargs,
)
Docstring:
A line scan for one or more motors.

Args:
    *args (Device, float, float): pairs of device / start position / end position
    exp_time (float): exposure time in s. Default: 0
    steps (int): number of steps. Default: 10
    relative (bool): if True, the start and end positions are relative to the current position. Default: False
    burst_at_each_point (int): number of acquisition per point. Default: 1

Returns:
    ScanReport

Examples:
    >>> scans.line_scan(dev.motor1, -5, 5, dev.motor2, -5, 5, steps=10, exp_time=0.1, relative=True)
File:      ~/PSI/bec/bec_lib/bec_lib/scans.py
Type:      function

1. Submit a simple line scan

Run a short line scan over the simulated samx motor:

scans.line_scan(dev.samx, -1, 1, steps=5, exp_time=0.1, relative=False)
Starting scan 4.
+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
|seq. num|  samx  |  bpm4a |  bpm5x | ebpmdy |  temp  | ebpmux |  bpm4c |  bpm6a | bpm4ym | bpm4xf |
+========+========+========+========+========+========+========+========+========+========+========+
|    1   |-1.006  | 108.000| 98.000 | 106.000| 110.000| 106.000| 107.000| 108.000| 97.000 | 101.000|
|    2   |-0.505  | 104.000| 110.000| 95.000 | 107.000| 109.000| 93.000 | 109.000| 103.000| 93.000 |
|    3   |-0.007  | 110.000| 107.000| 97.000 | 102.000| 94.000 | 92.000 | 90.000 | 92.000 | 95.000 |
|    4   |  0.496 | 106.000| 108.000| 102.000| 108.000| 90.000 | 101.000| 98.000 | 93.000 | 91.000 |
|    5   |  1.001 | 98.000 | 90.000 | 106.000| 98.000 | 90.000 | 104.000| 93.000 | 94.000 | 92.000 |
+========+========+========+========+========+========+========+========+========+========+========+
|  Scan 4 finished. Scan ID 63ea523a-0882-48d4-bd73-db3c3197bd55. Elapsed time: 0.83 s             |
+========+========+========+========+========+========+========+========+========+========+========+

This runs a scan where the samx motor is moved from the position -1 to 1, and all the "monitored" devices and signals in BEC are recorded at each of five points, evenly spaced along this trajectory. For devices which expect an exposure time, exp_time=0.1 indicates that they should expose for 0.1 seconds. The keyword relative determines whether the start and end positions are relative to the current motor position or absolute positions.

BEC shows a progress bar while the scan runs, together with a table of the monitored devices used during the scan.

2. Let the scan finish in the client

For this short tutorial scan, you can simply let the scan complete and observe the output in the console.

What you have learned

You submitted a line scan, and observed the output in the BEC console.

Next step

Continue with 05 Plot Your First Waveform, where you will start using the Dock Area and draw a plot from a scan.

Alternatively, you can check out the more in-depth tutorial on accessing your scan data.