def test_read_bad_format(recwarn): """ Tests read() with unsupported format """ try: read('sample.vot.xml', 'fits') except AttributeError as ex: assert "No such format" in str(ex) pass assert len(recwarn) == 0
def test_read_file_dne(recwarn): """ Tests read() with non-existing file """ try: read('sample.vot.xml', 'votable') except OSError as ex: assert "Error reading file" in str(ex) pass assert len(recwarn) == 0
def simple_position_columns_file(make_data_path): return read(make_data_path('simple-position-columns.vot.xml'))
def example_file(make_data_path): return read(make_data_path('ivoa.vot.xml'))
def simple_position_file(make_data_path): return read(make_data_path('simple-position.vot.xml'))
def time_series(make_data_path): return read(make_data_path('time-series.vot.xml'))
def source_data(make_data_path): return read(make_data_path('photdm-source-test.vot.xml'))
def constants_file(make_data_path): return read(make_data_path('constants.vot.xml'))
def ts_file(make_data_path): return read(make_data_path('time-series.vot.xml'))
def invalid_file(make_data_path): return read(make_data_path('invalid.vot.xml'))
def asymmetric_data_file(make_data_path): return read(make_data_path('asymmetric-2d-position.vot.xml'))
def time_file(make_data_path): return read(make_data_path('time.vot.xml'), fmt='votable')
def sample_file(make_data_path): return read(make_data_path('sample.vot.xml'))
def hsc_data_file(make_data_path): return read(make_data_path('hsc.vot.xml'))
def orm_file(make_data_path): return read(make_data_path('orm.vot.xml'))
def attributes_file(make_data_path): return read(make_data_path('attributes.vot.xml'))
def compositions_file(make_data_path): return read(make_data_path('compositions.vot.xml'))
def columns_file(make_data_path): return read(make_data_path('columns.vot.xml'))
def references_file(make_data_path): return read(make_data_path('references.vot.xml'))
def times_file(make_data_path): return read(make_data_path('time.vot.xml'))
from rama import read from rama.models.source import SourcePosition from rama.models.coordinates import SpaceFrame from rama.models.photdmalt import PhotometryFilter parser = read('simple.vot.xml') print(parser) print('SpaceFrame:') space_frames = parser.find_instances(SpaceFrame) for sf in space_frames: print(sf.space_ref_frame) print('\nSourcePosition:') source_positions = parser.find_instances(SourcePosition) for pos in source_positions: print(pos.coord) print(pos.coord.frame) print(pos.coord.ra.degree) print(type(pos.coord.frame)) print('\nPhotometryFilter:') phot_filters = parser.find_instances(PhotometryFilter) for pf in phot_filters: print(pf.name) print(' TransmissionPoint:') if pf.transmission_point is not None: for tp in pf.transmission_point: print(tp.spectral) print(tp.spectral_error)
def literals_file(make_data_path): return read(make_data_path('literals.vot.xml'))