1
  • I want to find the value of the "width of bifurcation" of the following plot using Python.
  • By eye it's ~10dB.

Any ideas for ways to approach this task?

Plot showing bifurcation on X-Y data:

Data used for producing this plot is contained in this pastie.

Thanks in advance for any ideas, please ask for any further information that'd be handy.

8765674
  • 1,234
  • 4
  • 17
  • 32
  • I'm guessing you want to be able to automatically measure this bifurcation for multiple different input waveforms (otherwise it would be trivial to just measure it off the graph!). If so, we need to know more about what features of the waveform are consistent across different trials, and what distinguishes a 'bifurcation' from other features. – ali_m Apr 24 '15 at 20:31
  • For example, a very simple answer that would work for this case would be to just find the largest positive value then take the difference between it and the preceding bin, but of course this won't work if there are multiple positive peaks, or if the 'bifurcation' doesn't always occur at a peak. – ali_m Apr 24 '15 at 20:33

1 Answers1

1
A = np.genfromtxt('file.txt')
B = np.diff(A)
gap = B.max()

The idea here is to use the diff function, since your data is sequentially sampled.

--------------

END SOLUTION: Thanks for your help.

The way I ended up solving this problem involves filtering the data with respect to the peak value and then finding the max() of the np.diff(). This avoids unwanted diff values that occur at earlier frequencies.

i.e.

    peakF = x0[np.argmax(y0)]
    xR = x0[(x0<peakF+0.001E9)&(x0>peakF-0.0023E9)]
    yR = y0[(x0<peakF+0.001E9)&(x0>peakF-0.0023E9)] 
    diff = np.diff(yR)
    bifurWidth = max(diff)  

The range in which I look for bifurcation then is shown in green.

enter image description here

8765674
  • 1,234
  • 4
  • 17
  • 32
heltonbiker
  • 26,657
  • 28
  • 137
  • 252
  • Nice approach, I can avoid picking large np.diff values that occur near -40--50dB with some filtering. I'll try this. Open to hearing other methods too. – 8765674 Apr 24 '15 at 13:19
  • You could use a moving average according to another answer of mine, here: http://stackoverflow.com/a/11352216/401828 . Also, if this answer here solves your problem, would you mark it as accepted? :D – heltonbiker Apr 24 '15 at 14:23
  • Well, I've made some tests and this noise you have is really making things difficult... I don't have time right now, but it surely is an interesting problem! Tell me if you think about something else! – heltonbiker Apr 24 '15 at 14:29
  • Of course if this works I'll mark it as answer. However, we sure ain't there yet ;). – 8765674 Apr 24 '15 at 14:49
  • 1
    Well, let me think out loud a bit: what clearly distinguishes the gap you're looking for, visually, is not the magnitude of the gap per se (which is what `diff`measures), since we have already seen that there are larger gaps around that valley on the left. What distinguishes, actually, is a gap _much larger_ than nearby gaps. So one possibility would be to create another array containing the "average diff value" around a point, and look for outliers there. I'm gonna give it a try, maybe. – heltonbiker Apr 24 '15 at 17:16
  • HeltonBiker, that sounds like the right approach. Thank you. I'd happily test out your approach on the data. – 8765674 Apr 27 '15 at 11:07
  • Cheers, still used your answer as the final answer but have edited for how I ended up implementing it. – 8765674 May 07 '15 at 09:29