[SciPy-user] Newbie Question about Scipy

Bryan Van de Ven bryanv@enthought....
Wed Feb 14 10:11:50 CST 2007


Lorenzo,

Here is some python documentation about modules and submodules with some 
examples:

http://docs.python.org/tut/node8.html#SECTION008400000000000000000

"from scipy import *" imports the integrate module, which means you can 
use "integrate.quad(...)" If you just want to be able to do "quad(...)" 
then you need either "from scipy.integrate import quad" or "from 
scipy.integrate import *"

As for python vs Matlab, I will mention one area of comparison that I am 
most familiar with. If you have any need for building out an interactive 
GUI data analysis tool, even an extremely modest one, python is a clear 
win. Python has available Chaco2, Matplotlib and VTK/TVTK (and others) 
for displaying 2D and 3D data, and then your choice of toolkits, WX, 
GTK, Qt (and others), for building GUI applications large or small. By 
contrast, building even the simplest of interactive GUI applications in 
Matlab is a nightmare.


Lorenzo Isella wrote:
> Dear All,
> I am pretty new to Python, but it has such a good reputation that I
> decided to give it a try.
> I am slightly puzzled about the syntax modulename.function.
> I am going through the SciPy tutorial by Oliphant (btw, is there
> anywhere online a free updated version of a document of this kind?).
> To use SciPy I normally do the following:
> 
> ~$ ipython
> Python 2.4.4 (#2, Jan 13 2007, 17:50:26)
> Type "copyright", "credits" or "license" for more information.
> 
> IPython 0.7.3 -- An enhanced Interactive Python.
> ?       -> Introduction to IPython's features.
> %magic  -> Information about IPython's 'magic' % functions.
> help    -> Python's own help system.
> object? -> Details about 'object'. ?object also works, ?? prints more.
> 
> In [1]: from scipy import *
> 
> However, statements like the ones in the guide:
> 
> In [12]: from integrate import quad
> ---------------------------------------------------------------------------
> exceptions.ImportError                               Traceback (most
> recent call last)
> 
> /home/iselllo/<ipython console>
> 
> ImportError: No module named integrate
> 
> do not work.
> So I have to use: scipy.integrate. Similarly, the function gamma is
> not recognized, but special.gamma is.
> How is this chosen by the system? Then: once I have import everything
> from scipy, is importing explicitly the gamma function a necessity at
> all?
> ****************************************************************************
> On a more general ground, how does Python compare with e.g. MatLab or
> Octave for scientific computing? Which are the advantages and
> drawbacks (sorry if this is not the right forum).
> Kind Regards
> 
> Lorenzo
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
> 



More information about the SciPy-user mailing list