Simulated Screen¶
In [1]:
Copied!
%load_ext autoreload
%autoreload 2
%load_ext autoreload
%autoreload 2
In [2]:
Copied!
import matplotlib.pyplot as plt
import numpy as np
from pyemittance.load_json_configs import load_configs
import matplotlib.pyplot as plt
import numpy as np
from pyemittance.load_json_configs import load_configs
In [3]:
Copied!
CONFIG = load_configs('LCLS2_OTR0H04')
CONFIG.keys()
CONFIG = load_configs('LCLS2_OTR0H04')
CONFIG.keys()
Out[3]:
dict_keys(['beamline_info', 'img_proc', 'meas_pv_info', 'savepaths'])
In [4]:
Copied!
CONFIG['meas_pv_info']
CONFIG['meas_pv_info']
Out[4]:
{'diagnostic': {'pv': {'name': 'OTRS:HTR:330', 'image': 'OTRS:HTR:330:Image:ArrayData', 'nrow': 'OTRS:HTR:330:Image:ArraySize1_RBV', 'ncol': 'OTRS:HTR:330:Image:ArraySize0_RBV', 'resolution': 'OTRS:HTR:330:RESOLUTION', 'xsize': 'OTRS:HTR:330:XRMS', 'ysize': 'OTRS:HTR:330:YRMS'}}, 'meas_device': {'settle_time': 1, 'bounds': [-2, 2], 'pv': {'name': 'QUAD:HTR:120', 'cntrl': 'QUAD:HTR:120:BCTRL', 'read': 'QUAD:HTR:120:BACT'}}, 'beam_info': {'energy': ''}}
In [5]:
Copied!
from pyemittance.simulation import Screen
from pyemittance.simulation import Screen
Blank Screen¶
In [6]:
Copied!
S = Screen(noise=50)
bg = S.background()
plt.imshow(bg, vmax=128)
S = Screen(noise=50)
bg = S.background()
plt.imshow(bg, vmax=128)
Out[6]:
<matplotlib.image.AxesImage at 0x7f9b85b15370>
Screen with spot¶
In [7]:
Copied!
s = S.spot(mean_x = 0, mean_y = -.001, total_charge=100e-12,
sigma_x = 0.00001,
sigma_y = 0.000530470,
n_particle=100_000
)
plt.imshow(s+bg, vmax=128), s.std(), np.sum(s), s.max()
s = S.spot(mean_x = 0, mean_y = -.001, total_charge=100e-12,
sigma_x = 0.00001,
sigma_y = 0.000530470,
n_particle=100_000
)
plt.imshow(s+bg, vmax=128), s.std(), np.sum(s), s.max()
Out[7]:
(<matplotlib.image.AxesImage at 0x7f9b859eb1c0>, 130.44348154509655, 9785733, 6600)
In [8]:
Copied!
fig, ax = plt.subplots()
ax.imshow(s + bg, extent=1e3*np.array([S.xmin, S.xmax, S.ymin, S.ymax]), vmax=128)
ax.set_xlabel('x (mm)')
ax.set_ylabel('y (mm)')
fig, ax = plt.subplots()
ax.imshow(s + bg, extent=1e3*np.array([S.xmin, S.xmax, S.ymin, S.ymax]), vmax=128)
ax.set_xlabel('x (mm)')
ax.set_ylabel('y (mm)')
Out[8]:
Text(0, 0.5, 'y (mm)')