You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you very much for providing this free library.
I tried to apply the code provided on Noise Power Pylinac documentation to some simple synthetic 2D signals including 4 spatial frequencies of equal amplitude A :
noise_cartesian(X,Y) = A cos(2π* f1 * X) + A cos(2π* f2 * Y) + A cos(2π* f3 * X) + A cos(2π* f4 * Y)
noise_radial(R) = A cos(2π* f1 * R) + A cos(2π* f2 * R) + A cos(2π* f3 * R) + A cos(2π* f4 * R)
I tried to slightly modify the core/nsp.py file by removing the common normalization over the number of pixels bin in the radial_average. By doing so, I got the expected power for the peaks (however their frequency still seems shifted downward on the 1D spectrum, whereas the values measured on the 2D spectrum are correct).
I think I found the issue origin for the frequency shift.
It seems to be a simple scaling problem, as the highest frequency bin is located in the image diagonal, so a √2 factor is to be applied to the axis and to the average power values : scalingFactor = 1. / mmPixel_Size / math.sqrt(2) x_vals = np.arange(len(nps1d_1))/len(nps1d_1) * scalingFactor
With this, the output frequencies match the input :
Thank you very much for providing this free library.
I tried to apply the code provided on Noise Power Pylinac documentation to some simple synthetic 2D signals including 4 spatial frequencies of equal amplitude A :
noise_cartesian(X,Y) = A cos(2π* f1 * X) + A cos(2π* f2 * Y) + A cos(2π* f3 * X) + A cos(2π* f4 * Y)
noise_radial(R) = A cos(2π* f1 * R) + A cos(2π* f2 * R) + A cos(2π* f3 * R) + A cos(2π* f4 * R)
f1 = 0.18 mm-1
f2 = 0.32 mm-1
f3 = 0.45 mm-1
f4 = 0.61 mm-1
I was expecting to find 4 peaks of equal power on the corresponding 1D radial power spectrum :
However I had two issues :
Am I missing something ? By definition the power spectrum is expected to give a power proportional to the squared amplitude, am I wrong ?
Here is my modified code : PyLinac_SelfGeneratedNoise.txt
Thank you for your reply.
The text was updated successfully, but these errors were encountered: