[SciPy-user] problems with stats.py

oliver.tomic@matforsk.no oliver.tomic at matforsk.no
Tue Jan 17 05:07:12 CST 2006

Hi Alan and Travis,

Thanks for your comments

scipy-user-bounces at scipy.net wrote on 16.01.2006 00:36:34:

> On Sun, 15 Jan 2006, oliver.tomic at matforsk.no apparently wrote:
> > Previously I used Numeric 23.8 and everything worked fine. Then I
> > Numpy and replaced 'Numeric' with 'Numpy' everywhere in the code. Now
> > following occurs:
> > Traceback (most recent call last):
> >   File "C:\Python24\pmse_Plot.py", line 175, in pmsePlotter
> >     ANOVAresults = lF_oneway(preANOVA[(assessor, attribute)])
> >   File "C:\Python24\stats.py", in line 1534, in lF_oneway
> >     means = map(amean,tmp)
> > NameError: global name 'amean' is not defined

> Numeric did not define amean either.
> This is defined in stats.py

I was aware of that, but I have no idea why it didn't work with Numpy.

> Are you making the replacements in Strangman's code?
> Don't forget his stats.py uses pstat.py.
> It might turn on how you are importing the module functions.

Yes, I made replacements in Strangman's code. I checked both, stats.py and
pstat.py. I'll have to look into the importing.

> PS Your directory structure looks very odd to me, by the
> way.  Isn't Lib/site-packages a more common place to install
> such modules?

As my application progressed (from one version to another) I had to make
slight changes in stats.py to make everything work for my application.
Every new version I keep in another directory with the corresponding
modified stats.py. Maybe not the way a more experienced programmer would do
it but for me it felt right and it worked. :-)

> Did you try using "numpy.lib.convertcode" ?   Did you convert stats.py
> as well?

No, I wasn't really aware of it. Are there any examples how to use it?

> There is a version of stats.py in (full) SciPy that seems to work fine,
> as well.

I wasn't aware of that either. Since Numeric 23.8 and Strangmans modules
did the job for me I didn't spent much time looking into Scipy,
unfortunately. That kept things for me simple. I must admit that I was
rather confused by all the different packages out there and their history.
A while ago I kept finding comments on the web about Scipy 0.4.x, yet on
www.scipy.org one can only download scipy 0.3.3. Numeric, Numarray, old
Numpy, Scipy, Scipy_core, new Numpy ... I simply got lost.

Here at work we have Matlab available. We pay around 15 000$ (12 500 Euros)
each year for 4 floating licenses. This is a LOT of money for my institute.
Personally, I haven't used Matlab so much yet as some of my colleagues who
have turned into real Matlab-slaves. I don't want to end up like them and I
wanted to do something about that. Since I have used Python/wxPython for
quite a while in differenent projects Numeric/Numarray was an obvious
choice for me. However, it was somewhat difficult to understand/decide what
packages to use, since there is so much different stuff out there. Because
of my affection to Python I wasn't willing to let my frustration take over
and choose something else (non-pythonic) for my scientific computations.

A few days ago I purchased Travis Oliphant's very good "Guide to NumPy" and
after reading the intro things were clearer. I am very happy to see that
Travis and the people around him try to unite the different fragmentetd
groups. The new website really looks great and is a very good start for
Numpy. Finally!! This is what is needed to make Python an even more
convinient choice for researchers and scientists. I will do my part and use
only Numpy from now on (as soon as I have succeeded to migrate my
application form Numeric to Numpy). Maybe I'll even succeed with convincing
some of my Matlab-slave colleagues to switch over to Python.

Sorry about the long mail, but I just had to let it out. ;-)

best regards

Oliver Tomic, Ph.D.
MATFORSK - Norwegian Food Research Institute
Osloveien 1
1430 Ås

Tel.: 0047 6497 0252
Fax: 0047 6497 0333
Mob.: 0047 9574 6167


More information about the SciPy-user mailing list