[SciPy-user] help/import question

Steve Schmerler elcorto at gmx.net
Sun Jan 8 07:45:52 CST 2006


Pearu Peterson wrote:
> 
> On Fri, 6 Jan 2006, Steve Schmerler wrote:
> 
> 
>>Hi
>>
>>Some things I discoverd while playing arround with the recent
>>numpy/scipy svn:
>>
>>#################################################################################################################
>>
>>In [9]: ?scipy
>>
>>[...]
>>
>>    Available subpackages
>>    ---------------------
>>    stats       --- Statistical Functions
>>    sparse      --- Sparse matrix [*]
>>    lib         --- Python wrappers to external libraries
>>    linalg      --- Linear algebra routines
>>    signal      --- Signal Processing Tools [*]
>>    misc        --- Various utilities that don't have another home.
>>    interpolate --- Interpolation Tools [*]
>>    optimize    --- Optimization Tools
>>    cluster     --- Vector Quantization / Kmeans [*]
>>    fftpack     --- Discrete Fourier Transform algorithms
>>    io          --- Data input and output [*]
>>    integrate   --- Integration routines [*]
>>    lib.lapack  --- Wrappers to LAPACK library
>>    special     --- Special Functions
>>    lib.blas    --- Wrappers to BLAS library [*]
>>      [*] - using a package requires explicit import
>>
>>
>>#################################################################################################################
>>
>>The *-marking of subpackages tells me that I can do
>>
>>import scipy
>>?scipy.stats
>>
>>but to get help on sparse I have to
>>
>>import scipy.signal
>>?scipy.signal
>>
>>Is this desired? If so, why?
> 
> 
> Yes. Users seldomly need to use all of scipy packages in their programs, 
> so, by default, not all scipy packages are imported while importing 
> scipy, this reduces import time and consumes memory.
> 
> If you wish to load all scipy packages, then do
> 
>    import scipy
>    scipy.pkgload()
> 
> and then simple
> 
>    ?scipy.signal
> 
> also works.
> 
> Pearu
> 

So the decision to import stats, lib, linalg etc. (but not signal, 
interpolate, ...) is a pure memory/time thing. What I described is only 
an issue in interactive use anyway, i.e. if one wants to study the 
on-line help.

Maybe scipy.pkgload() should be mentioned somewhere in the ?scipy help.

cheers,
steve

-- 
"People like Blood Sausage too. People are Morons!" -- Phil Connors, 
Groundhog Day



More information about the SciPy-user mailing list