test_common_catalog.py 721 Bytes
Newer Older
Shoulin Wei's avatar
gaia3  
Shoulin Wei committed
1
2
3
import os
import unittest
from astropy.io import fits
Wei Shoulin's avatar
no ver    
Wei Shoulin committed
4
import time
Shoulin Wei's avatar
gaia3  
Shoulin Wei committed
5
6
7
8
9
10
11
12

from csst_dfs_api.common.catalog import CatalogApi

class CommonCatalogTestCase(unittest.TestCase):

    def setUp(self):
        self.api = CatalogApi()

Wei Shoulin's avatar
c3    
Wei Shoulin committed
13
    def test_catalog_query(self):
Wei Shoulin's avatar
no ver    
Wei Shoulin committed
14
        t= time.time()
Wei Shoulin's avatar
c3    
Wei Shoulin committed
15
        result = self.api.catalog_query(
Wei Shoulin's avatar
no ver    
Wei Shoulin committed
16
17
            ra=128, # 15415
            dec=-40, 
Wei Shoulin's avatar
Wei Shoulin committed
18
            radius=2, 
Wei Shoulin's avatar
c3    
Wei Shoulin committed
19
20
21
22
            catalog_name='gaia3', 
            min_mag=-1, 
            max_mag=-1, 
            obstime = -1, 
Wei Shoulin's avatar
Wei Shoulin committed
23
            limit = -1
Wei Shoulin's avatar
c3    
Wei Shoulin committed
24
        )
Wei Shoulin's avatar
Wei Shoulin committed
25
26
27
        # dt = self.api.to_table(result)
        # df = dt.to_pandas()
        # print(df.head())
Wei Shoulin's avatar
no ver    
Wei Shoulin committed
28
        print('used:', time.time()-t)
Wei Shoulin's avatar
Wei Shoulin committed
29
        print('return:', result['totalCount'])