test_common_catalog.py 733 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
Wei Shoulin committed
16
17
18
            ra=90, 
            dec=24.5, 
            radius=1, 
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 = 0
Wei Shoulin's avatar
c3    
Wei Shoulin committed
24
        )
Wei Shoulin's avatar
Wei Shoulin committed
25
        # print(result)
Wei Shoulin's avatar
Wei Shoulin committed
26
27
28
        # dt = self.api.to_table(result)
        # df = dt.to_pandas()
        # print(df.head())
Wei Shoulin's avatar
no ver    
Wei Shoulin committed
29
        print('used:', time.time()-t)
Wei Shoulin's avatar
Wei Shoulin committed
30
        print('return:', len(result.data))