From 4f28af2caf600ceb176f4e7c2c3885740f2ef590 Mon Sep 17 00:00:00 2001 From: Christoph Toennis Date: Mon, 14 Oct 2024 16:09:57 +0200 Subject: [PATCH] Removing old getter --- src/ctapipe/utils/astro.py | 53 ++------------------------- src/ctapipe/utils/tests/test_astro.py | 24 +++--------- 2 files changed, 8 insertions(+), 69 deletions(-) diff --git a/src/ctapipe/utils/astro.py b/src/ctapipe/utils/astro.py index 915c19a7065..5b2a99aa183 100644 --- a/src/ctapipe/utils/astro.py +++ b/src/ctapipe/utils/astro.py @@ -17,7 +17,7 @@ log = logging.getLogger("main") -__all__ = ["get_bright_stars_with_motion", "get_bright_stars"] +__all__ = ["get_bright_stars"] CACHE_FILE = Path("~/.psf_stars.ecsv").expanduser() @@ -70,7 +70,7 @@ def select_stars(stars, pointing=None, radius=None, Bmag_cut=None, Vmag_cut=None return stars -def get_bright_stars_with_motion( +def get_bright_stars( pointing=None, radius=None, Bmag_cut=None, Vmag_cut=None, catalog="Yale" ): # max_magnitude): """ @@ -128,7 +128,7 @@ def get_bright_stars_with_motion( row_limit=1000000, ) - stars = vizier.query_constraints(Vmag="0.0..100.0")[0] + stars = vizier.query_constraints(Vmag="0.0..10.0")[0] if "Bmag" in stars.keys(): if Bmag_cut is not None: stars.meta["Bmag_cut"] = Bmag_cut @@ -156,50 +156,3 @@ def get_bright_stars_with_motion( ) return stars - - -def get_bright_stars(pointing=None, radius=None, magnitude_cut=None): - """ - Get an astropy table of bright stars. - - This function is using the Yale bright star catalog, available through ctapipe - data downloads. - - The included Yale bright star catalog contains all 9096 stars, excluding the - Nova objects present in the original catalog and is complete down to magnitude - ~6.5, while the faintest included star has mag=7.96. :cite:p:`bright-star-catalog` - - Parameters - ---------- - pointing: astropy Skycoord - pointing direction in the sky (if none is given, full sky is returned) - radius: astropy angular units - Radius of the sky region around pointing position. Default: full sky - magnitude_cut: float - Return only stars above a given magnitude. Default: None (all entries) - - Returns - ------- - Astropy table: - List of all stars after cuts with names, catalog numbers, magnitudes, - and coordinates - """ - from ctapipe.utils import get_table_dataset - - catalog = get_table_dataset("yale_bright_star_catalog5", role="bright star catalog") - - starpositions = SkyCoord( - ra=Angle(catalog["RAJ2000"], unit=u.deg), - dec=Angle(catalog["DEJ2000"], unit=u.deg), - frame="icrs", - copy=False, - ) - catalog["ra_dec"] = starpositions - - catalog = select_stars( - catalog, pointing=pointing, radius=radius, Vmag_cut=magnitude_cut - ) - - catalog.remove_columns(["RAJ2000", "DEJ2000"]) - - return catalog diff --git a/src/ctapipe/utils/tests/test_astro.py b/src/ctapipe/utils/tests/test_astro.py index 860923be7a7..9bd7a923eec 100644 --- a/src/ctapipe/utils/tests/test_astro.py +++ b/src/ctapipe/utils/tests/test_astro.py @@ -5,13 +5,14 @@ from astropy import units as u from astropy.coordinates import Angle, SkyCoord -from ..astro import get_bright_stars, get_bright_stars_with_motion +from ..astro import get_bright_stars -def test_get_bright_stars_with_motion(): +def test_get_bright_stars(): """ unit test for utils.astro.get_bright_stars_with_motion(). """ + # TODO add tests for all catalogues, specifically by trying to find some particular bright star, also test that motion is properly included pointing = SkyCoord( ra=Angle("03 47 29.1", unit=u.deg), dec=Angle("+24 06 18", unit=u.deg), @@ -20,21 +21,6 @@ def test_get_bright_stars_with_motion(): # lets find 25 Eta Tau - table = get_bright_stars_with_motion( - pointing=pointing, radius=1.0 * u.deg, Vmag_cut=3.5 - ) - - assert len(table) == 1 - - -def test_get_bright_stars(): - """ - unit test for utils.astro.get_bright_stars(). Tests that only Zeta Tau is - returned close to the Crab Nebula as object brighter than mag=3.5. - """ - pointing = SkyCoord(ra=83.275 * u.deg, dec=21.791 * u.deg, frame="icrs") - - table = get_bright_stars(pointing, radius=2.0 * u.deg, magnitude_cut=3.5) + table = get_bright_stars(pointing=pointing, radius=1.0 * u.deg, Vmag_cut=3.5) - assert len(table) == 1 - assert table[0]["Name"] == "123Zet Tau" + assert len(table) == 1 # this looks if 25 Eta Tau was found