__init__.py :  » Math » SciPy » scipy » scipy » io » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Math » SciPy 
SciPy » scipy » scipy » io » __init__.py
#
# io - Data input and output
#

from info import __doc__

from numpy import deprecate

# These are all deprecated (until the end deprecated tag)
from npfile import npfile
from data_store import save,load,create_module,create_shelf
from array_import import read_array,write_array
from pickler import objload,objsave

from numpyio import packbits,unpackbits,bswap,fread,fwrite,\
     convert_objectarray

fread = deprecate(fread, message="""
scipy.io.fread can be replaced with NumPy I/O routines such as
np.load, np.fromfile as well as NumPy's memory-mapping capabilities.
""")

fwrite = deprecate(fwrite, message="""
scipy.io.fwrite can be replaced with NumPy I/O routines such as np.save,
np.savez and x.tofile.  Also, files can be directly memory-mapped into NumPy
arrays which is often a better way of reading large files.
""")

bswap = deprecate(bswap, message="""
scipy.io.bswap can be replaced with the byteswap method on an array.
out = scipy.io.bswap(arr) --> out = arr.byteswap(True)
""")

packbits = deprecate(packbits, message="""
The functionality of scipy.io.packbits is now available as numpy.packbits
The calling convention is a bit different, as the 2-d case is no
longer specialized.

However, you can simulate scipy.packbits by raveling the last 2 dimensions
of the array and calling numpy.packbits with an axis=-1 keyword:

def scipy_packbits(inp):
    a = np.asarray(inp)
    if a.ndim < 2:
       return np.packbits(a)
    oldshape = a.shape
    newshape = oldshape[:-2] + (oldshape[-2]*oldshape[-1],)
    a = np.reshape(a, newshape)
    return np.packbits(a, axis=-1).ravel()
""")

unpackbits = deprecate(unpackbits, message="""
The functionality of scipy.io.unpackbits is now available in numpy.unpackbits
The calling convention is different, however, as the 2-d case is no longer
specialized.

Thus, the scipy.unpackbits behavior must be simulated using numpy.unpackbits.

def scipy_unpackbits(inp, els_per_slice, out_type=None):
    inp = np.asarray(inp)
    num4els = ((els_per_slice-1) >> 3) + 1
    inp = np.reshape(inp, (-1,num4els))
    res = np.unpackbits(inp, axis=-1)[:,:els_per_slice]
    return res.ravel()
""")

convert_objectarray = deprecate(convert_objectarray, message="""
The same functionality can be obtained using NumPy string arrays and the
.astype method (except for the optional missing value feature).
""")

# end deprecated

# matfile read and write
from matlab.mio import loadmat,savemat

# netCDF file support
from netcdf import netcdf_file,netcdf_variable

from recaster import sctype_attributes,Recaster
import matlab.byteordercodes as byteordercodes
from data_store import save_as_module
from mmio import mminfo,mmread,mmwrite

__all__ = filter(lambda s:not s.startswith('_'),dir())
from numpy.testing import Tester
test = Tester().test
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.