Commit 52aa0c24 authored by Wei Shoulin's avatar Wei Shoulin
Browse files

to astropy table

parent cc619975
...@@ -28,16 +28,19 @@ class CatalogApi(object): ...@@ -28,16 +28,19 @@ class CatalogApi(object):
return self.gaia3_query(ra, dec, radius, min_mag, max_mag, obstime, limit) return self.gaia3_query(ra, dec, radius, min_mag, max_mag, obstime, limit)
else: else:
return Result.error(message="%s catalog search not yet implemented" %(catalog_name, )) return Result.error(message="%s catalog search not yet implemented" %(catalog_name, ))
def _fields_dtypes(self, rec): def _fields_dtypes(self, rec):
fields = tuple(rec.__dataclass_fields__.keys()) fields = tuple(rec.__dataclass_fields__.keys())
dtypes = [] dtypes = []
for _, f in rec.__dataclass_fields__.items(): for _, f in rec.__dataclass_fields__.items():
if f.type == int: if f.type == int:
dtypes.append('i8') dtypes.append('i8')
if f.type == float: elif f.type == float:
dtypes.append('f8') dtypes.append('f8')
if f.type == str: elif f.type == str:
dtypes.append('S2') dtypes.append('S2')
else:
dtypes.append('S2')
dtypes = tuple(dtypes) dtypes = tuple(dtypes)
return fields, dtypes return fields, dtypes
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment