Eye patterns (Heat plot?) - matplotlib-users - Matplotlib
Eye patterns (Heat plot?) Community matplotlib-users Russ_Dill January 21, 2012, 9:30pm 1 I'm using matplotlib from pylab to generate eye patterns for signal simulations. My output pretty much looks like this: http://www.flickr.com/photos/ [email protected] .../6079131690/ Its pretty useful as it allows one to quickly see the size of the eye opening, the maximum/minimum voltage, etc. I'd really like to be able to create a heat diagram, like these: http://www.lecroy.com/images/oscilloscope/series/waveexpert/opening-spread2_lg.jpg http://www.lecroy.com/images/oscilloscope/series/waveexpert/opening-spread1_lg.jpg http://www.iec.org/newsletter/august07_2/imgs/bb2_fig_1.gif http://www.altera.com/devices/fpga/stratix-fpgas/stratix-ii/stratix-ii-gx/images/s2gx-rollout-6g-eye.jpg Is there any way within matplotlib to do that right now? _Stan_West1 January 23, 2012, 6:17pm 2 From: Russ Dill [mailto:russ.dill@…287…] Sent: Saturday, January 21, 2012 16:31 I'm using matplotlib from pylab to generate eye patterns for signal simulations. ...
Is there any way within matplotlib to do that right now? One way combines Numpy's histogram2d and matplotlib's imshow, as in the example in the histogram2d docs [1]. The example's x array should become all of the time samples in your traces, strung together in one dimension; the y array, the corresponding voltage samples. If you have certain structure, such as a regular and consistent grid of times, you might instead construct a series of vertical, 1-d histograms (paying attention to normalization); column-stack them into the final 2-d histogram; and again plot with imshow. [1] http://docs.scipy.org/doc/numpy-1.6.0/reference/generated/numpy.histogram2d.ht ml Russ_Dill January 23, 2012, 6:55pm 3 I'll try it out and see what I get, but I don't think it will work so well.
The problem is that while the data is made up of x/y samples, it actually represents a line. The samples should be evenly distributed not along the x or y axis, but along the length of the line. I feel like I'll need a line drawing algorithm. (For example, if samples are evenly distributed along the x axis, a 89 degree line is highly under-represented, but a 1 degree line is highly over-represented. The number of samples should be sqrt(dx^2 + dy^2), but with evenly spaced x samples, its just dx. ··· On Mon, Jan 23, 2012 at 11:17 AM, Stan West < [email protected] ...> wrote: From: Russ Dill [mailto:russ.dill@…287…] Sent: Saturday, January 21, 2012 16:31 I'm using matplotlib from pylab to generate eye patterns for signal simulations. ...
Is there any way within matplotlib to do that right now? One way combines Numpy's histogram2d and matplotlib's imshow, as in the example in the histogram2d docs [1]. The example's x array should become all of the time samples in your traces, strung together in one dimension; the y array, the corresponding voltage samples. Ethan_Swint January 23, 2012, 7:46pm 4 I don't know of a way to directly produce the LeCroy heatmap in Python, so here's my idea for a hack: *Each sample point you have from the trace represents a point in XY coordinates. *Similarly, the plot area is filled with regularly spaced XY coordinates. *Every trace sample will fall within a square bounding box with four points. *Each plot area point gets a membership value, based on distance between centers of the sample point and the plot area point. *To construct the heat diagram, sum the membership values of all sample points for all traces. *Display it with a contour plot, but without the isovalue lines. -Ethan ··· On 1/23/2012 1:55 PM, Russ Dill wrote: On Mon, Jan 23, 2012 at 11:17 AM, Stan West< [email protected] ...> wrote: From: Russ Dill [mailto:russ.dill@…287…] Sent: Saturday, January 21, 2012 16:31 I'm using matplotlib from pylab to generate eye patterns for signal simulations. ...
Is there any way within matplotlib to do that right now? One way combines Numpy's histogram2d and matplotlib's imshow, as in the example in the histogram2d docs [1]. The example's x array should become all of the time samples in your traces, strung together in one dimension; the y array, the corresponding voltage samples. I'll try it out and see what I get, but I don't think it will work so well. The problem is that while the data is made up of x/y samples, it actually represents a line.
The samples should be evenly distributed not along the x or y axis, but along the length of the line. I feel like I'll need a line drawing algorithm. (For example, if samples are evenly distributed along the x axis, a 89 degree line is highly under-represented, but a 1 degree line is highly over-represented. The number of samples should be sqrt(dx^2 + dy^2), but with evenly spaced x samples, its just dx. Benjamin_Root January 23, 2012, 8:30pm 5 matplotlib also has hexbin() if that helps. http://matplotlib.sourceforge.net/api/axes_api.html?highlight=hexbin#matplotlib.axes.Axes.hexbin Ben Root ··· On Mon, Jan 23, 2012 at 1:46 PM, Ethan Swint <eswint@…3245…> wrote: On 1/23/2012 1:55 PM, Russ Dill wrote: On Mon, Jan 23, 2012 at 11:17 AM, Stan West<stan.west@…706…> wrote: From: Russ Dill [mailto:russ.dill@…287…] Sent: Saturday, January 21, 2012 16:31 I’m using matplotlib from pylab to generate eye patterns for signal simulations. … Is there any way within matplotlib to do that right now?
One way combines Numpy’s histogram2d and matplotlib’s imshow, as in the example in the histogram2d docs [1]. The example’s x array should become all of the time samples in your traces, strung together in one dimension; the y array, the corresponding voltage samples. I’ll try it out and see what I get, but I don’t think it will work so well. The problem is that while the data is made up of x/y samples, it actually represents a line.
The samples should be evenly distributed not along the x or y axis, but along the length of the line. I feel like I’ll need a line drawing algorithm. (For example, if samples are evenly distributed along the x axis, a 89 degree line is highly under-represented, but a 1 degree line is highly over-represented. The number of samples should be sqrt(dx^2 + dy^2), but with evenly spaced x samples, its just dx. I don’t know of a way to directly produce the LeCroy heatmap in Python, so here’s my idea for a hack: *Each sample point you have from the trace represents a point in XY coordinates. *Similarly, the plot area is filled with regularly spaced XY coordinates. *Every trace sample will fall within a square bounding box with four points. *Each plot area point gets a membership value, based on distance between centers of the sample point and the plot area point. *To construct the heat diagram, sum the membership values of all sample points for all traces. *Display it with a contour plot, but without the isovalue lines. -Ethan Paul_Ivanov3 January 23, 2012, 9:07pm 6 Hi Russ, Russ Dill, on 2012-01-21 13:30, wrote: I'm using matplotlib from pylab to generate eye patterns for signal simulations.
My output pretty much looks like this: http://www.flickr.com/photos/ [email protected] .../6079131690/ Its pretty useful as it allows one to quickly see the size of the eye opening, the maximum/minimum voltage, etc. I'd really like to be able to create a heat diagram, like these: http://www.lecroy.com/images/oscilloscope/series/waveexpert/opening-spread2_lg.jpg http://www.lecroy.com/images/oscilloscope/series/waveexpert/opening-spread1_lg.jpg http://www.iec.org/newsletter/august07_2/imgs/bb2_fig_1.gif http://www.altera.com/devices/fpga/stratix-fpgas/stratix-ii/stratix-ii-gx/images/s2gx-rollout-6g-eye.jpg Is there any way within matplotlib to do that right now? the quick and dirty way to get close to what you want is to add an alpha value to the lines you're already plotting.
Here's a small example: x = np.arange(0,3,.01) y = np.sin(x**2) all_x,all_y = , ax = plt.gca() for i in range(100): noisex = np.random.randn(1)*.04 noisey = (np.random.randn(x.shape[0])*.
The rest of this page is on the live site.