Re: [Matplotlib-users] Plotting Continuous Functions

2007-11-24 Thread Rich Shepard
On Sun, 25 Nov 2007, Angus McMorland wrote: > If you change exp -> nx.exp in your definition of gauss1d, all works okay. Angus, Yes, it works just fine. By adjusting the value of the fwhm parameter I can produce the curves we need for both display and printing. Now I can spend some time

Re: [Matplotlib-users] Plotting Continuous Functions

2007-11-24 Thread Rich Shepard
On Sun, 25 Nov 2007, Angus McMorland wrote: > As I suspected, this is a parameter issue- in this case caused by your use > of the ath module routines which require scalar input, rather than numpy's > (or matplotlib's numerix's) array-friendly versions. If you change exp -> > nx.exp in your definit

Re: [Matplotlib-users] Plotting Continuous Functions

2007-11-24 Thread Angus McMorland
On 25/11/2007, Rich Shepard <[EMAIL PROTECTED]> wrote: > On Sun, 25 Nov 2007, Angus McMorland wrote: > > > I'm not completely sure, but I suspect that this is an implementation bug, > > rather than a version bug, particularly because the line in question isn't > > involving matplotlib at all. If yo

Re: [Matplotlib-users] Plotting Continuous Functions

2007-11-24 Thread Fernando Perez
On Nov 24, 2007 4:17 PM, Rich Shepard <[EMAIL PROTECTED]> wrote: > On Sun, 25 Nov 2007, Angus McMorland wrote: > > I've found it easiest to solve these sorts of bugs by running the code in > > an ipython shell, with automatic pdb calling. That way you can inspect the > > values of the parameters i

Re: [Matplotlib-users] Plotting Continuous Functions

2007-11-24 Thread Rich Shepard
On Sun, 25 Nov 2007, Angus McMorland wrote: > I'm not completely sure, but I suspect that this is an implementation bug, > rather than a version bug, particularly because the line in question isn't > involving matplotlib at all. If you post the relevant code > (normal-curve.py, by the looks of thi

Re: [Matplotlib-users] Plotting Continuous Functions

2007-11-24 Thread Angus McMorland
On 25/11/2007, Rich Shepard <[EMAIL PROTECTED]> wrote: > On Sat, 24 Nov 2007, Angus McMorland wrote: > > > Great. Hopefully this correction will make things even more clear. > >While the functions and equations are now clear, I get an error that was > present in matplotlib-0.87, but which shoul

Re: [Matplotlib-users] Plotting Continuous Functions

2007-11-24 Thread Rich Shepard
On Sat, 24 Nov 2007, Angus McMorland wrote: > Great. Hopefully this correction will make things even more clear. While the functions and equations are now clear, I get an error that was present in matplotlib-0.87, but which should be fixed in -0.90.1: Traceback (most recent call last): Fil

Re: [Matplotlib-users] Plotting Continuous Functions

2007-11-24 Thread Rich Shepard
On Sat, 24 Nov 2007, Angus McMorland wrote: > Looking at my reply, I realised this was rubbish - sorry about that. The > fwhm is the difference between the two values of x that give Y = 0.5. Now that makes much more sense. Having control over the x values for the inflection point allows us to

Re: [Matplotlib-users] Plotting Continuous Functions

2007-11-23 Thread Angus McMorland
On 24/11/2007, Rich Shepard <[EMAIL PROTECTED]> wrote: > On Sat, 24 Nov 2007, Angus McMorland wrote: > > > fwhm is the full-width at half the maximum height, i.e. it's the > > difference between the two values of x when: > > > > |r - c| = 0.5 Looking at my reply, I realised this was rubbish - sorr

Re: [Matplotlib-users] Plotting Continuous Functions

2007-11-23 Thread Rich Shepard
On Sat, 24 Nov 2007, Angus McMorland wrote: > fwhm is the full-width at half the maximum height, i.e. it's the > difference between the two values of x when: > > |r - c| = 0.5 Angus, The additional explanation helps a lot. > The fwhm is a shape parameter (like std dev) - it determines the wi

Re: [Matplotlib-users] Plotting Continuous Functions

2007-11-23 Thread Angus McMorland
On 24/11/2007, Rich Shepard <[EMAIL PROTECTED]> wrote: > On Fri, 23 Nov 2007, Angus McMorland wrote: > > > For parsimony, I think you're probably best off just using the Gaussian > > equation: > > > > def fwhm2k(fwhm): > >'''converts fwhm value to k (see above)''' > >return fwhm/(2 * n.sqrt

Re: [Matplotlib-users] Plotting Continuous Functions

2007-11-23 Thread Rich Shepard
On Thu, 22 Nov 2007, Rich Shepard wrote: >> For parsimony, I think you're probably best off just using the >> Gaussian equation: >> >> def fwhm2k(fwhm): >>'''converts fwhm value to k (see above)''' >>return fwhm/(2 * n.sqrt( n.log( 2 ) ) ) >> >> def gauss1d(r, fwhm, c): >>'''returns th

Re: [Matplotlib-users] Plotting Continuous Functions

2007-11-23 Thread Rich Shepard
On Fri, 23 Nov 2007, Jeff Whitaker wrote: > Rich: The tails of a Gaussian never reach zero - they just asymptote to zero > for large x. Jeff, For all practical purposes, that's fine. Usually any y value > 0.20 (the default) is considered functionally equivalent to zero. If the display looks

Re: [Matplotlib-users] Plotting Continuous Functions

2007-11-23 Thread Jeff Whitaker
Rich Shepard wrote: > On Fri, 23 Nov 2007, Angus McMorland wrote: > > >> For parsimony, I think you're probably best off just using the >> Gaussian equation: >> >> def fwhm2k(fwhm): >>'''converts fwhm value to k (see above)''' >>return fwhm/(2 * n.sqrt( n.log( 2 ) ) ) >> >> def gauss1d(r

Re: [Matplotlib-users] Plotting Continuous Functions

2007-11-22 Thread Rich Shepard
On Fri, 23 Nov 2007, Angus McMorland wrote: > For parsimony, I think you're probably best off just using the > Gaussian equation: > > def fwhm2k(fwhm): >'''converts fwhm value to k (see above)''' >return fwhm/(2 * n.sqrt( n.log( 2 ) ) ) > > def gauss1d(r, fwhm, c): >'''returns the 1d g

Re: [Matplotlib-users] Plotting Continuous Functions

2007-11-22 Thread Angus McMorland
On 23/11/2007, Rich Shepard <[EMAIL PROTECTED]> wrote: >Now I need to plot normal curves (a.k.a. Gaussian or bell curves, > depending on the background of the speaker/writer). I see that SciPy has a > class for the normal curve in its stats package, and that the curve shape is > defined by the

[Matplotlib-users] Plotting Continuous Functions

2007-11-22 Thread Rich Shepard
I see that I've been immortalized on the SciPy MatPlotLib Cookbook web page for my enquiry on plotting S- and Z-curves. The Boltzman function serves very well for that purpose, and I've tweaked the example code to allow me to pass in the two endpoints and the midpoint for each of these curves.