diff --git a/__EXAMPLES/main_files/EX_02_Main_long_ps_booster.py b/__EXAMPLES/main_files/EX_02_Main_long_ps_booster.py index 95e495994ed3ba4f145dac84115ce46b3258b86e..b5f935f8de98bebbc33389fae3190cc3a2a04466 100644 --- a/__EXAMPLES/main_files/EX_02_Main_long_ps_booster.py +++ b/__EXAMPLES/main_files/EX_02_Main_long_ps_booster.py @@ -102,9 +102,10 @@ bunchmonitor = BunchMonitor(ring, RF_sct_par, my_beam, var = str(kin_beam_energy / 1e9) # ejection kicker -Ekicker = np.loadtxt(this_directory + '../input_files/EX_02_Ekicker_1.4GeV.txt', skiprows=1, dtype=complex, converters={0: lambda s: - complex(bytes(s).decode('UTF-8').replace('i', 'j')), - 1: lambda s: complex(bytes(s).decode('UTF-8').replace('i', 'j'))}) +Ekicker = np.loadtxt(this_directory + '../input_files/EX_02_Ekicker_1.4GeV.txt', skiprows=1, dtype=complex, + encoding="utf-8", + converters={0: lambda s: complex(bytes(s, encoding="utf-8").decode('UTF-8').replace('i', 'j')), + 1: lambda y: complex(bytes(y, encoding="utf-8").decode('UTF-8').replace('i', 'j'))}) Ekicker_table = InputTable(Ekicker[:, 0].real, Ekicker[:, 1].real, Ekicker[:, 1].imag) diff --git a/__EXAMPLES/mpi_main_files/EX_02_Main_long_ps_booster.py b/__EXAMPLES/mpi_main_files/EX_02_Main_long_ps_booster.py index a3b147dfba278f728b495ecab508724cb772f8bc..0a391d52fd64a07c2fc9b9be43c68513fbfa7624 100644 --- a/__EXAMPLES/mpi_main_files/EX_02_Main_long_ps_booster.py +++ b/__EXAMPLES/mpi_main_files/EX_02_Main_long_ps_booster.py @@ -104,9 +104,10 @@ slice_beam = Profile(my_beam, CutOptions(cut_left=-5.72984173562e-7, var = str(kin_beam_energy / 1e9) # ejection kicker -Ekicker = np.loadtxt(this_directory + '../input_files/EX_02_Ekicker_1.4GeV.txt', skiprows=1, dtype=complex, converters={0: lambda s: - complex(bytes(s).decode('UTF-8').replace('i', 'j')), - 1: lambda s: complex(bytes(s).decode('UTF-8').replace('i', 'j'))}) +Ekicker = np.loadtxt(this_directory + '../input_files/EX_02_Ekicker_1.4GeV.txt', skiprows=1, dtype=complex, + encoding="utf-8", + converters={0: lambda s: complex(bytes(s, encoding="utf-8").decode('UTF-8').replace('i', 'j')), + 1: lambda y: complex(bytes(y, encoding="utf-8").decode('UTF-8').replace('i', 'j'))}) Ekicker_table = InputTable(Ekicker[:, 0].real, Ekicker[:, 1].real, Ekicker[:, 1].imag)