[SciPy-user] Automatically retreiving Matrix Market files

Pearu Peterson pearu at scipy.org
Thu Nov 11 07:13:33 CST 2004



On Thu, 11 Nov 2004, Nils Wagner wrote:

> Hi all,
>
> I am going to retreive test matrices from the Matrix Market page
>
> from scipy import *
> from tempfile import mktemp
> from urllib import urlretrieve
> url="http://math.nist.gov/MatrixMarket/data/SPARSKIT/fidap"
> fname =  mktemp(".mtx.gz")
> print "Downloading Matrix Market; this may take a minute..."
> urlretrieve(url, fname)
>
> How can I decompress the file afterwards and how do I use
>
> io.mmread()
>
> to import the matrix under consideration.

Try:

   import gzip
   io.mmread(gzip.open(fname))

Pearu



More information about the SciPy-user mailing list