| 
     
      
      
      From: Ethan S. <es...@vt...> - 2012-01-23 19:46:32
      
     
   | 
On 1/23/2012 1:55 PM, Russ Dill wrote: > On Mon, Jan 23, 2012 at 11:17 AM, Stan West<sta...@nr...> wrote: >>> From: Russ Dill [mailto:rus...@gm...] >>> 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  |