Le dimanche 8 novembre 2015, 05:42:05 Erik Tollerud a écrit :
> Can you tell if it *reads* correctly? That is, can you access parts of the
> file that are beyond the first 2 GB?
Hi Eric,
No, if I try to access the data it raises:
ValueError: mmap length is greater than file size
(more below)
I will try to make a script generating a big FITS file to have an easy
example.
Regards,
Yannick
Full error:
===========
In [10]: f[1].data.shape
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/opt/anaconda3/lib/python3.4/site-packages/astropy/utils/decorators.py in
__get__(self, obj, owner)
338 try:
--> 339 return obj.__dict__[self._key]
340 except KeyError:
KeyError: 'data'
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
<ipython-input-10-8eb3dff55040> in <module>()
----> 1 f[1].data.shape
/opt/anaconda3/lib/python3.4/site-packages/astropy/utils/decorators.py in
__get__(self, obj, owner)
339 return obj.__dict__[self._key]
340 except KeyError:
--> 341 val = self._fget(obj)
342 obj.__dict__[self._key] = val
343 return val
/opt/anaconda3/lib/python3.4/site-packages/astropy/io/fits/hdu/table.py in
data(self)
397 @lazyproperty
398 def data(self):
--> 399 data = self._get_tbdata()
400 data._coldefs = self.columns
401 # Columns should now just return a reference to the
data._coldefs
/opt/anaconda3/lib/python3.4/site-packages/astropy/io/fits/hdu/table.py in
_get_tbdata(self)
166 else:
167 raw_data = self._get_raw_data(self._nrows, columns.dtype,
--> 168 self._data_offset)
169 if raw_data is None:
170 # This can happen when a brand new table HDU is being
created
/opt/anaconda3/lib/python3.4/site-packages/astropy/io/fits/hdu/base.py in
_get_raw_data(self, shape, code, offset)
521 offset=offset)
522 elif self._file:
--> 523 return self._file.readarray(offset=offset, dtype=code,
shape=shape)
524 else:
525 return None
/opt/anaconda3/lib/python3.4/site-packages/astropy/io/fits/file.py in
readarray(self, size, offset, dtype, shape)
246 return Memmap(self._file, offset=offset,
247 mode=MEMMAP_MODES[self.mode], dtype=dtype,
--> 248 shape=shape).view(np.ndarray)
249 else:
250 count = reduce(lambda x, y: x * y, shape)
/opt/anaconda3/lib/python3.4/site-packages/numpy/core/memmap.py in
__new__(subtype, filename, dtype, mode, offset, shape, order)
255 bytes -= start
256 offset -= start
--> 257 mm = mmap.mmap(fid.fileno(), bytes, access=acc, offset=start)
258
259 self = ndarray.__new__(subtype, shape, dtype=descr, buffer=mm,
ValueError: mmap length is greater than file size
--
A journey of a thousand miles must begin with a single step.
-- Lao Tsu