<s> from __future__ import absolute_import , division , print_function <EOL> import numpy as np <EOL> from glue . core . data_factories . helpers import has_extension <EOL> from glue . core . data import Component , Data <EOL> from glue . config import data_factory <EOL> __all__ = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ] <EOL> def is_readable_by_astropy ( filename , ** kwargs ) : <EOL> try : <EOL> astropy_table_read ( filename , ** kwargs ) <EOL> except : <EOL> return False <EOL> else : <EOL> return True <EOL> def astropy_table_read ( * args , ** kwargs ) : <EOL> from astropy . table import Table <EOL> if '<STR_LIT>' not in kwargs : <EOL> try : <EOL> return Table . read ( * args , format = '<STR_LIT:ascii>' , ** kwargs ) <EOL> except : <EOL> pass <EOL> return Table . read ( * args , ** kwargs ) <EOL> @ data_factory ( label = "<STR_LIT>" , <EOL> identifier = is_readable_by_astropy , <EOL> priority = <NUM_LIT:0> ) <EOL> def astropy_tabular_data ( * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> result = Data ( ) <EOL> table = astropy_table_read ( * args , ** kwargs ) <EOL> for column_name in table . columns : <EOL> c = table [ column_name ] <EOL> u = c . unit if hasattr ( c , '<STR_LIT>' ) else c . units <EOL> if table . masked : <EOL> try : <EOL> c = c . filled ( fill_value = np . nan ) <EOL> except ValueError : <EOL> c = c . filled ( fill_value = - <NUM_LIT:1> ) <EOL> nc = Component . autotyped ( c , units = u ) <EOL> result . add_component ( nc , column_name ) <EOL> return result <EOL> @ data_factory ( label = "<STR_LIT>" , <EOL> identifier = has_extension ( '<STR_LIT>' ) , <EOL> priority = <NUM_LIT:1> ) <EOL> def astropy_tabular_data_votable ( * args , ** kwargs ) : <EOL> kwargs [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> return astropy_tabular_data ( * args , ** kwargs ) <EOL> @ data_factory ( label = "<STR_LIT>" , <EOL> identifier = has_extension ( '<STR_LIT>' ) , <EOL> priority = <NUM_LIT:1> ) <EOL> def astropy_tabular_data_fits ( * args , ** kwargs ) : <EOL> kwargs [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> return astropy_tabular_data ( * args , ** kwargs ) <EOL> def formatted_table_factory ( format , label ) : <EOL> @ data_factory ( label = label , identifier = lambda * a , ** k : False ) <EOL> def factory ( file , ** kwargs ) : <EOL> kwargs [ '<STR_LIT>' ] = '<STR_LIT>' % format <EOL> return astropy_tabular_data ( file , ** kwargs ) <EOL> factory . __name__ = '<STR_LIT>' % format <EOL> return factory <EOL> sextractor_factory = formatted_table_factory ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> cds_factory = formatted_table_factory ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> daophot_factory = formatted_table_factory ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> ipac_factory = formatted_table_factory ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> aastex_factory = formatted_table_factory ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> latex_factory = formatted_table_factory ( '<STR_LIT>' , '<STR_LIT>' ) </s>
