From e0afa4882d7b349d1513994eb991c876ea9a7516 Mon Sep 17 00:00:00 2001 From: Gamelin Alexis <alexis.gamelin@synchrotron-soleil.fr> Date: Thu, 2 Mar 2023 18:09:31 +0100 Subject: [PATCH] [Fix] read_ABCI Fix transverse wake sign and add Wydip component which was missing. --- mbtrack2/utilities/read_impedance.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/mbtrack2/utilities/read_impedance.py b/mbtrack2/utilities/read_impedance.py index 103cbce..52e4d3a 100644 --- a/mbtrack2/utilities/read_impedance.py +++ b/mbtrack2/utilities/read_impedance.py @@ -161,9 +161,9 @@ def read_ABCI(file, azimuthal=False): Path to ABCI .pot file. azimuthal : bool, optional If True, the transverse wake potential and impedance is loaded from the - "AZIMUTHAL" data. In that case, a -1 factor is applied on the wake to - agree with mbtrack2 sign convention. - If False, it is loaded from the "TRANSVERSE" data. + "AZIMUTHAL" data. + If False, it is loaded from the "TRANSVERSE" data. In that case, a -1 + factor is applied on the wake to agree with mbtrack2 sign convention. The default is False. Returns @@ -202,6 +202,8 @@ def read_ABCI(file, azimuthal=False): names=["Time","Wake"]) df["Time"] = df["Time"] / c df["Wake"] = df["Wake"] * 1e-12 + if (not azimuthal) and (file_type[-3:] == "dip"): + df["Wake"] = df["Wake"] * -1 df.set_index("Time", inplace = True) result = WakeFunction(variable = df.index, function = df["Wake"], @@ -250,9 +252,15 @@ def read_ABCI(file, azimuthal=False): tmp.writelines(body) tmp.flush() tmp.close() - comp = _read_temp(tmp.name, abci_dict[header[0]]) + if abci_dict[header[0]][1:] == "long": + comp = _read_temp(tmp.name, abci_dict[header[0]]) + wake_list.append(comp) + else: + comp_x = _read_temp(tmp.name, "Wxdip") + comp_y = _read_temp(tmp.name, "Wydip") + wake_list.append(comp_x) + wake_list.append(comp_y) os.unlink(tmp.name) - wake_list.append(comp) elif (abci_dict[header[0]][0] == "Z") and (abci_dict[header[0]][-2:] == "re"): tmp1 = NamedTemporaryFile(delete=False, mode = "w+") tmp1.writelines(body) -- GitLab