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 am trying out an example on APE 6 but I cannot get it to round trip on write/read with Python 3.7.1, Astropy 3.1, and Numpy 1.15.4. I am not sure if there is a policy to ensure APE examples always work, but I am reporting this anyway FWIW.
>>>fromastropy.tableimportTable>>>fromcollectionsimportOrderedDict>>>importastropy.unitsasu>>>t=Table([[1, 4], [2, 3]], names=['a', 'b'])
>>>t.meta['keywords'] =OrderedDict([('z_key1', 'val1'), ('a_key2', 'val2')])
>>>t.meta['comments'] = ['Comment 1', 'Comment 2', 'Comment 3']
>>>t['a'].unit=u.m/u.s>>>t['a'].format='%5.2f'>>>t['a'].description='Column A'>>>t['b'].meta=dict(column_meta={'a':1, 'b': 2})
>>>In [13]: t<Tablelength=2>abm/sint32int32----------1.0024.003>>>t.metaOrderedDict([('keywords',
OrderedDict([('z_key1', 'val1'), ('a_key2', 'val2')])),
('comments', ['Comment 1', 'Comment 2', 'Comment 3'])])
>>>t.write('ztmp.ecsv')
>>>t2=Table.read('ztmp.ecsv')
---------------------------------------------------------------------------IndexErrorTraceback (mostrecentcalllast)
...\astropy\io\ascii\core.pyin_convert_vals(self, cols)
952try:
-->953converter_func, converter_type=col.converters[0]
954ifnotissubclass(converter_type, col.type):
IndexError: listindexoutofrangeDuringhandlingoftheaboveexception, anotherexceptionoccurred:
ValueErrorTraceback (mostrecentcalllast)
<ipython-input-15-eb21516157bd>in<module>---->1t2=Table.read('ztmp.ecsv')
...\astropy\table\table.pyinread(cls, *args, **kwargs)
2546# RST table and inserts at the end of the docstring. DO NOT REMOVE.
2547->2548out=io_registry.read(cls, *args, **kwargs)
2549# For some readers (e.g., ascii.ecsv), the returned `out` classisnot2550# guaranteed to be the same as the desired output `cls`. If so,
...\astropy\io\registry.pyinread(cls, format, *args, **kwargs)
515516reader=get_reader(format, cls)
-->517data=reader(*args, **kwargs)
518519ifnotisinstance(data, cls):
...\astropy\io\ascii\connect.pyinio_read(
format, filename, **kwargs)
35from .uiimportread36format=re.sub(r'^ascii\.', '', format)
--->37returnread(filename, format=format, **kwargs)
3839
...\astropy\io\ascii\ui.pyinread(table, guess, **kwargs)
402else:
403reader=get_reader(**new_kwargs)
-->404dat=reader.read(table)
405_read_trace.append({'kwargs': copy.deepcopy(new_kwargs),
406'Reader': reader.__class__,
...\astropy\io\ascii\core.pyinread(self,
table)
1195ifhasattr(self.header, 'table_meta'):
1196self.meta['table'].update(self.header.table_meta)
->1197table=self.outputter(cols, self.meta)
1198self.cols=self.header.cols1199
...\astropy\io\ascii\ecsv.pyin__call__(self, cols, meta)
190def__call__(self, cols, meta):
191# Convert to a Table with all plain Column subclass columns-->192out=super().__call__(cols, meta)
193194# If mixin columns exist (based on the special '__mixin_columns__'
...\astropy\io\ascii\core.pyin__call__(self, cols, meta)
982# Sets col.data to numpy array and col.type to io.ascii Type class (e.g.
983# FloatType) for each col.-->984self._convert_vals(cols)
985986# If there are any values that were filled and tagged with a maskbitthenthis
...\astropy\io\ascii\core.pyin_convert_vals(self, cols)
967last_err=err968exceptIndexError:
-->969raiseValueError('Column {} failed to convert: {}'.format(col.name, last_err))
970971ValueError: Columnafailedtoconvert: invalidliteralforint() withbase10:
'1.00'
The text was updated successfully, but these errors were encountered:
Why oh why did I make such a weird example? Setting an int to have a %5.2 format is just silly, but of course Python2 was "helpful" and let that not break on roundtrip. The following is a fix:
>>> t = Table([[1.0, 4.0], [2, 3]], names=['a', 'b'])
But the bigger question of testing APE6 examples is quite good.
I am trying out an example on APE 6 but I cannot get it to round trip on write/read with Python 3.7.1, Astropy 3.1, and Numpy 1.15.4. I am not sure if there is a policy to ensure APE examples always work, but I am reporting this anyway FWIW.
The text was updated successfully, but these errors were encountered: