@@ -409,19 +409,23 @@ class CutRFBucket6D(ParticleGenerator):
409409 the optics resp. TWISS parameters taken from a TransverseMap
410410 instance. The longitudinal phase space is initialised as a
411411 bi-gaussian with given sigma_z and sigma_dp which is then cut along
412- the funciotn given by is_accepted which is typically the function
413- is_in_separatrix of the rfbucket instance of the longitudinal map.
414- To avoid bucket leakage and particle losses as a consequence of the
415- unmatched initialisation, a margin / tolerance can be specified by
416- the argument margin (in % of RFBucket.Hmax, 5% by default), so that
417- particles will not be initialised too close to the separatrix. The
418- boundary will in fact be given by the equihamiltonian with a value
419- of margin*Hmax.
412+ the function given by is_accepted. The usual choices for
413+ is_accepted are either RFBucket.is_in_separatrix or
414+ RFBucket.is_accepted . The former strictly follows the separatrix
415+ of the bucket (the equihamiltonian with a value of 0), while with
416+ the latter, tighter boundaries can be used (equihamiltonian lying
417+ inside the RFBucket) as a result of which particles are not
418+ initialised too close to the separatrix. This option is usually
419+ preferred as it avoids bucket leakage and particle losses which may
420+ occur as a consequence of the unmatched initialisation. The
421+ RFBucket.is_accepted method must be created first however, by
422+ calling the RFBucket.make_is_accepted(margin) method with a certain
423+ value for the margin (in % of RFBucket.Hmax, 5% by default).
420424 '''
421425 def __init__ (self , macroparticlenumber , intensity , charge , mass ,
422426 circumference , gamma_reference ,
423427 transverse_map , epsn_x , epsn_y ,
424- sigma_z , sigma_dp , is_accepted , margin = 0.05 ,
428+ sigma_z , sigma_dp , is_accepted ,
425429 * args , ** kwargs ):
426430 '''Uses the transverse_map to extract the optics parameters
427431 and the rf_bucket to match the longitudinal distribution.
@@ -433,7 +437,7 @@ def __init__(self, macroparticlenumber, intensity, charge, mass,
433437 self ._rf_bucket_matcher = CutRFBucket2D (
434438 macroparticlenumber , intensity , charge , mass ,
435439 circumference , gamma_reference ,
436- sigma_z , sigma_dp , is_accepted , margin , * args , ** kwargs )
440+ sigma_z , sigma_dp , is_accepted , * args , ** kwargs )
437441 super (CutRFBucket6D , self ).__init__ (
438442 macroparticlenumber , intensity , charge , mass , circumference ,
439443 gamma_reference , HEADTAILcoords .coordinates , * args , ** kwargs )
@@ -478,27 +482,29 @@ def distribute(self):
478482
479483
480484class CutRFBucket2D (ParticleGenerator ):
481- '''
482- For HEADTAIL style matching into RF bucket.
483- The argument is_accepted takes a function (usually
484- RFBucket.is_in_separatrix) defining the separatrix of the rf bucket.
485- To avoid bucket leakage and particle losses as a consequence of the
486- unmatched initialisation, a margin / tolerance can be specified by
487- the argument margin (in % of RFBucket.Hmax, 5% by default), so that
488- particles will not be initialised too close to the separatrix. The
489- boundary will in fact be given by the equihamiltonian with a value
490- of margin*Hmax.
485+ '''For HEADTAIL style matching into RF bucket.
486+ The argument is_accepted takes a function (i.e. reference to a
487+ function). The usual choices are RFBucket.is_in_separatrix or
488+ RFBucket.is_accepted . The former strictly follows the separatrix
489+ of the bucket (the equihamiltonian with a value of 0), while with
490+ the latter, tighter boundaries can be used (equihamiltonian lying
491+ inside the RFBucket) as a result of which particles are not
492+ initialised too close to the separatrix. This option is usually
493+ preferred as it avoids bucket leakage and particle losses which may
494+ occur as a consequence of the unmatched initialisation.
495+ The RFBucket.is_accepted method must be created first however, by
496+ calling the RFBucket.make_is_accepted(margin) method with a certain
497+ value for the margin (in % of RFBucket.Hmax, 5% by default).
491498
492499 BY KEVIN: NEEDS TO BE CLEANED UP BY ADRIAN!
493500 '''
494501 def __init__ (self , macroparticlenumber , intensity , charge , mass ,
495502 circumference , gamma_reference , sigma_z , sigma_dp ,
496- is_accepted , margin = 0.05 , * args , ** kwargs ):
503+ is_accepted , * args , ** kwargs ):
497504
498505 self .sigma_z = sigma_z
499506 self .sigma_dp = sigma_dp
500507 self .is_accepted = is_accepted
501- self .margin = margin
502508
503509 super (CutRFBucket2D , self ).__init__ (
504510 macroparticlenumber , intensity , charge , mass , circumference ,
@@ -514,12 +520,12 @@ def distribute(self):
514520
515521 def _redistribute (self , z , dp ):
516522
517- mask_out = ~ self .is_accepted (z , dp , self . margin )
523+ mask_out = ~ self .is_accepted (z , dp )
518524 while mask_out .any ():
519525 n_gen = np .sum (mask_out )
520526 z [mask_out ] = normal (0 , self .sigma_z , n_gen )
521527 dp [mask_out ] = normal (0 , self .sigma_dp , n_gen )
522- mask_out = ~ self .is_accepted (z , dp , self . margin )
528+ mask_out = ~ self .is_accepted (z , dp )
523529 self .prints ('Reiterate on non-accepted particles' )
524530
525531
0 commit comments