Skip to content

Commit 281c5f5

Browse files
authored
Merge pull request #135 from python-accelerator-middle-layer/add-chromaticity-bessy2
Added chroma measurement BESSY2
2 parents 56bfb70 + 841f780 commit 281c5f5

3 files changed

Lines changed: 54 additions & 3 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
type: pyaml.accelerator
2+
facility: BESSY2
3+
machine: sr
4+
energy: 1.7e9
5+
simulators:
6+
- type: pyaml.lattice.simulator
7+
lattice: bessy2.mat
8+
name: design
9+
controls:
10+
- type: pyaml_cs_oa.controlsystem
11+
prefix: 'pons:'
12+
name: live
13+
data_folder: /data/store
14+
devices:
15+
- type: pyaml.diagnostics.tune_monitor
16+
name: BETATRON_TUNE
17+
tune_h:
18+
type: pyaml_cs_oa.epicsR
19+
read_pvname: beam:twiss:x:tune
20+
unit: ''
21+
tune_v:
22+
type: pyaml_cs_oa.epicsR
23+
read_pvname: beam:twiss:y:tune
24+
unit: ''
25+
- type: pyaml.diagnostics.chromaticity_monitor
26+
name: KSI
27+
betatron_tune: BETATRON_TUNE
28+
RFfreq: RF
29+
fit_order: 1
30+
N_tune_meas: 1
31+
N_step: 5
32+
Sleep_between_meas: 0
33+
Sleep_between_RFvar: 2
34+
E_delta: 1e-3
35+
Max_E_delta: 1e-3
36+
- type: pyaml.rf.rf_plant
37+
name: RF
38+
masterclock:
39+
type: pyaml_cs_oa.epicsW
40+
write_pvname: MCLKHX251C:freq
41+
unit: KHz
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from pyaml.accelerator import Accelerator
2+
3+
sr = Accelerator.load("BESSY2Chroma.yaml")
4+
sr.design.get_lattice().disable_6d()
5+
# Retreive MCF from the model
6+
alphac = sr.design.get_lattice().get_mcf()
7+
print(f"Moment compaction factor: {alphac}")
8+
chromaticity_monitor = sr.live.get_chromaticity_monitor("KSI")
9+
chromaticity_monitor.chromaticity_measurement(do_plot=True, alphac=alphac)
10+
ksi = chromaticity_monitor.chromaticity.get()
11+
print(ksi)

pyaml/diagnostics/chromaticity_monitor.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,18 +283,17 @@ def fit_chromaticity(self, delta, NuX, NuY, order, do_plot):
283283
if o == 1:
284284
dp = "dp/p"
285285
elif o >= 1:
286-
dp = "(dp/p)$^2$"
286+
dp = f"(dp/p)$^{o}$"
287287

288288
title += f"{coefs[o]:.4f} {dp}"
289289
if o != 0:
290290
title += " + "
291291

292-
print(title)
293292
ax.plot(delta, np.polyval(coefs[::-1], delta))
294293
ax.set_title(title)
295294
ax.set_xlabel("Momentum Shift, dp/p [%]")
296295
ax.set_ylabel("%s Tune" % ["Horizontal", "Vertical"][i])
297-
ax.legend()
296+
# ax.legend()
298297

299298
if do_plot:
300299
fig.tight_layout()

0 commit comments

Comments
 (0)