On Tue, 2007-04-10 at 16:13 +0300, Jouni K. Seppänen wrote:
> David Fokkema <[EMAIL PROTECTED]> writes:
> 
> > I fixed the bug, I think. At least it's working on my system and I think
> > it is not invasive. Comments please? I'll send it upstream otherwise...
> 
> Does this handle the case where the user has specified bins of
> different widths? It looks like you are only using the width of the
> first bin:
> 
> > +    if align == 'center':
> > +       hw = .5*(bins[1]-bins[0])
> > +       nbins = [x-hw for x in bins]
> > +    else:
> > +       nbins = bins

I am only using the first width, indeed. If different widths are allowed
(and why not?) some more coding has to be done. On the other hand, I use
align = 'center' because I have a detector which samples timing
information at 20 ns intervals. So, when binning timing information, I
only have 0, 20 ns, 40 ns, 60 ns and so forth. Being able to specify
those values as the center of my bin instead of calculating edges myself
(-10, 10, 30, 50, etc.) is very useful. I can't think of an application
where you have bins of different widths and you want to center the
values... Furthermore, when plotting the histogram, the function
calculates the width of the bars only for the first bin and uses that
for all bars. So I think this function is highly unstable when you use
variable sized bins. Matplotlib.mlab.hist only calculates the histogram
and can only use variable sized bins when you want a simple histogram.
Maybe add something to this effect in the docstring?

> 
> At least, I've always thought that unequal bins are allowed, but from
> the following it seems that the probability density support also makes
> an incompatible assumption:
> 
> >      if normed:
> > -       db = bins[1]-bins[0]
> > +       db = nbins[1]-nbins[0]
> >         return 1/(len(y)*db)*n, bins
> 

It does...

David


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to