bmad-sim / SimUtils.jl

Utility functions for scientific simulations.
https://bmad-sim.github.io/SimUtils.jl/
GNU Lesser General Public License v2.1
0 stars 1 forks source link

Random number generator with arbitrary (pink) power spectrum and element-to-element correlations #6

Open DavidSagan opened 1 year ago

DavidSagan commented 1 year ago

When using long_term_tracking with ramper elements simulating noise (EG ground motion or Rf noise), the use of the ran() or ran_gauss() function generates noise that has a white spectrum. This is probably not a good approximation for something like ground motion whose spectrum will typically be in the 0 - 10 Hz range.

There are two issues to worry about:

In terms of constructing a random number generator with an arbitrary power spectrum see, for example: https://dsp.stackexchange.com/questions/47640/generating-a-timeseries-with-an-arbitrary-power-spectrum The problem with this method is that the number of random values to generate needs to be known beforehand. Another possibility is to use a lowpass LRC filter network.

DavidSagan commented 1 year ago

Thought: Use the algorithm: Timmer, J. and Koenig, M.: On generating power law noise. Astron. Astrophys. 300, 707-710 (1995)

Have number of points Np (default, say, 10000) and frequency rolloff coef beta (default = 1) set by the user (via bmad_com?). Have generator calculate Np points and store for use. After being used, generator rerandomizes and generates a new set of Np points.

DavidSagan commented 1 year ago

And to smooth out the power spectrum. interleave sets of points using triangular weighting.

DavidSagan commented 5 months ago

Some thoughts: