I'm new to python and I'm using it to analyse accelerations from an accelerometer ie. vibration analysis. For that I need to plot 2 types of diagrams: 1) Frequency map; frequency and time on the axis with the amplitudes, 2) Order map; order and time (or RPM) on the axis with respective amplitudes.

The data from the sensor is sampled at 1 kHz and include the accelerations in X,Y and Z, pulses for every shaft rotation and the timestamps (in microseconds).

I wrote a small code for the frequency map and plot them using scatter() and it gives me this plot. Frequency map (my code) The green "lines" correspond to the RPMs and the order; accelerating and decelerating the shaft.

I then found that scipy has a builtin spectrogram() and pcolormesh() function, which should give me something similar. I used it on my data and got this: scipy spectrogram Note: axis are flipped

The "RPM lines" are barely visible. So I used log to scale the colours and got this:scipy spectrogram with log

And this is still weird looking.

The problem is with my code and using scatter, the points overlap. And if I used smaller points, then they look strange when opening the diagram in full screen. Is there any way to get the plots to look better? Whether using the spectrogram() function or using something like scatter() ?

Also, how can I plot the order map? I don't know how to change the data from time/frequency domain to order domain.

Here is a link to understand what I'm trying to implement: https://de.mathworks.com/help/signal/examples/order-analysis-of-a-vibration-signal.html

Much thanks in advance!

  • $\begingroup$ You might find this response useful. $\endgroup$
    – A_A
    Mar 2 '20 at 10:16
  • $\begingroup$ @A_A Thank you. I went through the links & came up with this idea: 1) Resample the original data for every full Rotation using a fix number of steps. I'l try "sklearn.utils.resample(*arrays, **options)" If I said, for example, I want 512 samples between every rotation then I'll get a spectrogram with max 256 Orders 2) Do FFT on each Segment. OR. I can resample for every rotation, put them all in one Array & then use a python spectrogram function on the new array while specifying the number of samples I want; 512 samples, max. 256 Orders. Is this a reasonable way of doing the order map? $\endgroup$
    – Ra3
    Mar 5 '20 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.