Skip to content

random values in track with seed vary with a cycle of 2 or 3 #978

@oscarxblanco

Description

@oscarxblanco

Dear all,
the implementation in #839 includes the possibility to store the sequence of random numbers used in WHITENOISE mode of a VariableThinMultipole element. For example in pyat, and using the development branch for #839

>>> elewhitenoise = at.VariableThinMultipole('ELEWHITENOISE',1,AmplitudeA=0.001,BufferSizeA=5)
>>> print(elewhitenoise)
VariableThinMultipole:
       FamName: ELEWHITENOISE
        Length: 0.0
    PassMethod: VariableThinMPolePass
    AmplitudeA: [0.001]
       BufferA: [-0.83140061  0.          0.          0.          0.        ]
   BufferSizeA: 5
      MaxOrder: 0
          Mode: 1.0
      PolynomA: [0.]
      PolynomB: [0.]

After enclosing the element in a single element lattice I check the tracking using the parameter 'seed' and I expected to get the same sequence on every call. However, I get the same cycle every two calls to track. I show the track call and the BufferA content.

>>> zout,*_ = thering.track(zin[:,0], nturns=5, seed=3)
>>> elewhitenoise.BufferA
array([-0.83140061,  1.45306833, -0.23518121,  1.0137116 ,  0.78605775])
>>> zout,*_ = thering.track(zin[:,0], nturns=5, seed=3)
>>> elewhitenoise.BufferA
array([ 1.45306833, -0.23518121,  1.0137116 ,  0.78605775,  1.14049689])
>>> zout,*_ = thering.track(zin[:,0], nturns=5, seed=3)
>>> elewhitenoise.BufferA
array([-0.83140061,  1.45306833, -0.23518121,  1.0137116 ,  0.78605775])
>>> zout,*_ = thering.track(zin[:,0], nturns=5, seed=3)
>>> elewhitenoise.BufferA
array([ 1.45306833, -0.23518121,  1.0137116 ,  0.78605775,  1.14049689])

From the discussion in #879 about the random number generator I know there are two numbers to control the sequence: initstate amd initsequence.
Is this the behavior due to missing initstate or initsequence ? if that is the case, How should I pass them ? How could I make it compatible with the VariableThinMultipole element ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions