[SciPy-dev] big in records fromfile

Christopher Hanley chanley at stsci.edu
Wed Dec 28 14:45:38 EST 2005


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')


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?

Thank you for your time and help,

Chris




More information about the SciPy-Dev mailing list