In my recent work I've came across a problem where I need to find certain points in quickly oscillating data. Let's work with syntethic data instead of real measurements and ignore the noise for the time being. These points are called stationary phase points (SPP for short). For human eye they are quite easy to spot: the oscillation slows down locally. An example:

See this picture

Some important things to note:

  • It's always a local maxima or minima (so a reliable peak detection algorithm can help a lot, which I've been working on recently)

  • The graph is ideally normalized to [-1, 1], in real measurements it's a little distorted

  • Usually the Nyquist–Shannon sampling theorem is not satisfied at the borders of data and the oscillation is avaraged out. (In the synthetic data I created it's satisfied, see below for a real-world dataset.)

  • The general number of SPPs are 1 or 2, 3 or 4 are really rare, but exist.

  • A SPP can continiously move around in the x direction as conditions are changing, can vanish at the borders of x-axis, and also one SPP can separate into two different SPPs which are moving away from each other.

The main goal would be reliably monitoring these points movement (ideally in real time, but first the SPP detection from x-y data is the target). There are some other generated graphs with indication for SPPs, and the last is from real data.

1st 2nd 3rd 4th

To solve this, my first thought is to detect all the extremal points in data, then generate their consecutive distances, and where that distance exceeds a certain threshold value, it's a SPP. But setting a good threshold, correctly identifying extremal points seems quite hard and unique for each graph.

My question is: Do you think it would worth using a machine learning tool there, and if yes, which algorithm would be the most suitable? As a physicist I'm inexperienced, I only have basic knowledge about ML (but willing to learn!) In general, can you think of any useful algorithm or idea for such situation?

Note: Mostly I'm working in Python with numpy/scipy.

As far as local max and min detection concerned I use scipy.signal.find_peaks and scipy.signal.find_peaks_cwt along with scipy.signal.savgol_filter.

  • $\begingroup$ It's not at all my domain but that looks like an interesting problem. At first sight I don't see any big advantage for ML methods, but I could be wrong. It looks to me like one could calculate all the x distances between 2 oscillations across the X axis, and then find the closest local minimum/maximum only for the values of x where the distance is the largest. This avoids calculating all the minima/maxima, which probably requires more computation. Does that make any sense? $\endgroup$
    – Erwan
    Oct 30, 2019 at 0:15
  • $\begingroup$ In time-series paradigm folks call these points rather anomalies! You might as well borrow similar concept and try various methods out there for catching these anomalous points. For example I have come across this nice package (have not used it myself just yet), for this purpose: arundo-adtk.readthedocs-hosted.com/en/latest/notebooks/…. Check it out it might give you ideas or be useful after all. $\endgroup$ Oct 30, 2019 at 6:17
  • $\begingroup$ @Erwan Yes, that makes sense, I described a similar idea. $\endgroup$ Oct 30, 2019 at 6:22
  • $\begingroup$ @TwinPenguins Thank you for the link, I'll definitely check that out. $\endgroup$ Oct 30, 2019 at 6:23

1 Answer 1


This is a common problem in signal processing. It would be useful to look into the rich history of anomaly detection in signal processing.

One option would be to apply a Fourier Transform which decomposes a function into its constituent frequencies. Define a baseline set of frequencies. Then anomaliness frequencies could be found relative to the baseline.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.