starplot 0.20.5__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 +59 -0
- starplot/callables.py +176 -0
- starplot/cli.py +29 -0
- starplot/config.py +80 -0
- starplot/coordinates.py +7 -0
- starplot/data/__init__.py +22 -0
- starplot/data/catalogs.py +356 -0
- starplot/data/constellations.py +71 -0
- starplot/data/db.py +33 -0
- starplot/data/dsos.py +85 -0
- starplot/data/ecliptic.py +201 -0
- starplot/data/library/constellation_names.parquet +0 -0
- starplot/data/library/dso_names.parquet +0 -0
- starplot/data/library/readme.md +1 -0
- starplot/data/library/star_designations.parquet +0 -0
- starplot/data/stars.py +79 -0
- starplot/data/translations.py +408 -0
- starplot/data/utils.py +35 -0
- starplot/geometry.py +319 -0
- starplot/mixins.py +360 -0
- starplot/models/__init__.py +21 -0
- starplot/models/base.py +77 -0
- starplot/models/comet.py +302 -0
- starplot/models/constellation.py +151 -0
- starplot/models/dso.py +317 -0
- starplot/models/milky_way.py +30 -0
- starplot/models/moon.py +130 -0
- starplot/models/objects.py +29 -0
- starplot/models/observer.py +125 -0
- starplot/models/optics.py +342 -0
- starplot/models/planet.py +137 -0
- starplot/models/satellite.py +138 -0
- starplot/models/star.py +253 -0
- starplot/models/sun.py +62 -0
- starplot/plots/__init__.py +7 -0
- starplot/plots/base.py +1023 -0
- starplot/plots/galaxy.py +372 -0
- starplot/plots/horizon.py +543 -0
- starplot/plots/map.py +515 -0
- starplot/plots/optic.py +469 -0
- starplot/plots/zenith.py +217 -0
- starplot/plotters/__init__.py +9 -0
- starplot/plotters/arrow.py +174 -0
- starplot/plotters/constellations.py +298 -0
- starplot/plotters/debug.py +21 -0
- starplot/plotters/dsos.py +294 -0
- starplot/plotters/experimental.py +722 -0
- starplot/plotters/gradients.py +153 -0
- starplot/plotters/legend.py +253 -0
- starplot/plotters/milkyway.py +51 -0
- starplot/plotters/stars.py +319 -0
- starplot/plotters/text.py +802 -0
- starplot/profile.py +16 -0
- starplot/projections.py +184 -0
- starplot/styles/__init__.py +6 -0
- starplot/styles/base.py +1344 -0
- starplot/styles/ext/antique.yml +175 -0
- starplot/styles/ext/blue_dark.yml +163 -0
- starplot/styles/ext/blue_gold.yml +147 -0
- starplot/styles/ext/blue_light.yml +123 -0
- starplot/styles/ext/blue_medium.yml +142 -0
- starplot/styles/ext/blue_night.yml +185 -0
- starplot/styles/ext/cb_wong.yml +124 -0
- starplot/styles/ext/color_print.yml +111 -0
- starplot/styles/ext/gradient_presets.yml +158 -0
- starplot/styles/ext/grayscale.yml +94 -0
- starplot/styles/ext/grayscale_dark.yml +136 -0
- starplot/styles/ext/map.yml +12 -0
- starplot/styles/ext/nord.yml +158 -0
- starplot/styles/ext/optic.yml +20 -0
- starplot/styles/ext/publication.yml +8 -0
- starplot/styles/extensions.py +129 -0
- starplot/styles/fonts-library/gfs-didot/DESCRIPTION.en_us.html +9 -0
- starplot/styles/fonts-library/gfs-didot/GFSDidot-Regular.ttf +0 -0
- starplot/styles/fonts-library/gfs-didot/METADATA.pb +16 -0
- starplot/styles/fonts-library/gfs-didot/OFL.txt +94 -0
- starplot/styles/fonts-library/inter/Inter-Bold.ttf +0 -0
- starplot/styles/fonts-library/inter/Inter-BoldItalic.ttf +0 -0
- starplot/styles/fonts-library/inter/Inter-ExtraBold.ttf +0 -0
- starplot/styles/fonts-library/inter/Inter-ExtraLight.ttf +0 -0
- starplot/styles/fonts-library/inter/Inter-ExtraLightItalic.ttf +0 -0
- starplot/styles/fonts-library/inter/Inter-Italic.ttf +0 -0
- starplot/styles/fonts-library/inter/Inter-Light.ttf +0 -0
- starplot/styles/fonts-library/inter/Inter-LightItalic.ttf +0 -0
- starplot/styles/fonts-library/inter/Inter-Regular.ttf +0 -0
- starplot/styles/fonts-library/inter/Inter-SemiBold.ttf +0 -0
- starplot/styles/fonts-library/inter/Inter-SemiBoldItalic.ttf +0 -0
- starplot/styles/fonts-library/inter/LICENSE.txt +92 -0
- starplot/styles/fonts.py +15 -0
- starplot/styles/helpers.py +93 -0
- starplot/styles/markers.py +308 -0
- starplot/utils.py +169 -0
- starplot/warnings.py +21 -0
- starplot-0.20.5.dist-info/METADATA +146 -0
- starplot-0.20.5.dist-info/RECORD +98 -0
- starplot-0.20.5.dist-info/WHEEL +4 -0
- starplot-0.20.5.dist-info/entry_points.txt +3 -0
- starplot-0.20.5.dist-info/licenses/LICENSE +21 -0
starplot/profile.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import time
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def profile(func):
|
|
5
|
+
def wrapper(*args, **kwargs):
|
|
6
|
+
start = time.time()
|
|
7
|
+
|
|
8
|
+
result = func(*args, **kwargs)
|
|
9
|
+
|
|
10
|
+
duration = round(time.time() - start, 4)
|
|
11
|
+
|
|
12
|
+
args[0].logger.debug(f"{func.__name__} = {str(duration)} sec")
|
|
13
|
+
|
|
14
|
+
return result
|
|
15
|
+
|
|
16
|
+
return wrapper
|
starplot/projections.py
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
from abc import ABC
|
|
2
|
+
from functools import cached_property
|
|
3
|
+
|
|
4
|
+
from cartopy import crs as ccrs
|
|
5
|
+
from pydantic import BaseModel, Field
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class CenterRA(BaseModel, ABC):
|
|
9
|
+
center_ra: float = Field(default=180, ge=0, le=360)
|
|
10
|
+
"""Central right ascension"""
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class CenterDEC(BaseModel, ABC):
|
|
14
|
+
center_dec: float = Field(default=0, ge=-90, le=90)
|
|
15
|
+
"""Central declination"""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class CenterRADEC(CenterRA, CenterDEC):
|
|
19
|
+
pass
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Azimuth(BaseModel, ABC):
|
|
23
|
+
azimuth: float = Field(default=0, ge=0, le=360)
|
|
24
|
+
"""Direction of central line of the projection"""
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class ProjectionBase(BaseModel, ABC):
|
|
28
|
+
threshold: int = 1000
|
|
29
|
+
|
|
30
|
+
_ccrs = None
|
|
31
|
+
|
|
32
|
+
class Config:
|
|
33
|
+
arbitrary_types_allowed = True
|
|
34
|
+
|
|
35
|
+
@cached_property
|
|
36
|
+
def crs(self):
|
|
37
|
+
kwargs = {}
|
|
38
|
+
|
|
39
|
+
if hasattr(self, "center_ra"):
|
|
40
|
+
kwargs["central_longitude"] = -1 * self.center_ra
|
|
41
|
+
|
|
42
|
+
if hasattr(self, "center_dec"):
|
|
43
|
+
kwargs["central_latitude"] = self.center_dec
|
|
44
|
+
|
|
45
|
+
if hasattr(self, "azimuth"):
|
|
46
|
+
kwargs["azimuth"] = self.azimuth
|
|
47
|
+
|
|
48
|
+
c = self._ccrs(**kwargs)
|
|
49
|
+
c.threshold = self.threshold
|
|
50
|
+
return c
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class AutoProjection:
|
|
54
|
+
"""
|
|
55
|
+
Automatically selects a projection based on the RA/DEC extent you specify when creating the map plot.
|
|
56
|
+
|
|
57
|
+
This uses a pretty simple method:
|
|
58
|
+
|
|
59
|
+
1. If the extent is the full celestial sphere (RA is 0 to 360 and DEC is -90 to 90), then it'll use Mollweide
|
|
60
|
+
|
|
61
|
+
2. If the max declination is greater than 75 and the min is greater than or equal to 0, then it'll use a Stereographic North projection
|
|
62
|
+
|
|
63
|
+
3. If the max declination is less than or equal to 0 and the min is less than -75, then it'll use a Stereographic South projection
|
|
64
|
+
|
|
65
|
+
4. If the extent doesn't match any of the above, then it'll use a Miller projection
|
|
66
|
+
|
|
67
|
+
In all cases, it sets the central RA to the midpoint of the RA extent.
|
|
68
|
+
|
|
69
|
+
Unlike the other projection options, this class does not expose any public parameters (e.g. center RA/DEC), since everything is determined automatically.
|
|
70
|
+
|
|
71
|
+
To use this automatic projection:
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
|
|
75
|
+
from starplot import MapPlot, AutoProjection
|
|
76
|
+
|
|
77
|
+
p = MapPlot(
|
|
78
|
+
projection=AutoProjection(),
|
|
79
|
+
ra_min=4 * 15,
|
|
80
|
+
ra_max=6 * 15,
|
|
81
|
+
dec_min=0,
|
|
82
|
+
dec_max=20,
|
|
83
|
+
)
|
|
84
|
+
```
|
|
85
|
+
"""
|
|
86
|
+
|
|
87
|
+
def _is_global(
|
|
88
|
+
self, ra_min: float, ra_max: float, dec_min: float, dec_max: float
|
|
89
|
+
) -> bool:
|
|
90
|
+
return ra_min == 0 and ra_max == 360 and dec_min == -90 and dec_max == 90
|
|
91
|
+
|
|
92
|
+
def crs(self, ra_min: float, ra_max: float, dec_min: float, dec_max: float):
|
|
93
|
+
central_longitude = -1 * (ra_min + ra_max) / 2
|
|
94
|
+
|
|
95
|
+
if self._is_global(ra_min, ra_max, dec_min, dec_max):
|
|
96
|
+
c = ccrs.Mollweide(central_longitude=central_longitude)
|
|
97
|
+
|
|
98
|
+
elif dec_max < 75 and dec_min > -75:
|
|
99
|
+
c = ccrs.Miller(central_longitude=central_longitude)
|
|
100
|
+
|
|
101
|
+
elif dec_max > 75 and dec_min >= 0:
|
|
102
|
+
c = ccrs.NorthPolarStereo(central_longitude=central_longitude)
|
|
103
|
+
|
|
104
|
+
elif dec_max <= 0 and dec_min < -75:
|
|
105
|
+
c = ccrs.SouthPolarStereo(central_longitude=central_longitude)
|
|
106
|
+
|
|
107
|
+
else:
|
|
108
|
+
c = ccrs.Miller(central_longitude=central_longitude)
|
|
109
|
+
|
|
110
|
+
c.threshold = 1_000
|
|
111
|
+
|
|
112
|
+
return c
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class Miller(ProjectionBase, CenterRA):
|
|
116
|
+
"""Similar to Mercator: good for declinations between -70 and 70, but distorts objects near the poles"""
|
|
117
|
+
|
|
118
|
+
_ccrs = ccrs.Miller
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
class Mercator(ProjectionBase, CenterRA):
|
|
122
|
+
"""Good for declinations between -70 and 70, but distorts objects near the poles"""
|
|
123
|
+
|
|
124
|
+
_ccrs = ccrs.Mercator
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
class PlateCarree(ProjectionBase, CenterRA):
|
|
128
|
+
"""An equirectangular projection"""
|
|
129
|
+
|
|
130
|
+
_ccrs = ccrs.PlateCarree
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
class ObliqueMercator(ProjectionBase, CenterRADEC, Azimuth):
|
|
134
|
+
"""Oblique Mercator projection"""
|
|
135
|
+
|
|
136
|
+
_ccrs = ccrs.ObliqueMercator
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
class Mollweide(ProjectionBase, CenterRA):
|
|
140
|
+
"""Good for showing the entire celestial sphere in one plot"""
|
|
141
|
+
|
|
142
|
+
_ccrs = ccrs.Mollweide
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
class Equidistant(ProjectionBase, CenterRADEC):
|
|
146
|
+
"""Shows accurate distances from the center position. Often used for planispheres."""
|
|
147
|
+
|
|
148
|
+
_ccrs = ccrs.AzimuthalEquidistant
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
class StereoNorth(ProjectionBase, CenterRA):
|
|
152
|
+
"""Good for objects near the north celestial pole, but distorts objects near the mid declinations"""
|
|
153
|
+
|
|
154
|
+
_ccrs = ccrs.NorthPolarStereo
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
class StereoSouth(ProjectionBase, CenterRA):
|
|
158
|
+
"""Good for objects near the south celestial pole, but distorts objects near the mid declinations"""
|
|
159
|
+
|
|
160
|
+
_ccrs = ccrs.SouthPolarStereo
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
class Robinson(ProjectionBase, CenterRA):
|
|
164
|
+
"""Good for showing the entire celestial sphere in one plot"""
|
|
165
|
+
|
|
166
|
+
_ccrs = ccrs.Robinson
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
class LambertAzEqArea(ProjectionBase, CenterRADEC):
|
|
170
|
+
"""Lambert Azimuthal Equal-Area projection - accurately shows area, but distorts angles."""
|
|
171
|
+
|
|
172
|
+
_ccrs = ccrs.LambertAzimuthalEqualArea
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
class Orthographic(ProjectionBase, CenterRADEC):
|
|
176
|
+
"""Shows the celestial sphere as a 3D-looking globe. Objects near the edges will be distorted."""
|
|
177
|
+
|
|
178
|
+
_ccrs = ccrs.Orthographic
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
class Stereographic(ProjectionBase, CenterRADEC):
|
|
182
|
+
"""Similar to the North/South Stereographic projection, but allows custom central declination"""
|
|
183
|
+
|
|
184
|
+
_ccrs = ccrs.Stereographic
|