You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having a problem with reading this IPAC table. It gives me the following error:
WARNING: OverflowError converting to IntType for column cntr, using string instead. [astropy.io.ascii.core]
When presenting these commands:
>> from astropy.io import ascii as ai
> > fl = 'IPAC_Example.dat'
> > ip = ascii.Ipac('right')
> > testdat = ip.read(fl)
I get this error no matter how I initiate "ip" -- whether leaving it default or otherwise. This isn't the only column to which this occurred and I deleted previous ones that created the problem in case that was the issue.
I'm guessing now that you are on Windows, where the default numpy int is 32-bits. We need to think about a good way of addressing this, but on windows by default when you read int data it will come out as 32 bits. In your case the values are larger than 32 bits can support so that's why you see the warning. Here is a workaround that you can try:
In [24]: from astropy.io import ascii
In [26]: ascii.core.TableOutputter.default_converters[0] = ascii.core.convert_numpy(np.int64)
In [27]: t = Table.read('IPAC_Example.tbl', format='ascii.ipac')
In [28]: t
Out[28]:
<Table masked=True length=32>
source_id_mf ra dec nb na ... z spt_ind htm20 dist angle
deg deg ... arcsec deg
str20 float64 float64 int64 int64 ... float64 int64 int64 float64 float64
-------------------- ----------- ---------- ----- ----- ... -------------- --------- -------------- -------- ----------
3052p318_ac51-055314 305.7726835 32.4414689 1 0 ... 0.536437752827 203323010 14272479624209 1.067433 208.287782
3052p318_ac51-055314 305.7726835 32.4414689 1 0 ... 0.536437752827 203323010 14272479624209 1.067433 208.287782
Following the links through, I suppose that #5347 has addressed this issue.
Please reopen if you find otherwise, I can't test it locally (as it works as expected on non-windows).
Activity
taldcroft commentedon Mar 11, 2016
Can you provide a minimal snippet of the file that fails so we can reproduce your problem?
astropatel commentedon Mar 11, 2016
My apologies. I thought I had. I have uploaded it now.
IPAC_Example.tbl.zip
taldcroft commentedon Mar 11, 2016
I'm guessing now that you are on Windows, where the default numpy
intis 32-bits. We need to think about a good way of addressing this, but on windows by default when you read int data it will come out as 32 bits. In your case the values are larger than 32 bits can support so that's why you see the warning. Here is a workaround that you can try:astropatel commentedon Mar 11, 2016
Indeed I am working on a windows. Thank you! That worked.
taldcroft commentedon Mar 12, 2016
See #4686 for a potential fix.
bsipocz commentedon Jun 19, 2019
Following the links through, I suppose that #5347 has addressed this issue.
Please reopen if you find otherwise, I can't test it locally (as it works as expected on non-windows).