Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

What is a Eye Diagram - create it in Python

  1. Mar 16, 2015 #1
    I am self learning Python and developing Communication signals concept by coding programs.

    But I am not sure how to develop Eye Diagram code in Python - cause I do not know the formulas / concept to do so - say I have a signal bits like -

    1 1 1 0 0 0 1 1

    So what formulas of concept I should implement that I can create Eye Diagram?
  2. jcsd
  3. Mar 16, 2015 #2


    User Avatar

    Staff: Mentor

    The eye diagram for displaying a degraded bit stream?
  4. Mar 16, 2015 #3
  5. Mar 16, 2015 #4


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    Do you understand what an eye pattern is actually showing you? ~It's all to do with the effect of inter symbol interference. The 'eye' in the middle of the pattern shows you how accurately you need to be with the placing of your sampling / decision making circuit- in timing and volts. It also gives you a qualitative idea of the signal to noise ratio that you can get away with. (Sorry if this is obvious to you.)
    Put the boxcar digital bit stream through a low pass filter and superimpose many short data streams on top of each other (just as an oscilloscope would do). That should produce an eye diagram for you. You would need a long pseudorandom bit stream if you want a realistic eye pattern; a short stream could result in missing out a bit combination that can produce a particularly bad bit of inter symbol interference.
  6. Mar 16, 2015 #5
    I am sorry, I come from a software background only. I am using Python to develop a free open source code communication software. I do not have a strong background in signal processing but my aim is to develop a software in same domain.

    Hence my approach is more logical than theoretical. Logical understanding is a process where complicated or unknown things are explained to a layman in a simple manner. Its like making a baby make to learn walking from crawling. Later baby can run all by himself gradually.

    My input data stream is of 0's and 1's bit stream (0 - 0 volts and 1 - 5 volts). Since all is generated with same frequency (Hz) value as imputed by user the frequency would remain same -

    I understand that my input stream bit needs to an big array of 0's and 1's - say an array with 1024 index values like -

    100110010101011101010110 .... until 1024 index

    Now how short bit stream should I take - as per http://www.edn.com/design/test-and-...gram-Basics-Reading-and-applying-eye-diagrams portal bit sequences 010, 101,011, 001, 100, and 110 needs to be superimposed as a properly constructed eye should contain every possible bit sequence from simple alternate 1’s and 0’s to isolated 1’s after long runs of 0’s, and all other patterns that may show up weaknesses in the design.

    Hence as per my understanding is that I break my 1024 bit stream to a group of 3 bits - each capturing at least a change from 0 to 1 or 1 to 0. So should I take group where there are alternates 0's and 1's at least:

    1 2 3 4 5 6 7 8 9 10 11 12 ...
    0 0 0 0 1 0 1 1 1 0 1 0 .....

    Is it that irrespective of what the patter is I just create the digital signal graph of these bit patterns:

    Digital Signal group 1 and 3 need not be plotted in chart as there is no change in signal values.

    Digital Signal chart for group 2 needs to plotted as there is change in bit pattern: 010

    Digital Signal chart for group 4 needs to plotted as there is change in bit pattern: 010

    Please confirm my understanding.
  7. Mar 17, 2015 #6


    User Avatar
    Science Advisor

    You're right about the point of an eye diagram but the problem is if you do an I diagram using arrays of 1 and 0 you will have a perfect eye diagram and that won't tell you much, will it?

    Like Sophiecentuar said, the eye diagram is a measure of the quality of your signal transmission. In that sense it is an ANALOG measurement. You need to know the impulse response of the communication channel. Then, convolve your bit sequence with the impulse response. You will get a sequence of analog values. You will need your impulse response to be more finely grained in time (higher resolution) that your data so you get multiple analog values per unit data interval. The impulse response stretches out your pulses. Eventually they will interact. This is called intersymbol interference.

    Then, make a plot where you overlap every bit period. This is an eye diagram. The method I describe only takes care of intersymbol interference. Jitter (that is the uncertainty of your time base) usually ends up limiting overall performance because intersymbol interference can be mitigated more easily using various signal processing techniques.

    So here is your practical instruction: get your data vector. Convolve it with the channel input response. Overlap each bit period. Viola! You have an eye diagram.
  8. Mar 17, 2015 #7
    Thanks a lot for the complete detailed explanation. Just one more help - I may be misleading myself with the per-assumption to take 3 bits at a time while others to skip (at least I should see a change from 0's to 1 or vice verse) - am I correct or should I take based upon any other method?
  9. Mar 17, 2015 #8


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    I am still not sure how much you have made yourself familiar with the ideas behind the eye diagram. How many different sources have you read? There are many available at all levels, via Google. Is this eye diagram project of yours 'out of the blue' or is it associated with some greater project? You must think 'analogue' here, because that is the whole point of the eye diagram. It was used as a diagnostic tool when the data rates being used were as fast as they could get and it was necessary to use an analogue display, rather than (much higher frequency) digital analysis - which was much more problematical at the time.
    A display that's three bits wide would be ok but, as you don't have any problem with data storage or processor power (no one does, these days), why not use a display length of five?
    If you want a convincing 'analogue style' eye diagram then you will need to have a very much oversampled signal , giving at least ten samples per bit period. (Many more would be better but easy to achieve with your software). A 2047 bit sequence would be fine (but why not more?) and there are many simple algorithms for generating PRBSs. If you want to consider the effects of jitter, then it would be easiest to introduce that on the initial boxcar waveform (i.e. before the filtering). You can then add the filtering and some band limited noise, if you want.
    BTW do you intend to have a 'real time' display of this in action?
  10. Mar 29, 2015 #9


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    Is the OP still interested in this topic?
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook