test_common_catalog.py 1.28 KB
Newer Older
Shoulin Wei's avatar
gaia3  
Shoulin Wei committed
1
import unittest
Wei Shoulin's avatar
no ver    
Wei Shoulin committed
2
import time
Shoulin Wei's avatar
gaia3  
Shoulin Wei committed
3
4
5
6
7
8
9
10

from csst_dfs_api.common.catalog import CatalogApi

class CommonCatalogTestCase(unittest.TestCase):

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

Wei Shoulin's avatar
C9    
Wei Shoulin committed
11
    def test_gaia3_query(self):
Wei Shoulin's avatar
no ver    
Wei Shoulin committed
12
        t= time.time()
Wei Shoulin's avatar
C9    
Wei Shoulin committed
13
        #90,24.5,0.21 => 6033 records
Wei Shoulin's avatar
c3    
Wei Shoulin committed
14
        result = self.api.catalog_query(
Wei Shoulin's avatar
Wei Shoulin committed
15
16
            ra=90, 
            dec=24.5, 
Wei Shoulin's avatar
Wei Shoulin committed
17
            radius=0.21, 
Wei Shoulin's avatar
Wei Shoulin committed
18
            columns = ('ref_epoch','ra','ra_error','dec','dec_error','parallax','parallax_error','pmra','pmra_error','pmdec','pmdec_error','phot_g_mean_mag','source_id'),            
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
C9    
Wei Shoulin committed
23
            limit = 10
Wei Shoulin's avatar
c3    
Wei Shoulin committed
24
        )
Wei Shoulin's avatar
reqs    
Wei Shoulin committed
25
        print(result)
Wei Shoulin's avatar
no ver    
Wei Shoulin committed
26
        print('used:', time.time()-t)
Wei Shoulin's avatar
Wei Shoulin committed
27
        print('return:', len(result.data))
Wei Shoulin's avatar
C9    
Wei Shoulin committed
28
29
30
31

    def test_sim_query(self):
        t= time.time()
        result = self.api.catalog_query(
Wei Shoulin's avatar
C9    
Wei Shoulin committed
32
33
34
            ra=243, 
            dec=40, 
            radius=1, 
Wei Shoulin's avatar
C9    
Wei Shoulin committed
35
36
37
38
39
40
41
42
43
44
            columns = ('id','ra','dec','av','pmdec','phot_g_mean_mag'),            
            catalog_name='sim', 
            min_mag=-1, 
            max_mag=-1, 
            obstime = -1, 
            limit = 20
        )
        print(result)
        print('used:', time.time()-t)
        print('return:', len(result.data))