Skip to content

Commit 56f3c98

Browse files
author
Kay Kasemir (ky9)
committed
Table scan update to Python3, bob
1 parent 7f6daef commit 56f3c98

File tree

1 file changed

+71
-28
lines changed

1 file changed

+71
-28
lines changed

doc/getting_started.rst

Lines changed: 71 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ Prepare the PyScanClient::
1414
git clone https://github.com/PythonScanClient/PyScanClient.git
1515
cd PyScanClient
1616
python setup.py build
17-
export PYTHONPATH=`pwd`/build/lib
17+
18+
In here, we don't "install" the library
19+
but simply access it via the python path.
20+
In addition, we list the folder with examples to be used later
21+
in the path::
22+
23+
export PYTHONPATH=`pwd`/build/lib:`pwd`/example
1824

1925
The scan server is a CS-Studio service.
2026
Both the scan server and the CS-Studio GUI can be built
@@ -62,11 +68,12 @@ You would stop the scan server by typing `shutdown`, then restart via `scan-serv
6268
Test Beamline
6369
-------------
6470

65-
Subsequent sections use a simple test beamline.
66-
Run it like this::
71+
Subsequent sections use a simple test beamline created by `simulation.db`.
72+
The scan GUIs use additional databases.
73+
Start them all in one IOC like this::
6774

6875
cd PyScanClient/example
69-
softIoc -d ioc/simulation.db
76+
softIoc -m S=Demo -d ioc/simulation.db -d ioc/table.db
7077

7178
Assuming you fetched a binary for CS-Studio, start the associated GUI like this::
7279

@@ -90,6 +97,7 @@ Familiarize yourself with the simulation.
9097
* Move the "Device" setpoint slider and notice how its
9198
value (horizontal orange bar) follows with a delay.
9299

100+
93101
Direct REST Access
94102
------------------
95103

@@ -123,6 +131,7 @@ but point your web browser to http://localhost:4810 and try the following.
123131
which should match what was submitted. Follow the "(data)" link and note how
124132
it lists one sample with value 1.0 and another with value 2.0.
125133

134+
126135
Scan Server Console
127136
-------------------
128137

@@ -140,6 +149,7 @@ Scan Server Console
140149
* Back from the start page http://localhost:4810, click the
141150
"/scan/{name-of-new-scan}" link and submit anoter example scan.
142151

152+
143153
CS-Studio GUI
144154
-------------
145155

@@ -188,6 +198,7 @@ it is thus suggested to manually remove information for older scans,
188198
either by deleting selected scans or by invoking "Remove completed scans"
189199
from the scan monitor context menu.
190200

201+
191202
Basic PyScanClient
192203
------------------
193204

@@ -217,29 +228,6 @@ The PyScanClient `tutorial` folder contains several examples
217228
to try.
218229

219230

220-
CS-Studio GUI combined with PyScanClient
221-
----------------------------------------
222-
223-
In CS-Studio, use the menu File, Open to open `PyScanClient/example/opi/2_XYScan.bob`.
224-
In addition to the beam, shutter and X/Y motors that we've already seen,
225-
it adds a "Scan" section. By default, it will scan both motors from 0 to 5,
226-
and at each position await 3 neutrons.
227-
228-
Press "Go!" and note how the Scan Monitor now shows a running "XY Scan".
229-
Right-click on the scan in the monitor, open the "Scan Data Table"
230-
and watch it add new data for each scanned position.
231-
Close the data table and instead open the "Scan Data Plot".
232-
From the "X Axis" drop-down, select "xpos", and from the "Value 1" drop-down select "ypos".
233-
234-
.. image:: scan_xy.png
235-
236-
Start the next scan after "Up/Down" is turned off and compare the motor positions in the plot.
237-
238-
Check "Simulate" to submit the scan for simulation, without actually executing it.
239-
Simulation can be useful to verify which commands will be created.
240-
It performs a simple run time estimate based on rate-of-change estimates that
241-
need to be configured on the scan server.
242-
243231
Default Device Settings
244232
-----------------------
245233

@@ -280,10 +268,65 @@ The code in `example/beamline1.py`, `example/beamline2.py` and
280268
scan settings.
281269

282270

271+
CS-Studio GUI combined with PyScanClient
272+
----------------------------------------
273+
274+
End users can assemble recipes for a scan by writing python
275+
scripts similar to the ones shown so far.
276+
In practice, however, it is more likely for experts to prepare such scripts
277+
and end users then simply adjust key parameters and execute the script.
278+
279+
For frequently used recipes, a GUI can be added.
280+
Instead of editing a script and executing it in a terminal window,
281+
users can then set parameters and submit a scan from the GUI.
282+
283+
In CS-Studio, use the menu `File`, `Open`` to open `PyScanClient/example/opi/2_XYScan.bob`.
284+
In addition to the beam, shutter and X/Y motors that we've already seen,
285+
it adds a "Scan" section. By default, it will scan both motors from 0 to 5,
286+
and at each position await 3 neutrons.
287+
288+
Press "Go!" and note how the Scan Monitor now shows a running "XY Scan".
289+
Right-click on the scan in the monitor, open the "Scan Data Table"
290+
and watch it add new data for each scanned position.
291+
Close the data table and instead open the "Scan Data Plot".
292+
From the "X Axis" drop-down, select "xpos", and from the "Value 1" drop-down select "ypos".
293+
294+
.. image:: scan_xy.png
295+
296+
Start the next scan after "Up/Down" is turned off and compare the motor positions in the plot.
297+
298+
Check "Simulate" to submit the scan for simulation, without actually executing it.
299+
Simulation can be useful to verify which commands will be created.
300+
It performs a simple run time estimate based on rate-of-change estimates that
301+
need to be configured on the scan server.
302+
303+
To see how this is implemented, open the display in the CS-Studio display editor.
304+
In this example, all scan parameters use local PVs. If you prefer to persist
305+
the parameters when the display is closed and later re-opened,
306+
you would use real PVs.
307+
Pushing the "Go!" button executes `example/opi/scripts/xy_scan.py`:
308+
309+
.. literalinclude:: ../example/opi/scripts/xy_scan.py
310+
311+
283312
Table Scan
284313
----------
285314

286-
TODO
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.
319+
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".
324+
325+
326+
TODO .. more ..
327+
328+
329+
See :mod:`scan.table.table_scan` for more on the table syntax.
287330

288331

289332
Alignment Scan

0 commit comments

Comments
 (0)