Config files setup for EPICS systems¶
This notebook shows what config files you need and how to set them up.
Note that this setup will be improved in the future to be only one json files with all machine information, removing the need for different directories
NOTE! make sure your files are the only json files in the directory pyemittance/configs/ (delete or remove others).
Required files:
- beamline_info.json : measurements
- img_proc.json : required only if doing OTR image analysis (sigma units in meters, bg_im needs to be the path to the .npy file of the background image array)
- meas_pv_info.json : required PVs for measurement devices (OTR, wire, quad)
Optionally: 4. savepaths.json : required for defining directories for saving
The most important file for the emittance computation is
In [1]:
Copied!
import json
json.load(open("../../pyemittance/configs/LCLS_OTR3/beamline_info.json"))
import json
json.load(open("../../pyemittance/configs/LCLS_OTR3/beamline_info.json"))
Out[1]:
{'name': 'LCLS', 'Lquad': 0.108, 'energy': 135000000.0, 'Twiss0': [1e-06, 1e-06, 4.68280051, 4.68872767, -1.79636538, -1.79814306], 'rMatx': [1, 4.17, 0, 1], 'rMaty': [1, 4.17, 0, 1]}
The important params are:
- beam_info['Lquad'] : scanning quad effective length [m]
- beam_info['energy'] : beam energy [eV]
- beam_info['Twiss0'] : design Twiss at measurement location (e_x, e_y, beta_x, beta_y, alpha_x, alpha_y)
- beam_info['rMatx'], beam_info['rMaty'] : 2x2 transfer matrices for x, y from scanning to quad to OTR/screen, critical when there is more than a drift (quads, etc) in between, and this r-matrix takes into account those contributions (need to get from external model).
Load all configs¶
This will load all files into a dict
In [2]:
Copied!
from pyemittance.load_json_configs import load_configs
from pyemittance.load_json_configs import load_configs
In [3]:
Copied!
load_configs("../../pyemittance/configs/LCLS_OTR3/")
load_configs("../../pyemittance/configs/LCLS_OTR3/")
Out[3]:
{'beamline_info': {'name': 'LCLS', 'Lquad': 0.108, 'energy': 135000000.0, 'Twiss0': [1e-06, 1e-06, 4.68280051, 4.68872767, -1.79636538, -1.79814306], 'rMatx': [1, 4.17, 0, 1], 'rMaty': [1, 4.17, 0, 1]}, 'img_proc': {'subtract_bg': False, 'use_roi': False, 'avg_ims': True, 'n_to_acquire': 5, 'background_im': None, 'amp_threshold': 200, 'min_sigma': 2e-08, 'max_sigma': 0.1, 'max_samples': 3, 'roi': {'xmin': 0, 'xmax': 100, 'ymin': 0, 'ymax': 100}}, 'meas_pv_info': {'diagnostic': {'pv': {'name': 'OTRS:IN20:621', 'image': 'OTRS:IN20:621:IMAGE', 'nrow': 'OTRS:IN20:621:ROI_YNP', 'ncol': 'OTRS:IN20:621:ROI_XNP', 'resolution': 'OTRS:IN20:621:RESOLUTION', 'xsize': 'OTRS:IN20:621:XRMS', 'ysize': 'OTRS:IN20:621:YRMS'}}, 'meas_device': {'settle_time': 1, 'bounds': [-2, 2], 'pv': {'name': 'QUAD:IN20:525', 'cntrl': 'QUAD:IN20:525:BCTRL', 'read': 'QUAD:IN20:525:BACT'}}, 'beam_info': {'energy': 'REFS:IN20:751:EDES'}}, 'savepaths': {'fits': '/home/physics3/ml_tuning/20220803/saved_fits/', 'images': '/home/physics3/ml_tuning/20220803/saved_images/', 'monitoring': '/home/physics3/ml_tuning/20220803/monitoring/', 'summaries': '/home/physics3/ml_tuning/20220803/summaries/', 'raw_saves': '/home/physics3/ml_tuning/20220803/raw_saves/', 'emit_saves': '/home/physics3/ml_tuning/20220803/emit_saves/', 'mon_saves': '/home/physics3/ml_tuning/20220803/mon_saves/', 'xopt_saves': '/home/physics3/ml_tuning/20220803/xopt_saves/'}}