Skip to content

Commit 19cd03b

Browse files
committed
orm and disp ideal measurement + new commit of pySC
1 parent e4e009f commit 19cd03b

File tree

3 files changed

+56
-8
lines changed

3 files changed

+56
-8
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import json
2+
from pathlib import Path
3+
4+
import numpy as np
5+
6+
from pyaml.accelerator import Accelerator
7+
from pyaml.tuning_tools.dispersion import ConfigModel as Disp_ConfigModel
8+
from pyaml.tuning_tools.dispersion import Dispersion
9+
from pyaml.tuning_tools.orbit_response_matrix import ConfigModel as ORM_ConfigModel
10+
from pyaml.tuning_tools.orbit_response_matrix import OrbitResponseMatrix
11+
12+
parent_folder = Path(__file__).parent
13+
config_path = parent_folder.parent.parent.joinpath(
14+
"tests", "config", "EBSOrbit.yaml"
15+
).resolve()
16+
sr = Accelerator.load(config_path)
17+
element_holder = sr.design
18+
19+
orm = OrbitResponseMatrix(
20+
cfg=ORM_ConfigModel(
21+
bpm_array_name="BPM",
22+
hcorr_array_name="HCorr",
23+
vcorr_array_name="VCorr",
24+
corrector_delta=1e-6,
25+
),
26+
element_holder=element_holder,
27+
)
28+
29+
orm.measure()
30+
31+
orm_data = orm.get()
32+
33+
dispersion = Dispersion(
34+
cfg=Disp_ConfigModel(
35+
bpm_array_name="BPM",
36+
rf_plant_name="RF",
37+
frequency_delta=10,
38+
),
39+
element_holder=element_holder,
40+
)
41+
42+
dispersion.measure()
43+
dispersion_data = dispersion.get()
44+
rf_response = (
45+
dispersion_data["frequency_response_x"] + dispersion_data["frequency_response_y"]
46+
)
47+
48+
ideal_ORM_data = {
49+
"matrix": orm_data["matrix"],
50+
"input_names": orm_data["input_names"],
51+
"output_names": orm_data["output_names"],
52+
"rf_response": rf_response,
53+
}
54+
55+
json.dump(ideal_ORM_data, open("ideal_orm_disp.json", "w"), indent=4)

pyaml/external/pySC_interface.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,3 @@ def set_many(self, names_values: Dict[str, float]) -> None:
158158
) # ideally set_and_wait but not implemented
159159

160160
return
161-
162-
def get_rf_main_frequency(self) -> float:
163-
return self.rf_plant.frequency.get()
164-
165-
def set_rf_main_frequency(self, value: float) -> None:
166-
self.rf_plant.frequency.set(value)
167-
return

0 commit comments

Comments
 (0)