[SciPy-dev] big in records fromfile
Travis Oliphant
oliphant at ee.byu.edu
Wed Dec 28 14:52:16 EST 2005
Christopher Hanley wrote:
>Hi Travis,
>
>I've been working on the pyfits port and have run across a problem with
>fromfiles in records.py. Using the testdata.fits file that is part of
>the numarray distribution I receive the following output during testing
>with numarray:
>
>In [1]: from numarray import records
>
>In [2]: from numarray import testdata
>
>In [3]: fd = open("testdata.fits")
>
>In [4]: fd.seek(2880*2)
>
>In [5]: r = records.fromfile(fd, formats='f8,i4,a5', shape=3,
>byteorder='big')
>
>In [6]: r
>Out[6]:
>array(
>[(5.1000000000000005, 61, 'abcde'),
>(5.2000000000000002, 62, 'fghij'),
>(5.3000000000000007, 63, 'kl')],
>formats=['1Float64', '1Int32', '1a5'],
>shape=3,
>names=['c1', 'c2', 'c3'])
>
>In [7]: r[0]
>Out[7]: <numarray.records.Record instance at 0x4052e16c>
>
>In [8]: print r[0]
>(5.1000000000000005, 61, 'abcde')
>
>
>However, when using the same file with scipy.base I get the following
>results:
>
>In [1]: import scipy.base
>
>In [2]: from scipy.base import records as rec
>
>In [3]: fd = open("testdata.fits")
>
>In [4]: fd.seek(2880*2)
>
>In [5]: r = rec.fromfile(fd, formats='f8,i4,a5', shape=3, byteorder='big')
>
>In [6]: r[0]
>Out[6]: (1.2475423563769078e+190, 1023410176, 'abcde')
>
>In [7]: print r[0]
>(1.2475423563769078e+190, 1023410176, 'abcde')
>
>
Hmm. I thought we fixed that problem. In fact I ran that very test to
verify it. I'll have to look into it again.
>This example also raises another question. How would you want me to
>create a unit test for this type of operation? Should I check a FITS
>file into the test directory?
>
>
>
I don't see a problem with checking in a FITS file (if it's not too
big). However, setup.py needs someway to know it is supposed to be
distributed (either the MANIFEST.in file) or adding it to the depends
keyword in one of the packages.
-Travis
More information about the SciPy-Dev
mailing list