Skip to content

Commit 336edf0

Browse files
author
Kay Kasemir (ky9)
committed
Tablescan info to get started
1 parent 6de215b commit 336edf0

File tree

6 files changed

+49
-13
lines changed

6 files changed

+49
-13
lines changed

doc/getting_started.rst

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -308,26 +308,60 @@ Pushing the "Go!" button executes `example/opi/scripts/xy_scan.py`:
308308

309309
.. literalinclude:: ../example/opi/scripts/xy_scan.py
310310

311+
This script executes within the GUI with access to the widgets in the display.
312+
It is handled by Jython and can use the PyScanClient the same way as
313+
C-Python running outside the GUI.
311314

312315
Table Scan
313316
----------
314317

315-
Scans that need to set devices like motors, temperature controllers etc.
316-
to a list of desired position, then maybe start data acquisition at each
317-
point, wait for some condition, then move to the next point can often
318-
be expressed in a concise table notation.
318+
Scans that need to set devices like motors to a list of desired positions,
319+
start data acquisition at each point, wait for some condition, stop data acquisition,
320+
and then move to the next point can often be expressed in a concise table notation.
319321

320-
In CS-Studio, use the menu `File`, `Open`` to open `PyScanClient/example/opi/3_Table_Scan.bob`.
321-
Push the file folder button next to the "Table:____" text field and
322-
locate the file `PyScanClient/example/tablescan.csv`,
323-
then press "Load" and "Submit".
322+
In CS-Studio, use the menu `File`, `Open` to open `PyScanClient/example/opi/3_Table_Scan.bob`.
323+
Push the file folder button next to the "Table:____" text field to
324+
locate the file `PyScanClient/example/tablescan.csv`.
325+
Press "Load" and "Submit".
324326

327+
.. image:: table_scan.png
325328

326-
TODO .. more ..
329+
In short, table columns are typically PV names, and cells contain their values.
330+
Cell values for PVs may contain plain values as in the first row
331+
which sets both motors to 1.
332+
Cells may also contain lists of values or `loop(start, end, step)` constructs,
333+
as in the second row which will create nested loops setting
334+
`motor_x` to 1, 3, 5, while an inner loop will set
335+
`motor_y` to 1, 1.5, 2, ..., 4.5, 5.0.
327336

337+
The triplet "Wait For", "Value" and "Or Time" columns have a special meaning.
338+
In the first row, after setting the motor positions, we wait for 5 seconds.
339+
In the second, we wait for the proton charge to increment by 1e9,
340+
or move on after 1 minute, whichever comes first.
341+
Either way, the `Start()` commands which presumably start data aquisition are executed just
342+
before we wait, and the `Stop()` commands which close data aquisition are executed after each "Wait For".
343+
Each PV that is used in a table row is logged at the end of each row.
344+
345+
Finally, the list of commands created for a table scan start with `Pre()` commands and end with `Post()`
346+
commands. In the `beamline_setup.py` shown above those are used to open and then close the shutter.
347+
The created list of commands can be seen in the scan editor:
348+
349+
.. image:: table_scan_commands.png
328350

329351
See :mod:`scan.table.table_scan` for more on the table syntax.
330352

353+
The PyScanClient fundamentally supports table scans in CSV format.
354+
The CS-Studio GUI offers a basic table display where values
355+
can be adjusted before submitting.
356+
Most spreadsheet programs can be used to create or edit more
357+
extensive table scans, which are then exported as CSV
358+
to load and submit them from the GUI.
359+
You may also extend your local copy of the tablescan GUI scripts
360+
to call out to tools like the LibreOffice file converter,
361+
"soffice --convert-to csv ...",
362+
which then allows the GUI to directly load such spreadsheet files
363+
without manual conversion to CSV.
364+
331365

332366
Alignment Scan
333367
--------------
@@ -345,3 +379,5 @@ https://github.com/ralphlange/procServ
345379
Both the scan server and the CS-Studio GUI are typically started by a site-specific
346380
launcher script that adds `-settings /path/to/site/settings.ini`.
347381

382+
383+
TODO: scan server's pre and post commands

doc/overview.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Use Case: Table-Based Scans
2525
---------------------------
2626

2727
Scans that need to set devices like motors, temperature controllers etc.
28-
to a list of desired position, then maybe start data acquisition at each
28+
to a list of desired positions, then maybe start data acquisition at each
2929
point, wait for some condition, then move to the next point can often
3030
be expressed in a concise table notation.
3131

doc/table_scan.png

30.1 KB
Loading

doc/table_scan_commands.png

62.7 KB
Loading

example/beamline_setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def __init__(self):
2828
# For example, motors should use completion, and check a readback
2929
self.defineDeviceClass("motor_.", completion=True, readback=True)
3030
# The specific motors in the simulation.db, however, don't support completion
31-
self.defineDeviceClass("motor_x", completion=False, readback=True)
32-
self.defineDeviceClass("motor_y", completion=False, readback=True)
31+
self.defineDeviceClass("motor_x", completion=False, readback=False)
32+
self.defineDeviceClass("motor_y", completion=False, readback=False)
3333
self.defineDeviceClass("shutter", readback=True)
3434
# The simulated "setpoint" uses a different PV "readback" as its readback.
3535
# (readback=False skips readback check

example/tablescan.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
motor_x,motor_y,Wait For,Value,Or Time
22
1,1,time,00:00:5,
3-
"loop(1, 5)","loop(1,5,0.5)",pcharge,1e9,00:01:00
3+
"loop(1,5,2)","loop(1,5,0.5)",pcharge,1e9,00:01:00

0 commit comments

Comments
 (0)