starplot 0.13.0__py2.py3-none-any.whl → 0.15.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 +5 -2
- starplot/base.py +311 -197
- starplot/cli.py +33 -0
- starplot/coordinates.py +6 -0
- starplot/data/__init__.py +6 -24
- starplot/data/bigsky.py +58 -40
- starplot/data/constellation_lines.py +827 -0
- starplot/data/constellation_stars.py +1501 -0
- starplot/data/constellations.py +600 -27
- starplot/data/db.py +17 -0
- starplot/data/dsos.py +24 -141
- starplot/data/stars.py +45 -24
- starplot/geod.py +0 -6
- starplot/geometry.py +181 -0
- starplot/horizon.py +302 -231
- starplot/map.py +100 -463
- starplot/mixins.py +75 -14
- starplot/models/__init__.py +1 -1
- starplot/models/base.py +18 -129
- starplot/models/constellation.py +55 -32
- starplot/models/dso.py +132 -67
- starplot/models/moon.py +57 -78
- starplot/models/planet.py +44 -69
- starplot/models/star.py +91 -60
- starplot/models/sun.py +32 -53
- starplot/optic.py +21 -18
- starplot/plotters/__init__.py +2 -0
- starplot/plotters/constellations.py +342 -0
- starplot/plotters/dsos.py +49 -68
- starplot/plotters/experimental.py +171 -0
- starplot/plotters/milkyway.py +39 -0
- starplot/plotters/stars.py +126 -122
- starplot/profile.py +16 -0
- starplot/settings.py +26 -0
- starplot/styles/__init__.py +2 -0
- starplot/styles/base.py +56 -34
- starplot/styles/ext/antique.yml +11 -9
- starplot/styles/ext/blue_dark.yml +8 -10
- starplot/styles/ext/blue_gold.yml +135 -0
- starplot/styles/ext/blue_light.yml +14 -12
- starplot/styles/ext/blue_medium.yml +23 -20
- starplot/styles/ext/cb_wong.yml +9 -7
- starplot/styles/ext/grayscale.yml +4 -3
- starplot/styles/ext/grayscale_dark.yml +7 -5
- starplot/styles/ext/map.yml +9 -6
- starplot/styles/ext/nord.yml +7 -7
- starplot/styles/ext/optic.yml +1 -1
- starplot/styles/extensions.py +1 -0
- starplot/utils.py +19 -0
- starplot/warnings.py +21 -0
- {starplot-0.13.0.dist-info → starplot-0.15.0.dist-info}/METADATA +19 -18
- starplot-0.15.0.dist-info/RECORD +97 -0
- starplot-0.15.0.dist-info/entry_points.txt +3 -0
- starplot/data/bayer.py +0 -3499
- starplot/data/flamsteed.py +0 -2682
- starplot/data/library/constellation_borders_inv.gpkg +0 -0
- starplot/data/library/constellation_lines_hips.json +0 -709
- starplot/data/library/constellation_lines_inv.gpkg +0 -0
- starplot/data/library/constellations.gpkg +0 -0
- starplot/data/library/constellations_hip.fab +0 -88
- starplot/data/library/milkyway.gpkg +0 -0
- starplot/data/library/milkyway_inv.gpkg +0 -0
- starplot/data/library/ongc.gpkg.zip +0 -0
- starplot/data/library/stars.bigsky.mag11.parquet +0 -0
- starplot/data/library/stars.hipparcos.parquet +0 -0
- starplot/data/messier.py +0 -111
- starplot/data/prep/__init__.py +0 -0
- starplot/data/prep/constellations.py +0 -108
- starplot/data/prep/dsos.py +0 -299
- starplot/data/prep/utils.py +0 -16
- starplot/models/geometry.py +0 -44
- starplot-0.13.0.dist-info/RECORD +0 -101
- {starplot-0.13.0.dist-info → starplot-0.15.0.dist-info}/LICENSE +0 -0
- {starplot-0.13.0.dist-info → starplot-0.15.0.dist-info}/WHEEL +0 -0
starplot/cli.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
from starplot.styles import fonts
|
|
4
|
+
|
|
5
|
+
COMMANDS = ["setup"]
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def setup(options):
|
|
9
|
+
from starplot import settings
|
|
10
|
+
from starplot.data import db, bigsky
|
|
11
|
+
|
|
12
|
+
print("Installing DuckDB spatial extension...")
|
|
13
|
+
|
|
14
|
+
con = db.connect()
|
|
15
|
+
con.load_extension("spatial")
|
|
16
|
+
|
|
17
|
+
fonts.load()
|
|
18
|
+
|
|
19
|
+
print(f"Installed to: {settings.DUCKDB_EXTENSION_PATH}")
|
|
20
|
+
|
|
21
|
+
if "--install-big-sky" in options:
|
|
22
|
+
bigsky.download_if_not_exists()
|
|
23
|
+
print(f"Big Sky Catalog downloaded and installed to: {settings.DOWNLOAD_PATH}")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def main():
|
|
27
|
+
command = sys.argv[1].lower()
|
|
28
|
+
|
|
29
|
+
if command not in COMMANDS:
|
|
30
|
+
print(f"Unrecognized command: {command}")
|
|
31
|
+
|
|
32
|
+
if command == "setup":
|
|
33
|
+
setup(sys.argv[2:])
|
starplot/coordinates.py
ADDED
starplot/data/__init__.py
CHANGED
|
@@ -1,31 +1,13 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
|
-
from enum import Enum
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
|
|
6
1
|
from skyfield.api import Loader
|
|
7
2
|
|
|
8
|
-
|
|
9
|
-
DATA_PATH = HERE / "library"
|
|
10
|
-
|
|
11
|
-
load = Loader(DATA_PATH)
|
|
3
|
+
from starplot import settings
|
|
12
4
|
|
|
5
|
+
load = Loader(settings.DATA_PATH)
|
|
13
6
|
|
|
14
|
-
def env(name, default):
|
|
15
|
-
return os.environ.get(name) or default
|
|
16
7
|
|
|
8
|
+
class DataFiles:
|
|
9
|
+
BIG_SKY = settings.DOWNLOAD_PATH / "bigsky.0.4.0.stars.parquet"
|
|
17
10
|
|
|
18
|
-
|
|
19
|
-
# Built-In Files
|
|
20
|
-
CONSTELLATION_LINES = DATA_PATH / "constellation_lines_inv.gpkg"
|
|
21
|
-
CONSTELLATION_LINES_HIP = DATA_PATH / "constellation_lines_hips.json"
|
|
22
|
-
CONSTELLATION_BORDERS = DATA_PATH / "constellation_borders_inv.gpkg"
|
|
23
|
-
MILKY_WAY = DATA_PATH / "milkyway.gpkg"
|
|
24
|
-
HIPPARCOS = DATA_PATH / "stars.hipparcos.parquet"
|
|
25
|
-
BIG_SKY_MAG11 = DATA_PATH / "stars.bigsky.mag11.parquet"
|
|
26
|
-
ONGC = DATA_PATH / "ongc.gpkg.zip"
|
|
27
|
-
CONSTELLATIONS = DATA_PATH / "constellations.gpkg"
|
|
11
|
+
BIG_SKY_MAG11 = settings.DATA_PATH / "bigsky.0.4.0.stars.mag11.parquet"
|
|
28
12
|
|
|
29
|
-
|
|
30
|
-
_DOWNLOAD_PATH = Path(env("STARPLOT_DOWNLOAD_PATH", str(DATA_PATH)))
|
|
31
|
-
BIG_SKY = _DOWNLOAD_PATH / "stars.bigsky.parquet"
|
|
13
|
+
DATABASE = settings.DATA_PATH / "sky.db"
|
starplot/data/bigsky.py
CHANGED
|
@@ -1,56 +1,58 @@
|
|
|
1
1
|
import os
|
|
2
|
+
from pathlib import Path
|
|
2
3
|
|
|
3
4
|
import pandas as pd
|
|
4
5
|
|
|
5
|
-
from starplot
|
|
6
|
+
from starplot import settings
|
|
7
|
+
from starplot.data import DataFiles, utils
|
|
6
8
|
|
|
7
9
|
|
|
8
|
-
BIG_SKY_VERSION = "0.
|
|
10
|
+
BIG_SKY_VERSION = "0.4.0"
|
|
11
|
+
BIG_SKY_FILENAME = f"bigsky.{BIG_SKY_VERSION}.stars.csv.gz"
|
|
12
|
+
BIG_SKY_PQ_FILENAME = f"bigsky.{BIG_SKY_VERSION}.stars.parquet"
|
|
9
13
|
|
|
10
|
-
|
|
14
|
+
BIG_SKY_MAG11_FILENAME = f"bigsky.{BIG_SKY_VERSION}.stars.mag11.csv.gz"
|
|
15
|
+
BIG_SKY_MAG11_PQ_FILENAME = f"bigsky.{BIG_SKY_VERSION}.stars.mag11.parquet"
|
|
11
16
|
|
|
12
|
-
BIG_SKY_URL = f"https://github.com/steveberardi/bigsky/releases/download/v{BIG_SKY_VERSION}/{BIG_SKY_FILENAME}"
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
DIGITS = 4
|
|
17
|
-
|
|
18
|
-
BIG_SKY_ASSETS = {
|
|
19
|
-
DataFiles.BIG_SKY: "bigsky.stars.csv.gz",
|
|
20
|
-
DataFiles.BIG_SKY_MAG11: "bigsky.stars.mag11.csv.gz",
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def url(filename: str, version: str):
|
|
18
|
+
def get_url(version: str = BIG_SKY_VERSION, filename: str = BIG_SKY_FILENAME):
|
|
25
19
|
return f"https://github.com/steveberardi/bigsky/releases/download/v{version}/{filename}"
|
|
26
20
|
|
|
27
21
|
|
|
28
22
|
def download(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
url: str = None,
|
|
24
|
+
download_path: str = settings.DOWNLOAD_PATH,
|
|
25
|
+
download_filename: str = BIG_SKY_FILENAME,
|
|
26
|
+
build_file: str = DataFiles.BIG_SKY,
|
|
33
27
|
):
|
|
34
|
-
|
|
28
|
+
url = url or get_url()
|
|
29
|
+
download_path = Path(download_path)
|
|
30
|
+
|
|
31
|
+
if not os.path.exists(download_path):
|
|
32
|
+
os.makedirs(download_path)
|
|
33
|
+
|
|
34
|
+
full_download_path = download_path / download_filename
|
|
35
35
|
utils.download(
|
|
36
|
-
url
|
|
37
|
-
|
|
36
|
+
url,
|
|
37
|
+
full_download_path,
|
|
38
38
|
"Big Sky Star Catalog",
|
|
39
39
|
)
|
|
40
40
|
to_parquet(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
digits,
|
|
41
|
+
full_download_path,
|
|
42
|
+
build_file,
|
|
44
43
|
)
|
|
45
44
|
|
|
46
45
|
|
|
47
|
-
def to_parquet(source_path: str, destination_path: str
|
|
46
|
+
def to_parquet(source_path: str, destination_path: str):
|
|
47
|
+
import pyarrow as pa
|
|
48
|
+
import pyarrow.parquet as pq
|
|
49
|
+
|
|
48
50
|
print("Preparing Big Sky Catalog for Starplot...")
|
|
49
51
|
|
|
50
52
|
df = pd.read_csv(
|
|
51
53
|
source_path,
|
|
52
54
|
header=0,
|
|
53
|
-
|
|
55
|
+
usecols=[
|
|
54
56
|
"tyc_id",
|
|
55
57
|
"hip_id",
|
|
56
58
|
"ccdm",
|
|
@@ -61,14 +63,11 @@ def to_parquet(source_path: str, destination_path: str, digits: int = DIGITS):
|
|
|
61
63
|
"ra_mas_per_year",
|
|
62
64
|
"dec_mas_per_year",
|
|
63
65
|
"parallax_mas",
|
|
66
|
+
"constellation",
|
|
64
67
|
],
|
|
65
68
|
compression="gzip",
|
|
66
69
|
)
|
|
67
70
|
|
|
68
|
-
df["ra_hours"] = df.apply(
|
|
69
|
-
lambda row: round(row.ra_degrees_j2000 / 15, digits), axis=1
|
|
70
|
-
)
|
|
71
|
-
|
|
72
71
|
df = df.assign(epoch_year=2000)
|
|
73
72
|
|
|
74
73
|
df = df.rename(
|
|
@@ -79,19 +78,38 @@ def to_parquet(source_path: str, destination_path: str, digits: int = DIGITS):
|
|
|
79
78
|
}
|
|
80
79
|
)
|
|
81
80
|
|
|
82
|
-
df.
|
|
83
|
-
|
|
84
|
-
print(f"Done! {destination_path.value}")
|
|
81
|
+
df = df.sort_values(["magnitude"])
|
|
85
82
|
|
|
83
|
+
table = pa.Table.from_pandas(df)
|
|
84
|
+
table = table.drop_columns("__index_level_0__")
|
|
86
85
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
pq.write_table(
|
|
87
|
+
table,
|
|
88
|
+
destination_path,
|
|
89
|
+
compression="none",
|
|
90
|
+
sorting_columns=[
|
|
91
|
+
pq.SortingColumn(df.columns.get_loc("magnitude")),
|
|
92
|
+
],
|
|
93
|
+
)
|
|
92
94
|
|
|
93
|
-
|
|
95
|
+
print(f"Done! {destination_path}")
|
|
94
96
|
|
|
95
97
|
|
|
96
98
|
def exists(path) -> bool:
|
|
97
99
|
return os.path.isfile(path)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def download_if_not_exists(
|
|
103
|
+
filename: str = DataFiles.BIG_SKY,
|
|
104
|
+
url: str = None,
|
|
105
|
+
download_path: str = settings.DOWNLOAD_PATH,
|
|
106
|
+
download_filename: str = BIG_SKY_FILENAME,
|
|
107
|
+
build_file: str = DataFiles.BIG_SKY,
|
|
108
|
+
):
|
|
109
|
+
if not exists(filename):
|
|
110
|
+
download(
|
|
111
|
+
url=url,
|
|
112
|
+
download_path=download_path,
|
|
113
|
+
download_filename=download_filename,
|
|
114
|
+
build_file=build_file,
|
|
115
|
+
)
|