-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor catalogs, introduce backup Gaia via Vizier (#849)
- Loading branch information
1 parent
3499752
commit 96dc29a
Showing
22 changed files
with
452 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
""" | ||
Base classes for the catalog system. | ||
""" | ||
|
||
from mirar.catalog.base.base_catalog import BaseCatalog, BaseMultiBackendCatalog | ||
from mirar.catalog.base.base_xmatch_catalog import BaseXMatchCatalog | ||
from mirar.catalog.base.errors import CatalogError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
""" | ||
Base Catalog for crossmatching | ||
""" | ||
|
||
from abc import ABC | ||
|
||
from mirar.catalog.base.base_catalog import ABCatalog | ||
|
||
|
||
class BaseXMatchCatalog(ABCatalog, ABC): | ||
""" | ||
Base Catalog for crossmatching | ||
""" | ||
|
||
@property | ||
def catalog_name(self): | ||
""" | ||
Name of catalog | ||
""" | ||
raise NotImplementedError | ||
|
||
@property | ||
def projection(self): | ||
""" | ||
projection for kowalski xmatch | ||
""" | ||
raise NotImplementedError | ||
|
||
@property | ||
def column_names(self): | ||
""" | ||
Name of columns | ||
""" | ||
raise NotImplementedError | ||
|
||
@property | ||
def column_dtypes(self): | ||
""" | ||
dtype of columns | ||
""" | ||
raise NotImplementedError | ||
|
||
@property | ||
def ra_column_name(self): | ||
""" | ||
Name of RA column | ||
""" | ||
raise NotImplementedError | ||
|
||
@property | ||
def dec_column_name(self): | ||
""" | ||
Name of Dec column | ||
""" | ||
raise NotImplementedError | ||
|
||
def __init__(self, *args, num_sources: int = 1, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
self.search_radius_arcsec = self.search_radius_arcmin * 60.0 | ||
self.num_sources = num_sources | ||
|
||
def query(self, coords: dict) -> dict: | ||
""" | ||
Query coords for result | ||
:param coords: ra/dec | ||
:return: crossmatch | ||
""" | ||
raise NotImplementedError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
""" | ||
Module for Catalog base class | ||
""" | ||
|
||
from pathlib import Path | ||
|
||
import astropy.table | ||
|
||
from mirar.catalog.base.base_catalog import BaseCatalog | ||
from mirar.utils.ldac_tools import get_table_from_ldac | ||
|
||
|
||
class CatalogFromFile(BaseCatalog): | ||
""" | ||
Local catalog from file | ||
""" | ||
|
||
abbreviation = "local" | ||
|
||
def __init__(self, catalog_path: str | Path, *args, **kwargs): | ||
super().__init__( | ||
min_mag=0, | ||
max_mag=99, | ||
filter_name="None", | ||
search_radius_arcmin=0, | ||
*args, | ||
**kwargs, | ||
) | ||
self.catalog_path = catalog_path | ||
if isinstance(self.catalog_path, str): | ||
self.catalog_path = Path(self.catalog_path) | ||
|
||
def get_catalog(self, ra_deg: float, dec_deg: float) -> astropy.table.Table: | ||
catalog = get_table_from_ldac(self.catalog_path) | ||
return catalog |
Oops, something went wrong.