[go: up one dir, main page]

Skip to content

WarrenWeckesser/eyediagram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eyediagram

eyediagram is a python library for generating eye diagrams (also known as eye patterns).

This is prototype-quality software. The documentation is thin, and the API may change.

To build the package, cython and numpy must be installed.

To use the package, numpy and scipy must be installed. Plots are generated with either matplotlib (http://matplotlib.org/) or bokeh (http://bokeh.pydata.org/), so usually either one of those must be installed. However, the core function eyediagram.core.grid_count generates a numpy array that can be displayed or saved as an image using any other plotting or image-handling software, so it is not a strict requirement that matplotlib or bokeh be installed. See the script pyqtgraph_demo.py in the demo directory for an example that uses pyqtgraph (http://www.pyqtgraph.org/) to display the eye diagram. The plot generated by that script is shown below.

Example - matplotlib

This is mpl_demo.py. It uses the eyediagram function from the eyediagram.mpl module to plot an eye diagram using matplotlib.

from eyediagram.demo_data import demo_data
from eyediagram.mpl import eyediagram
import matplotlib.pyplot as plt


num_symbols = 5000
samples_per_symbol = 24

y = demo_data(num_symbols, samples_per_symbol)

eyediagram(y, 2*samples_per_symbol, offset=16, cmap=plt.cm.coolwarm)

plt.show()

Example - bokeh

This is bok_demo.py. It uses the eyediagram function from the eyediagram.bok module to plot an eye diagram using bokeh.

from eyediagram.demo_data import demo_data
from eyediagram.bok import eyediagram
from matplotlib.cm import coolwarm
from bokeh.plotting import show


# Get some data for the demonstration.
num_symbols = 5000
samples_per_symbol = 24
y = demo_data(num_symbols, samples_per_symbol)

p1 = eyediagram(y, 2*samples_per_symbol, offset=16, cmap=coolwarm,
                filename='bok_demo.html')

# If you don't want the dependency on matplotlib, replace `cmap=coolwarm`
# with, say, `color=(160, 145, 50)`.

show(p1)

Example - pyqtgraph

The script pyqtgraph_demo.py in the demo directory shows how an eye diagram can be displayed using the graphics library pyqtgraph. It generates this plot: