LSSTDESC / clevar

GNU General Public License v3.0
7 stars 2 forks source link

Error when loading catalog #98

Closed marina-ricci closed 2 years ago

marina-ricci commented 2 years ago

TheClCatalog.read_full command returns teh following error : IndexError: index 0 is out of bounds for axis 1 with size 0

m-aguena commented 2 years ago

@marina-ricci are you using this function to read an external catalog? This function is to be used only for catalogs saved with clevar, for external catalogs use just ClCatalog.read.

marina-ricci commented 2 years ago

Yes I am. Even when I run the catalogs example notebook it breaks.

m-aguena commented 2 years ago

Strange, it does not happen for me. Can you post the full error message?

marina-ricci commented 2 years ago

So I have clevar version '0.9.2' . For instance the 'catalogs' notebook, the cell with cat_temp = cat.read_full('cat1_with_info.fits') breaks with this error message :


IndexError Traceback (most recent call last) /pbs/throng/lsst/users/mricci/desc/my_clean_env/lib/python3.8/site-packages/IPython/core/formatters.py in call(self, obj) 343 method = get_real_method(obj, self.print_method) 344 if method is not None: --> 345 return method() 346 return None 347 else:

/pbs/throng/lsst/users/mricci/desc/my_clean_env/lib/python3.8/site-packages/clevar-0.9.2-py3.8.egg/clevar/catalog.py in _reprhtml(self) 495 for col in show_data_cols: 496 print_data[col] = self.data[col] --> 497 table = print_data._reprhtml() 498 if self.mt_input is not None: 499 for col in self.mt_input.colnames:

/pbs/throng/lsst/users/mricci/desc/my_clean_env/lib/python3.8/site-packages/clevar-0.9.2-py3.8.egg/clevar/catalog.py in _reprhtml(self) 52 return self[key] if key.lower() in self.namedict else default 53 def _reprhtml(self): ---> 54 return APtable._reprhtml(self[[c for c in self.colnames if c!='SkyCoord']]) 55 @classmethod 56 def read(self, filename, **kwargs):

/pbs/throng/lsst/users/mricci/desc/my_clean_env/lib/python3.8/site-packages/astropy/table/table.py in _reprhtml(self) 1519 1520 def _reprhtml(self): -> 1521 out = self._baserepr(html=True, max_width=-1, 1522 tableclass=conf.default_notebook_table_class) 1523 # Wrap

in
. This follows the pattern in pandas and allows

/pbs/throng/lsst/users/mricci/desc/my_clean_env/lib/python3.8/site-packages/astropy/table/table.py in _baserepr(self, html, descr_vals, max_width, tableid, show_dtype, max_lines, tableclass) 1509 tableid = f'table{id(self)}' 1510 -> 1511 data_lines, outs = self.formatter._pformat_table( 1512 self, tableid=tableid, html=html, max_width=max_width, 1513 show_name=True, show_unit=None, show_dtype=show_dtype,

/pbs/throng/lsst/users/mricci/desc/my_clean_env/lib/python3.8/site-packages/astropy/table/pprint.py in _pformat_table(self, table, max_lines, max_width, show_name, show_unit, show_dtype, html, tableid, tableclass, align) 567 continue 568 --> 569 lines, outs = self._pformat_col(col, max_lines, show_name=show_name, 570 show_unit=show_unit, show_dtype=showdtype, 571 align=align)

/pbs/throng/lsst/users/mricci/desc/my_clean_env/lib/python3.8/site-packages/astropy/table/pprint.py in _pformat_col(self, col, max_lines, show_name, show_unit, show_dtype, show_length, html, align) 267 outs=outs) 268 --> 269 col_strs = list(col_strs_iter) 270 if len(col_strs) > 0: 271 col_width = max(len(x) for x in col_strs)

/pbs/throng/lsst/users/mricci/desc/my_clean_env/lib/python3.8/site-packages/astropy/table/pprint.py in _pformat_col_iter(self, col, max_lines, show_name, show_unit, outs, show_dtype, show_length) 472 else: 473 try: --> 474 yield format_col_str(idx) 475 except ValueError: 476 raise ValueError(

/pbs/throng/lsst/users/mricci/desc/my_clean_env/lib/python3.8/site-packages/astropy/table/pprint.py in format_col_str(idx) 460 return format_func(col_format, col[(idx,) + multidim0]) 461 else: --> 462 left = format_func(col_format, col[(idx,) + multidim0]) 463 right = format_func(col_format, col[(idx,) + multidim1]) 464 return f'{left} .. {right}'

astropy/table/_column_mixins.pyx in astropy.table._column_mixins._ColumnGetitemShim.getitem()

astropy/table/_column_mixins.pyx in astropy.table._column_mixins.base_getitem()

astropy/table/_column_mixins.pyx in astropy.table._column_mixins.column_getitem()

IndexError: index 0 is out of bounds for axis 1 with size 0

m-aguena commented 2 years ago

The problem is you are using an old version of the code, this bug was fixed in 0.9.3.