diff --git a/blond/input_parameters/rf_parameters.py b/blond/input_parameters/rf_parameters.py index 984645b6ead6ffe790351f0d8635e231937257cf..8de9e8412d200291afdb1c049b58d86e3a833512 100644 --- a/blond/input_parameters/rf_parameters.py +++ b/blond/input_parameters/rf_parameters.py @@ -505,14 +505,13 @@ def calculate_phi_s(RFStation, Particle=Proton(), denergy = np.append(RFStation.delta_E, RFStation.delta_E[-1]) acceleration_ratio = denergy / (Particle.charge * RFStation.voltage[0, :]) - acceleration_test = np.where((acceleration_ratio > -1) * - (acceleration_ratio < 1) is False)[0] - + acceleration_test = ((acceleration_ratio > -1) & (acceleration_ratio < 1)) == 0 + # Validity check on acceleration_ratio - if acceleration_test.size > 0: + if np.count_nonzero(acceleration_test) > 0: print("WARNING in calculate_phi_s(): acceleration is not " + "possible (momentum increment is too big or voltage too " + - "low) at index " + str(acceleration_test)) + "low) at index " + str(acceleration_test.nonzero()[0])) phi_s = np.arcsin(acceleration_ratio)