Commit 7c92aad2 authored by Shoulin Wei's avatar Shoulin Wei
Browse files

gaia3

parent 4e772e6e
from .delegate import Delegate
class CatalogApi(object):
def __init__(self):
self.module = Delegate().load(sub_module = "common")
self.stub = getattr(self.module, "CatalogApi")()
def catalog_query(self, ra: float, dec: float, radius: float, catalog_name: str, min_mag: float, max_mag: float, obstime: int, limit: int):
''' retrieval catalot
args:
ra: in deg
dec: in deg
radius: in deg
catalog_name: one of ['gaia3','','']
min_mag: minimal magnitude
max_mag: maximal magnitude
obstime: seconds
limit: limits returns the number of records
return: a dict as {success: true, totalCount: 100, records:[.....]}
'''
if catalog_name == "gaia3":
return self.gaia3_query(ra, dec, radius, min_mag, max_mag, obstime, limit)
else:
raise Exception("%s catalog search not yet implemented" %(catalog_name, ))
def gaia3_query(self, ra: float, dec: float, radius: float, min_mag: float, max_mag: float, obstime: int, limit: int):
''' retrieval GAIA DR 3
args:
ra: in deg
dec: in deg
radius: in deg
min_mag: minimal magnitude
max_mag: maximal magnitude
obstime: seconds
limit: limits returns the number of records
return: a dict as {success: true, totalCount: 100, records:[.....]}
'''
return self.stub.gaia3_query(ra, dec, radius, min_mag, max_mag, obstime, limit)
from .delegate import Delegate
class EphemSearchApi(object):
def __init__(self):
self.module = Delegate().load(sub_module = "common")
self.stub = getattr(self.module, "EphemSearchApi")()
def gaia_query(self, ra: float, dec: float, radius: float, mag: float, limit: int = 1000):
''' retivial GAIA DR 2
args:
ra: in deg
dec: in deg
radius: in deg
mag:
limit: limits on the number of returns
return: a dict as {success: true, totalCount: 100, records:[.....]}
'''
return self.stub.gaia_query(ra, dec, radius, mag, limit)
import os
import unittest
from astropy.io import fits
from csst_dfs_api.common.catalog import CatalogApi
class CommonCatalogTestCase(unittest.TestCase):
def setUp(self):
self.api = CatalogApi()
def test_gaia3_query(self):
recs = self.api.gaia3_query(ra=56.234039029108935, dec=14.466534827703473, radius=4, min_mag=-1, max_mag=-1, obstime = -1, limit = 2)
print('find:', recs)
import os
import unittest
from astropy.io import fits
from csst_dfs_api.common.ephem import EphemSearchApi
class CommonEphemTestCase(unittest.TestCase):
def setUp(self):
self.api = EphemSearchApi()
def test_gaia_query(self):
recs = self.api.gaia_query(ra=260, dec=-27, radius=0.01, mag=0.01, limit=2)
print('find:', recs)
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