Skip to content

Commit 2cd54f9

Browse files
committed
Update tests
1 parent efd235e commit 2cd54f9

File tree

2 files changed

+6
-22
lines changed

2 files changed

+6
-22
lines changed

examples/Diagnostics/Tunes/test_tune_4d.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -166,21 +166,13 @@ def calc_norm_matrix_from_eigvecs(v1: np.ndarray, v2: np.ndarray) -> np.ndarray:
166166
# ------------------------------------------------------------------------------------
167167

168168
# Collect phase data from bunch
169-
phase_data = {}
170-
for i in range(bunch.getSize()):
171-
data = tune_node.getData(bunch, i)
172-
for key in data:
173-
if key in phase_data:
174-
phase_data[key].append(data[key])
175-
else:
176-
phase_data[key] = []
177-
169+
phase_data = tune_node.getData(bunch)
178170
phase_data = pd.DataFrame(phase_data)
179171
print(phase_data)
180172

181173
# Check average tune vs. transfer matrix
182-
tune_1_calc = np.mean(phase_data["tune_x"])
183-
tune_2_calc = np.mean(phase_data["tune_y"])
174+
tune_1_calc = np.mean(phase_data["tune_1"])
175+
tune_2_calc = np.mean(phase_data["tune_2"])
184176
tune_1_err = tune_1_calc - tune_1_true
185177
tune_2_err = tune_2_calc - tune_2_true
186178

examples/Diagnostics/Tunes/test_tune_4d_uncoupled.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,7 @@ def build_norm_matrix_from_twiss_2d(alpha: float, beta: float) -> np.ndarray:
120120
# ------------------------------------------------------------------------------------
121121

122122
# Collect phase data from bunch
123-
phase_data = {}
124-
for i in range(bunch.getSize()):
125-
data = tune_node.getData(bunch, i)
126-
for key in data:
127-
if key in phase_data:
128-
phase_data[key].append(data[key])
129-
else:
130-
phase_data[key] = []
131-
123+
phase_data = tune_node.getData(bunch)
132124
phase_data = pd.DataFrame(phase_data)
133125
print(phase_data)
134126

@@ -156,8 +148,8 @@ def build_norm_matrix_from_twiss_2d(alpha: float, beta: float) -> np.ndarray:
156148
# Check average tune vs. transfer matrix
157149
tune_1_true = lattice_params["fractional tune x"]
158150
tune_2_true = lattice_params["fractional tune y"]
159-
tune_1_calc = np.mean(phase_data["tune_x"])
160-
tune_2_calc = np.mean(phase_data["tune_y"])
151+
tune_1_calc = np.mean(phase_data["tune_1"])
152+
tune_2_calc = np.mean(phase_data["tune_2"])
161153
tune_1_err = tune_1_calc - tune_1_true
162154
tune_2_err = tune_2_calc - tune_2_true
163155

0 commit comments

Comments
 (0)