def _load_coldefs(cls, fileobj): """ Read the table column definitions from the ASCII file output by BinTableHDU.dump(). """ close_file = False if isinstance(fileobj, basestring): fileobj = open(fileobj, 'r') close_file = True columns = [] for line in fileobj: words = line[:-1].split() kwargs = {} for key in ['name', 'format', 'disp', 'unit', 'dim']: kwargs[key] = words.pop(0).replace('""', '') for key in ['null', 'bscale', 'bzero']: word = words.pop(0).replace('""', '') if word: word = _str_to_num(word) kwargs[key] = word columns.append(Column(**kwargs)) if close_file: fileobj.close() return ColDefs(columns)