@@ -132,12 +132,12 @@ def __init__(self, wake_file, wake_file_columns, *args, **kwargs):
132132
133133 wake_data = np .loadtxt (wake_file )
134134 if len (wake_file_columns ) != wake_data .shape [1 ]:
135- raise ValueError (' Length of wake_file_columns list does not \n ' +
136- ' correspond to the number of columns in \n ' +
137- 'the specified wake_file. \n ' )
135+ raise ValueError (" Length of wake_file_columns list does not" +
136+ " correspond to the number of columns in the" +
137+ " specified wake_file. \n " )
138138 if 'time' not in wake_file_columns :
139- raise ValueError ("No wake_file_column with name 'time' has \n " +
140- "been specified. \n " )
139+ raise ValueError ("No wake_file_column with name 'time' has" +
140+ " been specified. \n " )
141141
142142 for i , column_name in enumerate (wake_file_columns ):
143143 self .wake_table .update ({ column_name : wake_data [:,i ] })
@@ -151,49 +151,49 @@ def get_wake_kicks(self, slicer_mode):
151151
152152 # Constant wake kicks.
153153 if self ._is_provided ('constant_x' ):
154- wake_function = self ._function_transverse ('constant_x' )
154+ wake_function = self .function_transverse ('constant_x' )
155155 wake_kicks .append (ConstantWakeKickX (wake_function , slicer_mode ))
156156
157157 if self ._is_provided ('constant_y' ):
158- wake_function = self ._function_transverse ('constant_y' )
158+ wake_function = self .function_transverse ('constant_y' )
159159 wake_kicks .append (ConstantWakeKickY (wake_function , slicer_mode ))
160160
161161 if self ._is_provided ('longitudinal' ):
162- wake_function = self ._function_longitudinal ( 'longitudinal' )
162+ wake_function = self .function_longitudinal ( )
163163 wake_kicks .append (ConstantWakeKickZ (wake_function , slicer_mode ))
164164
165165 # Dipolar wake kicks.
166166 if self ._is_provided ('dipole_x' ):
167- wake_function = self ._function_transverse ('dipole_x' )
167+ wake_function = self .function_transverse ('dipole_x' )
168168 wake_kicks .append (DipoleWakeKickX (wake_function , slicer_mode ))
169169
170170 if self ._is_provided ('dipole_y' ):
171- wake_function = self ._function_transverse ('dipole_y' )
171+ wake_function = self .function_transverse ('dipole_y' )
172172 wake_kicks .append (DipoleWakeKickY (wake_function , slicer_mode ))
173173
174174 if self ._is_provided ('dipole_xy' ):
175- wake_function = self ._function_transverse ('dipole_xy' )
175+ wake_function = self .function_transverse ('dipole_xy' )
176176 wake_kicks .append (DipoleWakeKickXY (wake_function , slicer_mode ))
177177
178178 if self ._is_provided ('dipole_yx' ):
179- wake_function = self ._function_transverse ('dipole_yx' )
179+ wake_function = self .function_transverse ('dipole_yx' )
180180 wake_kicks .append (DipoleWakeKickYX (wake_function , slicer_mode ))
181181
182182 # Quadrupolar wake kicks.
183183 if self ._is_provided ('quadrupole_x' ):
184- wake_function = self ._function_transverse ('quadrupole_x' )
184+ wake_function = self .function_transverse ('quadrupole_x' )
185185 wake_kicks .append (QuadrupoleWakeKickX (wake_function , slicer_mode ))
186186
187187 if self ._is_provided ('quadrupole_y' ):
188- wake_function = self ._function_transverse ('quadrupole_y' )
188+ wake_function = self .function_transverse ('quadrupole_y' )
189189 wake_kicks .append (QuadrupoleWakeKickY (wake_function , slicer_mode ))
190190
191191 if self ._is_provided ('quadrupole_xy' ):
192- wake_function = self ._function_transverse ('quadrupole_xy' )
192+ wake_function = self .function_transverse ('quadrupole_xy' )
193193 self .kicks .append (QuadrupoleWakeKickXY (wake_function , slicer_mode ))
194194
195195 if self ._is_provided ('quadrupole_yx' ):
196- wake_function = self ._function_transverse ('quadrupole_yx' )
196+ wake_function = self .function_transverse ('quadrupole_yx' )
197197 wake_kicks .append (QuadrupoleWakeKickYX (wake_function , slicer_mode ))
198198
199199 return wake_kicks
@@ -210,7 +210,7 @@ def _is_provided(self, wake_component):
210210 # 'constructor to display valid names. \n')
211211 return False
212212
213- def _function_transverse (self , wake_component ):
213+ def function_transverse (self , wake_component ):
214214 """ Defines and returns the wake(beta, dz) function for the
215215 given wake_component (transverse). Data from the wake table are
216216 used, but first converted to SI units assuming that time is
@@ -252,7 +252,7 @@ def wake(beta, dz):
252252 ' does not meet requirements.' )
253253 return wake
254254
255- def _function_longitudinal (self , wake_component ):
255+ def function_longitudinal (self ):
256256 """ Defines and returns the wake(beta, dz) function for the
257257 given wake_component (longitudinal). Data from the wake table
258258 are used, but first converted to SI units assuming that time is
@@ -271,7 +271,7 @@ def _function_longitudinal(self, wake_component):
271271 convert_to_V_per_C = 1e12
272272
273273 time = convert_to_s * self .wake_table ['time' ]
274- wake_strength = - convert_to_V_per_C * self .wake_table [wake_component ]
274+ wake_strength = - convert_to_V_per_C * self .wake_table ['longitudinal' ]
275275
276276 def wake (beta , dz ):
277277 wake_interpolated = interp1d (time , wake_strength )(- dz / (beta * c ))
@@ -282,8 +282,8 @@ def wake(beta, dz):
282282 elif time [0 ] < 0 :
283283 return wake_interpolated
284284 else :
285- raise ValueError (wake_component + ' \n ' +
286- 'does not meet requirements.' )
285+ raise ValueError ('Longitudinal wake component does not meet ' +
286+ ' requirements.' )
287287 return wake
288288
289289
@@ -322,32 +322,32 @@ def get_wake_kicks(self, slicer_mode):
322322
323323 # Dipole wake kick x.
324324 if self .Yokoya_X1 :
325- wake_function = self ._function_transverse (self .Yokoya_X1 )
325+ wake_function = self .function_transverse (self .Yokoya_X1 )
326326 wake_kicks .append (DipoleWakeKickX (wake_function , slicer_mode ))
327327
328328 # Quadrupole wake kick x.
329329 if self .Yokoya_X2 :
330- wake_function = self ._function_transverse (self .Yokoya_X2 )
330+ wake_function = self .function_transverse (self .Yokoya_X2 )
331331 wake_kicks .append (QuadrupoleWakeKickX (wake_function , slicer_mode ))
332332
333333 # Dipole wake kick y.
334334 if self .Yokoya_Y1 :
335- wake_function = self ._function_transverse (self .Yokoya_Y1 )
335+ wake_function = self .function_transverse (self .Yokoya_Y1 )
336336 wake_kicks .append (DipoleWakeKickY (wake_function , slicer_mode ))
337337
338338 # Quadrupole wake kick y.
339339 if self .Yokoya_Y2 :
340- wake_function = self ._function_transverse (self .Yokoya_Y2 )
340+ wake_function = self .function_transverse (self .Yokoya_Y2 )
341341 wake_kicks .append (QuadrupoleWakeKickY (wake_function , slicer_mode ))
342342
343343 # Constant wake kick z.
344344 if self .switch_Z :
345- wake_function = self ._function_longitudinal ( 1 )
345+ wake_function = self .function_longitudinal ( )
346346 wake_kicks .append (ConstantWakeKickZ (wake_function , slicer_mode ))
347347
348348 return wake_kicks
349349
350- def _function_transverse (self , Yokoya_factor ):
350+ def function_transverse (self , Yokoya_factor ):
351351 """ Define the wake function (transverse) of a resonator with
352352 the given parameters according to Alex Chao's resonator model
353353 (Eq. 2.82) and definitions of the resonator in HEADTAIL. """
@@ -369,7 +369,7 @@ def wake(beta, dz):
369369 return y
370370 return wake
371371
372- def _function_longitudinal (self , Yokoya_factor ):
372+ def function_longitudinal (self ):
373373 """ Define the wake function (longitudinal) of a resonator with
374374 the given parameters according to Alex Chao's resonator model
375375 (Eq. 2.82) and definitions of the resonator in HEADTAIL. """
@@ -380,15 +380,15 @@ def _function_longitudinal(self, Yokoya_factor):
380380 def wake (beta , dz ):
381381 dt = dz .clip (max = 0 ) / (beta * c )
382382 if self .Q > 0.5 :
383- y = (- Yokoya_factor * (np .sign (dz ) - 1 ) * self .R_shunt *
384- alpha * np .exp (alpha * dt ) * (cos (omegabar * dt ) +
383+ y = (- (np .sign (dz ) - 1 ) * self .R_shunt * alpha *
384+ np .exp (alpha * dt ) * (cos (omegabar * dt ) +
385385 alpha / omegabar * sin (omegabar * dt )))
386386 elif self .Q == 0.5 :
387- y = (- Yokoya_factor * (np .sign (dz ) - 1 ) * self .R_shunt *
388- alpha * np .exp (alpha * dt ) * (1. + alpha * dt ))
387+ y = (- (np .sign (dz ) - 1 ) * self .R_shunt * alpha *
388+ np .exp (alpha * dt ) * (1. + alpha * dt ))
389389 elif self .Q < 0.5 :
390- y = (- Yokoya_factor * (np .sign (dz ) - 1 ) * self .R_shunt *
391- alpha * np .exp (alpha * dt ) * (np .cosh (omegabar * dt ) +
390+ y = (- (np .sign (dz ) - 1 ) * self .R_shunt * alpha *
391+ np .exp (alpha * dt ) * (np .cosh (omegabar * dt ) +
392392 alpha / omegabar * np .sinh (omegabar * dt )))
393393 return y
394394 return wake
@@ -454,27 +454,27 @@ def get_wake_kicks(self, slicer_mode):
454454
455455 # Dipole wake kick x.
456456 if self .Yokoya_X1 :
457- wake_function = self ._function_transverse (self .Yokoya_X1 )
457+ wake_function = self .function_transverse (self .Yokoya_X1 )
458458 wake_kicks .append (DipoleWakeKickX (wake_function , slicer_mode ))
459459
460460 # Quadrupole wake kick x.
461461 if self .Yokoya_X2 :
462- wake_function = self ._function_transverse (self .Yokoya_X2 )
462+ wake_function = self .function_transverse (self .Yokoya_X2 )
463463 wake_kicks .append (QuadrupoleWakeKickX (wake_function , slicer_mode ))
464464
465465 # Dipole wake kick y.
466466 if self .Yokoya_Y1 :
467- wake_function = self ._function_transverse (self .Yokoya_Y1 )
467+ wake_function = self .function_transverse (self .Yokoya_Y1 )
468468 wake_kicks .append (DipoleWakeKickY (wake_function , slicer_mode ))
469469
470470 # Quadrupole wake kick y.
471471 if self .Yokoya_Y2 :
472- wake_function = self ._function_transverse (self .Yokoya_Y2 )
472+ wake_function = self .function_transverse (self .Yokoya_Y2 )
473473 wake_kicks .append (QuadrupoleWakeKickY (wake_function , slicer_mode ))
474474
475475 return wake_kicks
476476
477- def _function_transverse (self , Yokoya_factor ):
477+ def function_transverse (self , Yokoya_factor ):
478478 """ Define the wake function (transverse) of a resistive wall
479479 with the given parameters. """
480480 Z0 = physical_constants ['characteristic impedance of vacuum' ][0 ]
0 commit comments