Sweep shell script

Sweep shell script

A shell script has been developed for sweeping EPICS variables and recording the response. The tool is very flexible and can be used for a variety of tasks during system configuration and operation.

Download the script

General description

Let's take a look at the usage directions for the script:

Usage: sweep.sh [-p] [-d delay] [-b N] CTRL MONITOR START STEP STOP
  CTRL       - EPICS channel to sweep
  MONITOR    - EPICS channel to record
  START      - Start value for the sweep
  STEP       - Increment step
  STOP       - Stop value for the sweep
  [-p]       - Plot option, uses octave to generate the sweep plot (sweep.eps)
  [-d delay] - Set delay between steps (defaults to 2 seconds)
  [-b N]     - Bunch number to monitor (defaults to 1)

By default the script will step the EPICS variable specified by CTRL through the range defined by START, STEP, and STOP. At each setting the script pauses for an adjustable period of time and then acquires the monitor value from the EPICS channel MONITOR. Upon completion the script prints out two columns of data: settings of the control channel and the monitor channel values.

Sweep plot With -p option the script also generates a plot of sweep results, as illustrated on the right. This plot is generated by sweeping the ADC delay with the input driven by a short unipolar pulse.


  • -p - When this option is specified, the script will create an 2-D plot of sweep results. Requires working GNU octave. The plot is saved in sweep.eps
  • -d delay - Sets the delay between steps in seconds. The delay is needed for the data acquisition to update after the setting. Longer delays might be necessary when acquisition update rate is less than 1 Hz.
  • -b N - When monitor channel is a waveform PV, this option allows to specify any element of the waveform to monitor.

Usage examples

Amplitude detection setup

sweep.sh -p -b 46 IGPF:LFB:PHASE_SERVO:SETPT IGPF:LFB:MEAN 0 100 2000

Here we are sweeping the front-end phase shifter from 0 to 2000 with steps of 100 and recording the mean value of bunch 46. After sweeping a plot is generated.

Rough front-end timing

sweep.sh -p -b 46 IGPF:LFB:TADC IGPF:LFB:MEAN 0 500 1500

Here we are sweeping the ADC DELAY and recording the mean — front-end is expected to be in the amplitude detection state

Phase detector setup


Here we are sweeping the front-end phase shifter from 0 to 2000 with steps of 100 and recording the mean value of bunch 1. From this sweep one can determine phase shifter setting that produces phase-detection (no offset in the filled bucket relative to the empty buckets).

Optimizing back-end carrier phase

sweep.sh -p -b 137 IGPF:LFB:WRT:BE_PHASE IGPF:LFB:RMS 0 50 2000

Now we are sweeping the back-end phase shifter and recording the RMS motion of bunch 137. Maximum RMS corresponds to the optimal back-end carrier phase.

DAC clock timing

sweep.sh -p IGPF:LFB:TDAC IGPF:LFB:RMS 0 50 1950

The DAC clock is swept in 50 ps steps through the 1.95 ns range (proper settings for 500 MHz) and the RMS amplitude of the first bunch is recorded

Final front-end timing

sweep.sh -p IGPF:LFB:TADC IGPF:LFB:RMS 0 50 1950

Sweeping the ADC clock through the 1.95 ns range gives us the front-end response.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
support/tools/sweep_script.txt · Last modified: 2008/09/25 22:00 by dimtel
© 2008-2023 Dimtel, Inc.