PyCtrl-AWA
Python library for online control and optimization of the AWA beamline.
How to run
Setting up the accelerator for Python control
- if wanting to use Frame Grabber cameras, the Frame Grabber application must be open and triggered/free run.
- if wanting to use Blackfly cameras, the following code should be executed
arv-tool-0.8
StartPhoebus.sh
StartPG.sh <valid IP address>
Running Python scripts
Currently the environment specification in environment.yml
and requirements. txt
are incorrect. Instead use
conda activate awa-badger-2
then open notebooks using
jupyter lab
Directory structure
- AWAControl - main python package for interacting with the AWA control system and limited analysis tools.
- control_notebooks - jupyter notebooks for implementing common procedures at AWA, ie. beamsize minimization, scans, beam alignment
- legacy - old code developed before the creation of AWAControl package
- tests - testing code
Basic usage
See below for a basic example of a quadrupole scan on DYG5 using DQ6. Results in a pandas dataframe containing measurement data (incl. extra computed quantities).
import time
import numpy as np
import pandas as pd
from AWAControl.badger.environments.awa import Environment
awa_env = Environment()
awa_env.screen_name = "DYG5"
quad_scan_values = np.linspace(-2,2,10)
measurements = []
for value in quad_scan_values:
# set quadrupole strengths
awa_env.set_variables({"DQ6": value})
# wait a second for the power supply to settle
time.sleep(1.0)
# measure rms beamsize
measurements.append(awa_env.get_observables(["Sx","Sy"]))
measurements = pd.DataFrame(measurements)