starplot 0.18.3__py2.py3-none-any.whl → 0.19.0__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- starplot/__init__.py +33 -27
- starplot/data/__init__.py +3 -5
- starplot/data/catalogs.py +23 -11
- starplot/data/db.py +1 -7
- starplot/models/__init__.py +3 -1
- starplot/models/constellation.py +7 -1
- starplot/models/milky_way.py +30 -0
- starplot/models/observer.py +11 -2
- starplot/plots/__init__.py +6 -0
- starplot/{base.py → plots/base.py} +74 -439
- starplot/{horizon.py → plots/horizon.py} +12 -10
- starplot/{map.py → plots/map.py} +10 -7
- starplot/{optic.py → plots/optic.py} +21 -30
- starplot/{zenith.py → plots/zenith.py} +31 -8
- starplot/plotters/__init__.py +9 -7
- starplot/plotters/arrow.py +1 -1
- starplot/plotters/constellations.py +46 -61
- starplot/plotters/dsos.py +33 -16
- starplot/plotters/experimental.py +0 -1
- starplot/plotters/milkyway.py +15 -6
- starplot/plotters/stars.py +19 -36
- starplot/plotters/text.py +464 -0
- starplot/styles/__init__.py +4 -4
- starplot/styles/base.py +1 -13
- {starplot-0.18.3.dist-info → starplot-0.19.0.dist-info}/METADATA +2 -1
- {starplot-0.18.3.dist-info → starplot-0.19.0.dist-info}/RECORD +29 -27
- starplot/data/library/sky.db +0 -0
- {starplot-0.18.3.dist-info → starplot-0.19.0.dist-info}/WHEEL +0 -0
- {starplot-0.18.3.dist-info → starplot-0.19.0.dist-info}/entry_points.txt +0 -0
- {starplot-0.18.3.dist-info → starplot-0.19.0.dist-info}/licenses/LICENSE +0 -0
starplot/__init__.py
CHANGED
|
@@ -1,36 +1,42 @@
|
|
|
1
|
+
# ruff: noqa: F401,F403
|
|
2
|
+
|
|
1
3
|
"""Star charts and maps of the sky"""
|
|
2
4
|
|
|
3
|
-
__version__ = "0.
|
|
5
|
+
__version__ = "0.19.0"
|
|
4
6
|
|
|
5
|
-
from .
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
from .plots import (
|
|
8
|
+
MapPlot,
|
|
9
|
+
HorizonPlot,
|
|
10
|
+
OpticPlot,
|
|
11
|
+
ZenithPlot,
|
|
12
|
+
)
|
|
10
13
|
from .models import (
|
|
11
|
-
DSO,
|
|
12
|
-
DsoType,
|
|
13
|
-
Star,
|
|
14
|
-
Constellation,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
DSO,
|
|
15
|
+
DsoType,
|
|
16
|
+
Star,
|
|
17
|
+
Constellation,
|
|
18
|
+
ConstellationBorder,
|
|
19
|
+
Comet,
|
|
20
|
+
Planet,
|
|
21
|
+
Moon,
|
|
22
|
+
Sun,
|
|
23
|
+
ObjectList,
|
|
24
|
+
Scope,
|
|
25
|
+
Binoculars,
|
|
26
|
+
Reflector,
|
|
27
|
+
Refractor,
|
|
28
|
+
Camera,
|
|
29
|
+
Satellite,
|
|
30
|
+
Observer,
|
|
31
|
+
MilkyWay,
|
|
27
32
|
)
|
|
28
|
-
from .data import Catalog
|
|
29
|
-
from .styles import *
|
|
30
|
-
from .projections import *
|
|
31
|
-
from .config import settings
|
|
33
|
+
from .data import Catalog
|
|
34
|
+
from .styles import *
|
|
35
|
+
from .projections import *
|
|
36
|
+
from .config import settings
|
|
37
|
+
from .plotters.text import CollisionHandler
|
|
32
38
|
|
|
33
|
-
from ibis import _
|
|
39
|
+
from ibis import _
|
|
34
40
|
|
|
35
41
|
|
|
36
42
|
import contextlib
|
starplot/data/__init__.py
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
# ruff: noqa: F401,F403
|
|
2
|
+
|
|
1
3
|
from pathlib import Path
|
|
2
4
|
|
|
3
5
|
from skyfield.api import Loader
|
|
4
6
|
|
|
5
7
|
from starplot.config import settings
|
|
6
|
-
from .catalogs import Catalog
|
|
8
|
+
from .catalogs import Catalog
|
|
7
9
|
|
|
8
10
|
load = Loader(settings.data_path) # used for loading ephemeris
|
|
9
11
|
|
|
@@ -16,9 +18,5 @@ INTERNAL_DATA_PATH = HERE / "library"
|
|
|
16
18
|
|
|
17
19
|
class DataFiles:
|
|
18
20
|
STAR_DESIGNATIONS = INTERNAL_DATA_PATH / "star_designations.parquet"
|
|
19
|
-
|
|
20
21
|
CONSTELLATION_NAMES = INTERNAL_DATA_PATH / "constellation_names.parquet"
|
|
21
|
-
|
|
22
22
|
DSO_NAMES = INTERNAL_DATA_PATH / "dso_names.parquet"
|
|
23
|
-
|
|
24
|
-
DATABASE = INTERNAL_DATA_PATH / "sky.db"
|
starplot/data/catalogs.py
CHANGED
|
@@ -290,31 +290,31 @@ class Catalog:
|
|
|
290
290
|
# --------------------------------------------------------
|
|
291
291
|
|
|
292
292
|
BIG_SKY = Catalog(
|
|
293
|
-
path=settings.data_path / "stars.bigksy.0.1.
|
|
294
|
-
url="https://github.com/steveberardi/starplot-bigsky/releases/download/v0.1.
|
|
293
|
+
path=settings.data_path / "stars.bigksy.0.1.3.mag16.parquet",
|
|
294
|
+
url="https://github.com/steveberardi/starplot-bigsky/releases/download/v0.1.3/stars.bigksy.0.1.3.mag16.parquet",
|
|
295
295
|
)
|
|
296
296
|
"""
|
|
297
297
|
[Big Sky Catalog](https://github.com/steveberardi/bigsky) ~ 2.5M stars
|
|
298
298
|
|
|
299
|
-
This is the full version of the Big Sky Catalog, which includes 2,557,
|
|
299
|
+
This is the full version of the Big Sky Catalog, which includes 2,557,501 stars from Hipparcos, Tycho-1, and Tycho-2.
|
|
300
300
|
"""
|
|
301
301
|
|
|
302
302
|
BIG_SKY_MAG11 = Catalog(
|
|
303
|
-
path=settings.data_path / "stars.bigksy.0.1.
|
|
304
|
-
url="https://github.com/steveberardi/starplot-bigsky/releases/download/v0.1.
|
|
303
|
+
path=settings.data_path / "stars.bigksy.0.1.3.mag11.parquet",
|
|
304
|
+
url="https://github.com/steveberardi/starplot-bigsky/releases/download/v0.1.3/stars.bigksy.0.1.3.mag11.parquet",
|
|
305
305
|
)
|
|
306
306
|
"""
|
|
307
|
-
[Big Sky Catalog](https://github.com/steveberardi/bigsky) ~ 983,
|
|
307
|
+
[Big Sky Catalog](https://github.com/steveberardi/bigsky) ~ 983,823 stars with limiting magnitude 11
|
|
308
308
|
|
|
309
309
|
This is an _abridged_ version of the Big Sky Catalog.
|
|
310
310
|
"""
|
|
311
311
|
|
|
312
312
|
BIG_SKY_MAG9 = Catalog(
|
|
313
|
-
path=settings.data_path / "stars.bigksy.0.1.
|
|
314
|
-
url="https://github.com/steveberardi/starplot-bigsky/releases/download/v0.1.
|
|
313
|
+
path=settings.data_path / "stars.bigksy.0.1.3.mag9.parquet",
|
|
314
|
+
url="https://github.com/steveberardi/starplot-bigsky/releases/download/v0.1.3/stars.bigksy.0.1.3.mag9.parquet",
|
|
315
315
|
)
|
|
316
316
|
"""
|
|
317
|
-
[Big Sky Catalog](https://github.com/steveberardi/bigsky) ~ 136,
|
|
317
|
+
[Big Sky Catalog](https://github.com/steveberardi/bigsky) ~ 136,126 stars with limiting magnitude 9
|
|
318
318
|
|
|
319
319
|
This is an _abridged_ version of the Big Sky Catalog.
|
|
320
320
|
"""
|
|
@@ -328,13 +328,23 @@ OPEN_NGC = Catalog(
|
|
|
328
328
|
"""
|
|
329
329
|
|
|
330
330
|
CONSTELLATIONS_IAU = Catalog(
|
|
331
|
-
path=settings.data_path / "constellations-iau-0.
|
|
332
|
-
url="https://github.com/steveberardi/starplot-constellations/releases/download/v0.
|
|
331
|
+
path=settings.data_path / "constellations-iau-0.2.0.parquet",
|
|
332
|
+
url="https://github.com/steveberardi/starplot-constellations/releases/download/v0.2.0/constellations.0.2.0.parquet",
|
|
333
333
|
)
|
|
334
334
|
"""
|
|
335
335
|
Constellations recognized by IAU, with lines by Sky & Telescope.
|
|
336
336
|
"""
|
|
337
337
|
|
|
338
|
+
CONSTELLATION_BORDERS = Catalog(
|
|
339
|
+
path=settings.data_path / "constellations-borders-0.2.0.parquet",
|
|
340
|
+
url="https://github.com/steveberardi/starplot-constellations/releases/download/v0.2.0/constellations-borders.0.2.0.parquet",
|
|
341
|
+
)
|
|
342
|
+
|
|
343
|
+
MILKY_WAY = Catalog(
|
|
344
|
+
path=settings.data_path / "milky_way-0.1.0.parquet",
|
|
345
|
+
url="https://github.com/steveberardi/starplot-milkyway/releases/download/v0.1.0/milky_way.parquet",
|
|
346
|
+
)
|
|
347
|
+
|
|
338
348
|
|
|
339
349
|
def download_all_catalogs(silent=False):
|
|
340
350
|
BIG_SKY.download_if_not_exists(silent=silent)
|
|
@@ -342,3 +352,5 @@ def download_all_catalogs(silent=False):
|
|
|
342
352
|
BIG_SKY_MAG11.download_if_not_exists(silent=silent)
|
|
343
353
|
OPEN_NGC.download_if_not_exists(silent=silent)
|
|
344
354
|
CONSTELLATIONS_IAU.download_if_not_exists(silent=silent)
|
|
355
|
+
CONSTELLATION_BORDERS.download_if_not_exists(silent=silent)
|
|
356
|
+
MILKY_WAY.download_if_not_exists(silent=silent)
|
starplot/data/db.py
CHANGED
|
@@ -12,13 +12,7 @@ NAME_TABLES = {
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
def connect():
|
|
15
|
-
connection = duckdb.connect(
|
|
16
|
-
DataFiles.DATABASE,
|
|
17
|
-
read_only=True,
|
|
18
|
-
# threads=4,
|
|
19
|
-
# memory_limit="1GB",
|
|
20
|
-
)
|
|
21
|
-
|
|
15
|
+
connection = duckdb.connect()
|
|
22
16
|
path = settings.data_path / "duckdb-extensions"
|
|
23
17
|
connection.raw_sql(f"SET extension_directory = '{str(path)}';")
|
|
24
18
|
|
starplot/models/__init__.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# ruff: noqa: F401,F403
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
from .constellation import Constellation, ConstellationBorder
|
|
3
4
|
from .comet import Comet
|
|
4
5
|
from .dso import DSO, DsoType
|
|
5
6
|
from .star import Star
|
|
@@ -17,3 +18,4 @@ from .optics import (
|
|
|
17
18
|
from .objects import ObjectList
|
|
18
19
|
from .satellite import Satellite
|
|
19
20
|
from .observer import Observer
|
|
21
|
+
from .milky_way import MilkyWay
|
starplot/models/constellation.py
CHANGED
|
@@ -2,7 +2,7 @@ from typing import Iterator
|
|
|
2
2
|
from dataclasses import dataclass
|
|
3
3
|
|
|
4
4
|
from ibis import _
|
|
5
|
-
from shapely import Polygon, MultiPolygon
|
|
5
|
+
from shapely import Polygon, MultiPolygon, LineString
|
|
6
6
|
|
|
7
7
|
from starplot.models.base import SkyObject, CatalogObject
|
|
8
8
|
from starplot.data.catalogs import Catalog, CONSTELLATIONS_IAU
|
|
@@ -132,3 +132,9 @@ def from_tuple(c: tuple) -> Constellation:
|
|
|
132
132
|
kwargs = {f: getattr(c, f) for f in Constellation._fields() if hasattr(c, f)}
|
|
133
133
|
c = Constellation(**kwargs)
|
|
134
134
|
return c
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
@dataclass(slots=True, kw_only=True)
|
|
138
|
+
class ConstellationBorder(CatalogObject, SkyObject):
|
|
139
|
+
geometry: LineString
|
|
140
|
+
"""Shapely LineString of the border. Right ascension coordinates are in degrees (0...360)."""
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
import pyarrow as pa
|
|
4
|
+
from shapely import Polygon, MultiPolygon
|
|
5
|
+
|
|
6
|
+
from starplot.models.base import SkyObject, CatalogObject
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass(slots=True, kw_only=True)
|
|
10
|
+
class MilkyWay(CatalogObject, SkyObject):
|
|
11
|
+
"""
|
|
12
|
+
Milky Way model.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
geometry: Polygon | MultiPolygon
|
|
16
|
+
"""Shapely Polygon of the Milky Way's extent. Right ascension coordinates are in degrees (0...360)."""
|
|
17
|
+
|
|
18
|
+
@classmethod
|
|
19
|
+
def _pyarrow_schema(cls):
|
|
20
|
+
base_schema = super(MilkyWay, cls)._pyarrow_schema()
|
|
21
|
+
extra_fields = [
|
|
22
|
+
pa.field("pk", pa.int64(), nullable=False),
|
|
23
|
+
pa.field("geometry", pa.binary(), nullable=False),
|
|
24
|
+
]
|
|
25
|
+
return pa.schema(list(base_schema) + extra_fields)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def from_tuple(d: tuple) -> MilkyWay:
|
|
29
|
+
kwargs = {f: getattr(d, f) for f in MilkyWay._fields() if hasattr(d, f)}
|
|
30
|
+
return MilkyWay(**kwargs)
|
starplot/models/observer.py
CHANGED
|
@@ -6,6 +6,8 @@ from skyfield.timelib import Timescale
|
|
|
6
6
|
|
|
7
7
|
from starplot.data import load
|
|
8
8
|
|
|
9
|
+
ts = load.timescale()
|
|
10
|
+
|
|
9
11
|
|
|
10
12
|
class Observer(BaseModel):
|
|
11
13
|
"""
|
|
@@ -19,8 +21,8 @@ class Observer(BaseModel):
|
|
|
19
21
|
lat=33.363484,
|
|
20
22
|
lon=-116.836394,
|
|
21
23
|
)
|
|
22
|
-
|
|
23
24
|
```
|
|
25
|
+
|
|
24
26
|
"""
|
|
25
27
|
|
|
26
28
|
dt: AwareDatetime = Field(default_factory=lambda: datetime.now(timezone.utc))
|
|
@@ -47,7 +49,7 @@ class Observer(BaseModel):
|
|
|
47
49
|
|
|
48
50
|
Timescale instance of the specified datetime (used by Skyfield)
|
|
49
51
|
"""
|
|
50
|
-
return
|
|
52
|
+
return ts.from_datetime(self.dt)
|
|
51
53
|
|
|
52
54
|
@computed_field
|
|
53
55
|
@cached_property
|
|
@@ -59,6 +61,13 @@ class Observer(BaseModel):
|
|
|
59
61
|
"""
|
|
60
62
|
return float(360.0 * self.timescale.gmst / 24.0 + self.lon) % 360.0
|
|
61
63
|
|
|
64
|
+
@classmethod
|
|
65
|
+
def at_epoch(cls, epoch: float) -> "Observer":
|
|
66
|
+
"""
|
|
67
|
+
Returns an Observer for the specified epoch (Julian year)
|
|
68
|
+
"""
|
|
69
|
+
return Observer(dt=ts.J(epoch).utc_datetime())
|
|
70
|
+
|
|
62
71
|
# @computed_field
|
|
63
72
|
# @cached_property
|
|
64
73
|
# def location(self):
|