@@ -9,27 +9,41 @@ Initial Setup
99We assume that you already have a recent version of EPICS base installed
1010with access to commands like `softIoc `, `caget `, `caput `.
1111
12+ Prepare the PyScanClient::
13+
14+ git clone https://github.com/PythonScanClient/PyScanClient.git
15+ cd PyScanClient
16+ python setup.py build
17+ export PYTHONPATH=`pwd`/build/lib
18+
1219The scan server is a CS-Studio service.
1320Both the scan server and the CS-Studio GUI can be built
1421from https://github.com/ControlSystemStudio/phoebus.
15- Binaries are for example available from
22+ More convenient binaries are available from
1623https://controlssoftware.sns.ornl.gov/css_phoebus/nightly/
1724
25+ Create a settings file for CS-Studio that holds the path to
26+ this python library::
27+
28+ echo org.csstudio.display.builder.runtime/python_path=$PYTHONPATH >>my_settings.ini
29+
30+ You may also add common settings like CA or PVA address lists
31+ to that file, or add the `..runtime/python_path ` setting to
32+ an already existing local settings file.
33+
1834All CS-Studio tools are based on Java. The CS-Studio GUI binary
1935may bundle a java runtime. If it includes a `jdk ` folder, use that.
2036Otherwise fetch a Java runtime from https://jdk.java.net
2137Either way, declare your JDK and add its `bin ` folder to the PATH::
2238
2339 export JAVA_HOME=/path/to/jdk
2440 export PATH=$JAVA_HOME/bin:$PATH
25-
26- Check::
27-
2841 java -version
2942
30- Assuming a binary, start the scan server like this::
43+ Assuming you fetched a scan server binary, start the scan server like this::
3144
3245 unzip scan-server.zip
46+ rm scan-server.zip
3347 cd scan-server-*
3448 ./scan-server.sh
3549
@@ -45,23 +59,21 @@ On success, note the REST URL and list of console commands::
4559You would stop the scan server by typing `shutdown `, then restart via `scan-server.sh `.
4660
4761
48- Beamline Simulation
49- -------------------
50-
51- Subsequent sections use a simple beamline simulation.
62+ Test Beamline
63+ -------------
5264
53- While we will use the complete PyScanClient later,
54- fetch it now to obtain that simulation and run it like this::
65+ Subsequent sections use a simple test beamline.
66+ Run it like this::
5567
56- git clone https://github.com/PythonScanClient/PyScanClient.git
5768 cd PyScanClient/example
5869 softIoc -d ioc/simulation.db
5970
6071Assuming you fetched a binary for CS-Studio, start the associated GUI like this::
6172
62- unzip phoebus-linux.zip
73+ unzip phoebus-linux.zip
74+ rm phoebus-linux.zip
6375 cd phoebus-*/
64- ./phoebus.sh -resource /path/to/PyScanClient/example/opi/1_BeamLine.opi
76+ ./phoebus.sh -settings /path/to/my_settings.ini - resource /path/to/PyScanClient/example/opi/1_BeamLine.bob
6577
6678.. image :: simulation.png
6779
@@ -134,7 +146,6 @@ CS-Studio GUI
134146* In CS-Studio, invoke the menu Applications, Scan, Scan Monitor.
135147 You should see the last submitted scan as "Finished-OK",
136148 the others as simply "Logged".
137-
138149* Right-click on any scan and open the "Data Table".
139150* Right-click no the "Finished" scan and open the "Scan Editor".
140151* In the scan editor, right-click to "Submit scan".
@@ -158,11 +169,11 @@ CS-Studio GUI
158169 scans, or aborted.
159170* In the scan monitor, selet a few older scans, right-click on them and "Remove selected".
160171
161- In an operational setup, the scan monitor can be very useful to monitor
172+ The scan monitor is very useful to monitor
162173the progress of queued and active scans.
163174
164175The scan editor could be used to manually assemble small scans,
165- or to debug scans that have been submitted by other means.
176+ but it's mainly meant to debug scans that have been submitted by other means.
166177
167178The scan server will hold the commands of past scans in memory
168179and persist the logged data on disk, but this
@@ -177,9 +188,59 @@ it is thus suggested to manually remove information for older scans,
177188either by deleting selected scans or by invoking "Remove completed scans"
178189from the scan monitor context menu.
179190
180- PyScanClient
181- ------------
191+ Basic PyScanClient
192+ ------------------
193+
194+ Check the content of `example/commands1.py `
195+ and run it::
182196
197+ cd example
198+ python commands1.py
199+
200+
201+ .. literalinclude :: ../example/commands1.py
202+
203+ Note how the python script assembles a list of commands.
204+ It builds the recipe for one "scan", submits it to the scan server,
205+ and exits.
206+ The scan server then spends more than a minute to execute the submitted
207+ commands.
208+
209+ In the CS-Studio scan monitor, right-click on the running scan to open
210+ the "Scan Data Table" and watch how samples are added.
211+ This internal data logger is again not meant to replace data aquisition,
212+ but meant to assist in tracknig the progress of scans and to debug them.
213+
214+ For more on the available scan commands, read the other sections
215+ of this document.
216+
217+ CS-Studio GUI combined with PyScanClient
218+ ----------------------------------------
219+
220+ In CS-Studio, use the menu File, Open to open `PyScanClient/example/opi/2_XYScan.bob `.
221+ In addition to the beam, shutter and X/Y motors that we've already seen,
222+ it adds a "Scan" section. By default, it will scan both motors from 0 to 5,
223+ and at each position await 3 neutrons.
224+
225+ Press "Go!" and note how the Scan Monitor now shows a running "XY Scan".
226+ Right-click on the scan in the monitor, open the "Scan Data Table"
227+ and watch it add new data for each scanned position.
228+ Close the data table and instead open the "Scan Data Plot".
229+ From the "X Axis" drop-down, select "xpos", and from the "Value 1" drop-down select "ypos".
230+
231+ .. image :: scan_xy.png
232+
233+ Start the next scan after "Up/Down" is turned off and compare the motor positions in the plot.
234+
235+ Check "Simulate" to submit the scan for simulation, without actually executing it.
236+ Simulation can be useful to verify which commands will be created.
237+ It performs a simple run time estimate based on rate-of-change estimates that
238+ need to be configured on the scan server.
239+
240+ Default Device Settings
241+ -----------------------
242+
243+ TODO
183244
184245Production Setup
185246----------------
@@ -188,3 +249,6 @@ In the above example we executed the scan server within a terminal window.
188249A production setup would typically run it as a Linux service using `procServ `,
189250https://github.com/ralphlange/procServ
190251
252+ Both the scan server and the CS-Studio GUI are typically started by a site-specific
253+ launcher script that adds `-settings /path/to/site/settings.ini `.
254+
0 commit comments