diff --git a/docs/changelog.md b/docs/changelog.md index f3228feb..d6558a03 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -10,6 +10,9 @@ - [**v0.15.1**] Fixes bug with build script that prevented starplot data from being included in the distribution - [**v0.15.2**] Fixes a few colors in the dark blue and blue gold style extensions - [**v0.15.3**] Locks version of a few dependencies (DuckDB and Ibis) +- [**v0.15.4**] + - Fixes constellation lines for Mensa + - Optimizes star catalog loading ## v0.14.x [Documentation](https://archives.starplot.dev/0.14.0/) diff --git a/src/starplot/__init__.py b/src/starplot/__init__.py index afa89dde..0cf5487c 100644 --- a/src/starplot/__init__.py +++ b/src/starplot/__init__.py @@ -1,6 +1,6 @@ """Star charts and maps of the sky""" -__version__ = "0.15.3" +__version__ = "0.15.4" from .base import BasePlot # noqa: F401 from .map import MapPlot, Projection # noqa: F401 diff --git a/src/starplot/data/constellation_lines.py b/src/starplot/data/constellation_lines.py index 92e01d97..18543a67 100644 --- a/src/starplot/data/constellation_lines.py +++ b/src/starplot/data/constellation_lines.py @@ -499,7 +499,11 @@ [93194, 92420], [92420, 91971], ], - "men": [[29271, 23467]], + "men": [ + [29271, 25918], + [25918, 22871], + [22871, 23467], + ], "mic": [[102831, 103738], [103738, 105140], [105140, 105382]], "mon": [ [31978, 31216], diff --git a/src/starplot/data/constellation_stars.py b/src/starplot/data/constellation_stars.py index dd9cfde3..7bdb050d 100644 --- a/src/starplot/data/constellation_stars.py +++ b/src/starplot/data/constellation_stars.py @@ -897,6 +897,7 @@ 22783, 22797, 22845, + 22871, 22957, 23015, 23040, @@ -921,6 +922,7 @@ 25428, 25606, 25859, + 25918, 25930, 25985, 26069, diff --git a/src/starplot/data/stars.py b/src/starplot/data/stars.py index b976c81d..e32f4be6 100644 --- a/src/starplot/data/stars.py +++ b/src/starplot/data/stars.py @@ -1,3 +1,5 @@ +from functools import cache + import ibis from ibis import _ @@ -456,15 +458,15 @@ class StarCatalog: """ -def load(extent=None, catalog: StarCatalog = StarCatalog.BIG_SKY_MAG11, filters=None): - filters = filters or [] +@cache +def read_catalog(catalog: StarCatalog = StarCatalog.BIG_SKY_MAG11, table_name="stars"): con = db.connect() if catalog == StarCatalog.BIG_SKY_MAG11: - stars = con.read_parquet(DataFiles.BIG_SKY_MAG11, "stars") + stars = con.read_parquet(DataFiles.BIG_SKY_MAG11, table_name) elif catalog == StarCatalog.BIG_SKY: bigsky.download_if_not_exists() - stars = con.read_parquet(DataFiles.BIG_SKY, "stars") + stars = con.read_parquet(DataFiles.BIG_SKY, table_name) else: raise ValueError("Unrecognized star catalog.") @@ -481,9 +483,6 @@ def load(extent=None, catalog: StarCatalog = StarCatalog.BIG_SKY_MAG11, filters= rowid=ibis.row_number(), ) - if extent: - stars = stars.filter(stars.geometry.intersects(extent)) - stars = stars.join( designations, [ @@ -493,6 +492,16 @@ def load(extent=None, catalog: StarCatalog = StarCatalog.BIG_SKY_MAG11, filters= how="left", ) + return stars + + +def load(extent=None, catalog: StarCatalog = StarCatalog.BIG_SKY_MAG11, filters=None): + filters = filters or [] + stars = read_catalog(catalog) + + if extent: + stars = stars.filter(stars.geometry.intersects(extent)) + if filters: return stars.filter(*filters)