Hi Community,

I was wondering if it is possible to generate an arbitrary length noise for the given PSD. to put in the context, I’ve modelled average noise in my station using PPSD.get_mean() and want to generate noise time-series with PSD similar to the reference one.

Cheers,

Hadi

Hi Hadi,

the answer is yes, but it might not be useful for comparison with some reference time series.

While the PSD gives you the energy distribution with frequency, it does not have phase information, i.e. you can generate infinitely many different time series from the same PSD by assigning different phases per frequency component.

On top of that, the phases make a huge difference on the resulting time series.

Regardless, a way to do so is to take your PSD P(f) and generate a complex spectrum from that.

X(f) = sqrt(P(f)) * cos(psi_f) + i * sqrt(P(f)) * sin(psi_f)

where psi_f is some arbitrary phase for the frequency bin f.

You can use X(f) with np.fft.irfft() to obtain a time series x(t).

The resulting time series is then twice the length (npts) of X(f).

Cheers,

Martin

Thanks heaps Martin, Actually I was following same procedure but had problems with the normalization factors between PSD and FAS!! all fixed now It was also interesting to hear that at the end it may not serve the purpose due to random generation of Phase! (I guess, I underestimated the role of Phase!)

Cheers,

H

I’m not sure if this is the same as what you are trying to do, but it seems similar:

https://github.com/sstaehler/seismogram_noise

I just happen to see it a few days ago.

Brad Avenson

Thanks Brad, exactly what I was after