def _votablefile(): table = Table( [[23, 42, 1337], [b'Illuminatus', b"Don't panic, and always carry a towel", b'Elite']], names=('1', '2')) table['1'].meta['ucd'] = 'foo;bar' table['2'].meta['utype'] = 'foobar' votablefile = VOTableFile.from_table(table) info = Info(name='QUERY_STATUS', value='OK') info.content = 'OK' votablefile.resources[0].infos.append(info) return votablefile
def format_votable(self): """ Return ------- Return data in VOTable format. """ names_column = ['obj','ra','dec','mjd','mag','magerr','filter','catalog'] descriptions_column = ['Id of object in catalog the original catalog', 'Right ascension of source','Declination of source', 'Julian Day','Magnitude','Magnitude Error', 'Filter code','Original Catalog'] #dtype_column = [] # dtype=dtype_column t = Table(rows=self.data_np,names=names_column,descriptions=descriptions_column) votable= VOTableFile.from_table(t) buf = io.BytesIO() writeto(votable,buf) return buf.getvalue().decode("utf-8")
def votablefile_dataset(): table = Table([[ 'image/fits', 'application/x-votable+xml', 'application/x-votable+xml;content=datalink' ], [ b'http://example.com/querydata/image.fits', b'http://example.com/querydata/votable.xml', b'http://example.com/querydata/votable-datalink.xml' ]], names=('dataformat', 'dataurl')) table['dataformat'].meta['ucd'] = 'meta.code.mime' table['dataurl'].meta['utype'] = 'Access.Reference' table['dataurl'].meta['ucd'] = 'meta.dataset;meta.ref.url' votablefile = VOTableFile.from_table(table) info = Info(name='QUERY_STATUS', value='OK') info.content = 'OK' votablefile.resources[0].infos.append(info) return votablefile