test_common_catalog.py 934 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
Wei Shoulin committed
19
            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
20
21
22
23
            catalog_name='gaia3', 
            min_mag=-1, 
            max_mag=-1, 
            obstime = -1, 
Wei Shoulin's avatar
Wei Shoulin committed
24
            limit = 0
Wei Shoulin's avatar
c3    
Wei Shoulin committed
25
        )
Wei Shoulin's avatar
Wei Shoulin committed
26
        # print(result)
Wei Shoulin's avatar
Wei Shoulin committed
27
28
        dt = self.api.to_table(result)
        dt.pprint()
Wei Shoulin's avatar
Wei Shoulin committed
29
30
        # df = dt.to_pandas()
        # print(df.head())
Wei Shoulin's avatar
no ver    
Wei Shoulin committed
31
        print('used:', time.time()-t)
Wei Shoulin's avatar
Wei Shoulin committed
32
        print('return:', len(result.data))