The Scanning application replaces Scan1D and Scan2D, and allows an ND scan of any number of variables. The user can quickly select multiple PV values to scan or read, and the data are (as before) stored in XML files afterwards.
- Scan any number of variables
- Set max/min for each variable, and number of points.
- Limit the scan range by setting functional constraints
- Plot data from a measurement, overlap plots from multiple measurements
- Pause/continue measurement
- Stop/restart measurement (can also continue a partial measurement read from file)
- Automatic save after each measurement
The Menu Bar
The Menu bar is largely not implemented yet. There are only two buttons which work for the moment
File - Load
This will open a file dialog, where you can select a file. Files should have been saved as *.scan.xml for xml style, or *.scan.h5 if binary HDF5 based.
File - Save
This will save the file. If no file path has been selected yet (should show in top bar) then a file dialog is opened and you select where to save the file and what to call it. Remember to set the Use HDF5 before you open this one, if your intention is to use HDF5 format.
File - Save as
This will open a file dialog and you select where to save the file and what to name it. Remember to set the Use HDF5 before you open this one, if your intention is to use HDF5 format.
File - Exit
Exit the application
File - Use HDF5
Selection to set if you want to use HDF5 format or not.
A separate window, an "Add PV widget", is used to find and select parameters to read and scan, shown in the example screenshot above. A tree search of all sequences and nodes is visible in the left part of the window. In the example we have filtered on the words "QP" which shows quadrupoles only. One can select multiple nodes at once in this window (even select all using keyboard hotkeys, but it takes a short while for the right part of the window to update). In the right window one afterwards select the channels to add, and click the add button.The Type field on the right indicates if the channel is a read-only or a read/write channel.
In the example below, two BPM's and two horizontal correctors are selected. The fieldSet and fieldRB channels for the vertical correctors, and the xAvg channel from the BPM's are selected. When the user here clicks Add, all xAvg channels from all BPMs that are selected on the left will be added, as well as all fieldSet and fieldRB channels from the selected correctors will be added at once.
The "Add PV" window should afterwards be closed. You then proceed to select which variables to read and which to scan. Please note that it is unfortunately possible to select to scan the read-only channels. This will result in an error being thrown once you hit execute later on. The user is expected to know/remember which channels can be scanned (ie what channels are settable).
The Remove PV button can be used to remove selected channels.
Once at least one scan and at least one scan variable is selected, the Configure and Run tab becomes active
Configure scan ranges
The default scan range for each variable goes from -1 to 1 in 5 steps, relative to the setting when it was selected (so e.g. from 15 to 17 if the current setting is 16).
The first and last measurement point is always at the current settings, so a total of 7 measurement points is default if you select 1 variable to scan, 27 points for two variables etc.
The max and min point is always part of the scan range, so select an odd Npoints if you want the mid point included.
You may add up to four constraints. This is probably the easiest part to get wrong. You may use simple formulas to set the constraints, using the parameter names defined in the Var column. In the example below, we have said that we want to scan only for positive x1 (kind of meaningless as you could do same with the range itself) as well as ignoring any point outside x1**2 + x2**2 > 1.5. The constraint also applies to the first and last measurement, so here we are excluding the first and last measurement step (which is normally at initial conditions). The example will result in 8 measurement points instead of the original 27.
When you are done with this configuration, you may move to the Run tab.
Run a scan
The pre-calculate is needed to calculate how many measurement points you will have in your scan, applying the constraints you have defined in the previous step. Analysing these constraints is a slow process, which is why we make the user do this manually. If there are no constraints it is very quick.
Once you have clicked on the Pre-calculate, you are presented with the number of points you will have, and the estimated time to finish. The estimate is assuming that all PV's are responding immediately when setting a new value, so the real time may be longer but not shorter than the estimate.
You may now click on Execute, and will start seeing the result of your scan in the graph on your right.The bar below the Execute button will show you the progress, and the button will be disabled and text change to Running...
You are presented now with two new buttons, Pause and Stop. The Pause button will Pause the scan, but will not set the scan variables back to initial positions. If you click it, the button will change to Continue (which resumes the scan).
The Stop button will stop the measurement and move scan parameters back to their initial values. If this is done in the middle of a run, a third button. You are now in a state of "half finished measurement". If you click on Execute, the scan will resume, starting from the first point you did not yet scan (and use your old data). If you click on "Restart", your current data will be discarded, and you will start the scan from scratch.
Display the results
Once a scan has finished, the Display tab will become active. On this tab you will see a list of the currently finished scans. You may use your keyboard+mouse to select multiple measurements at once to display. In the example above we have two scans of just one variable, and only reading one BPM. The upper graph shows the parameters we read, and the bottom plot shows the variables we scan. This will be replaced by JFreeChart graphs soon, which will provide more features.
Read the data
The data is stored in a XML file, and the content looks like the one below. In this example there are two finished measurements (Measurement 1 and Measurement 2), and one ongoing (currentMeasurement). There is one variable scanned currently (scan_PVs), and one read (measure_PVs). Please note that the finished measurements can have completely different set of scan and read PVs. This should be reasonably straight forward to read by other analysis software later on. It has not yet been tested for huge datasets.
<?xml version = '1.0' encoding = 'UTF-8'?> <ScannerData date="2017-08-29 16:48" title="/Users/yngvelevinsen/openxal/apps/scanner/scanner.xml"> <measurements> <measurement title="Measurement 1"> <channel data="-0.01, -0.003333333333333333, 0.003333333333333334, 0.01" name="ST1-VC-PS:FldSet" type="w"/> <channel data="10.05930643089071, 7.641336598115021, 6.447907949709028, 5.147873327670883" name="BPM3:YAvg" type="r"/> </measurement> <measurement title="Measurement 2"> <channel data="-0.01, -0.003333333333333333, 0.003333333333333334, 0.01" name="ST1-VC-PS:FldSet" type="w"/> <channel data="8.878470155322715, 8.574706302665936, 5.232209122003606, 5.12321656147507" name="BPM3:YAvg" type="r"/> </measurement> </measurements> <scan_PVs> <PV instance="x1" max="0.01" min="-0.01" name="ST1-VC-PS:FldSet" npoints="4"/> </scan_PVs> <measure_PVs> <PV name="BPM3:YAvg"/> </measure_PVs> <constraints> <constraint value="x1*x1<=0.0001"/> </constraints> <currentMeasurement> <step values="-0.01, 9.570362062376438"/> <step values="-0.003333333333333333, 8.450486544734218"/> </currentMeasurement> </ScannerData>