from .delegate import Delegate from csst_dfs_commons.models import Result from csst_dfs_api.common.utils import to_table as to_fits_table class CatalogApi(object): def __init__(self): self.module = Delegate().load(sub_module = "common") self.stub = getattr(self.module, "CatalogApi")() def catalog_query(self, ra: float, dec: float, radius: float, catalog_name: str, columns: tuple, min_mag: float, max_mag: float, obstime: int, limit: int): ''' retrieval catalog :param ra: in deg :param dec: in deg :param radius: in deg :param catalog_name: one of ['gaia3','sim'] :param columns: tuple of str, like ('ra','dec','phot_g_mean_mag') :param min_mag: minimal magnitude :param max_mag: maximal magnitude :param obstime: seconds :param limit: limits returns the number of records :returns: csst_dfs_common.models.Result ''' if not catalog_name or catalog_name not in ('gaia3', 'sim', 'trilegal_091','trilegal_093'): raise Exception("catalog_name is not allowed") if not columns: raise Exception("columns is empty") return self.stub.catalog_query(ra = ra, dec = dec, radius = radius, catalog_name = catalog_name, columns = columns, min_mag = min_mag, max_mag = max_mag, obstime = obstime, limit = limit) def to_table(self, query_result): return to_fits_table(query_result)