Commit 36ba9fbc authored by Wei Shoulin's avatar Wei Shoulin
Browse files

gaia3

parent 1abe728d
from urllib import request
import json
class EphemSearchApi(object):
class CatalogApi(object):
def __init__(self):
self.data = []
self.url = 'http://172.31.248.218:30180/search/v2'
def gaia_query(self, ra: float, dec: float, radius: float, mag: float, limit: int):
def gaia3_query(self, ra: float, dec: float, radius: float, min_mag: float, max_mag: float, obstime: int, limit: int):
req = request.Request(url = self.url, method="post")
req.add_header('Content-Type', 'application/json')
data = { "ra":ra, "dec":dec, "radius":radius, "mag": mag, "limit": limit}
data = { "ra":ra, "dec":dec, "radius":radius, "min_mag": min_mag, "max_mag": max_mag, "obstime": obstime, "limit": limit}
data = json.dumps(data)
data = data.encode()
res = request.urlopen(req, data=data)
content = res.read()
......
......@@ -2,13 +2,13 @@ import os
import unittest
from astropy.io import fits
from csst_dfs_api_local.common.ephem import EphemSearchApi
from csst_dfs_api_local.common.catalog import CatalogApi
class CommonEphemTestCase(unittest.TestCase):
def setUp(self):
self.api = EphemSearchApi()
self.api = CatalogApi()
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)
def test_gaia3_query(self):
recs = self.api.gaia3_query(ra=260, dec=-27, radius=0.01, min_mag=-1, max_mag=-1, obstime=-1, limit=2)
print('find:', recs)
\ No newline at end of file
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