starplot 0.12.1__py2.py3-none-any.whl → 0.12.3__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 CHANGED
@@ -1,6 +1,6 @@
1
- """Star charts and maps"""
1
+ """Star charts and maps of the sky"""
2
2
 
3
- __version__ = "0.12.1"
3
+ __version__ = "0.12.3"
4
4
 
5
5
  from .base import BasePlot # noqa: F401
6
6
  from .map import MapPlot, Projection # noqa: F401
starplot/base.py CHANGED
@@ -10,6 +10,7 @@ from matplotlib import patches
10
10
  from matplotlib import pyplot as plt, patheffects
11
11
  from matplotlib.lines import Line2D
12
12
  from pytz import timezone
13
+ from shapely import Polygon
13
14
 
14
15
  from starplot import geod, models
15
16
  from starplot.data import load, ecliptic
@@ -498,13 +499,28 @@ class BasePlot(ABC):
498
499
  self.ax.add_patch(patch)
499
500
 
500
501
  @use_style(PolygonStyle)
501
- def polygon(self, points: list, style: PolygonStyle):
502
- """Plots a polygon of points
502
+ def polygon(
503
+ self,
504
+ style: PolygonStyle,
505
+ points: list = None,
506
+ geometry: Polygon = None,
507
+ ):
508
+ """
509
+ Plots a polygon.
510
+
511
+ Must pass in either `points` **or** `geometry` (but not both).
503
512
 
504
513
  Args:
505
514
  points: List of polygon points `[(ra, dec), ...]` - **must be in counterclockwise order**
515
+ geometry: A shapely Polygon. If this value is passed, then the `points` kwarg will be ignored.
506
516
  style: Style of polygon
507
517
  """
518
+ if points is None and geometry is None:
519
+ raise ValueError("Must pass points or geometry when plotting polygons.")
520
+
521
+ if geometry is not None:
522
+ points = list(zip(*geometry.exterior.coords.xy))
523
+
508
524
  _points = [(ra * 15, dec) for ra, dec in points]
509
525
  self._polygon(_points, style)
510
526
 
Binary file
@@ -58,7 +58,7 @@ def build_constellations():
58
58
  constellation_dict = {
59
59
  "id": cid.lower(),
60
60
  "iau_id": cid.lower(),
61
- "name": props[0],
61
+ "name": props[0].replace("\n", " "),
62
62
  "center_ra": props[1] * 15,
63
63
  "center_dec": props[2],
64
64
  "lines_hip_ids": ",".join(
@@ -103,6 +103,6 @@ gdf.to_file(
103
103
  DATA_LIBRARY / "constellations.gpkg", driver="GPKG", engine="pyogrio", index=True
104
104
  )
105
105
 
106
- print(gdf.loc["uma"])
106
+ print(gdf.loc["cmi"])
107
107
 
108
108
  print("Total Constellations: " + str(len(constellation_records)))
starplot/styles/base.py CHANGED
@@ -1,7 +1,7 @@
1
1
  import json
2
2
  from enum import Enum
3
3
  from pathlib import Path
4
- from typing import Optional
4
+ from typing import Optional, Union
5
5
  from functools import cache
6
6
 
7
7
  import yaml
@@ -332,8 +332,8 @@ class LineStyle(BaseStyle):
332
332
  color: ColorStr = ColorStr("#000")
333
333
  """Color of the line. Can be a hex, rgb, hsl, or word string."""
334
334
 
335
- style: LineStyleEnum = LineStyleEnum.SOLID
336
- """Style of the line (e.g. solid, dashed, etc)."""
335
+ style: Union[LineStyleEnum, tuple] = LineStyleEnum.SOLID
336
+ """Style of the line (e.g. solid, dashed, etc). Can be a predefined value in `LineStyleEnum` or a [Matplotlib linestyle tuple](https://matplotlib.org/stable/gallery/lines_bars_and_markers/linestyles.html)."""
337
337
 
338
338
  dash_capstyle: DashCapStyleEnum = DashCapStyleEnum.PROJECTING
339
339
  """Style of dash endpoints"""
@@ -401,8 +401,8 @@ class PolygonStyle(BaseStyle):
401
401
  fill_color: Optional[ColorStr] = None
402
402
  """Fill color of the polygon"""
403
403
 
404
- line_style: LineStyleEnum = LineStyleEnum.SOLID
405
- """Edge line style"""
404
+ line_style: Union[LineStyleEnum, tuple] = LineStyleEnum.SOLID
405
+ """Edge line style. Can be a predefined value in `LineStyleEnum` or a [Matplotlib linestyle tuple](https://matplotlib.org/stable/gallery/lines_bars_and_markers/linestyles.html)."""
406
406
 
407
407
  alpha: float = 1.0
408
408
  """Alpha value (controls transparency)"""
@@ -419,6 +419,7 @@ class PolygonStyle(BaseStyle):
419
419
  linestyle=self.line_style,
420
420
  alpha=self.alpha,
421
421
  zorder=self.zorder,
422
+ capstyle="round",
422
423
  )
423
424
  if self.color:
424
425
  styles["color"] = self.color.as_hex()
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: starplot
3
- Version: 0.12.1
4
- Summary: Star charts and maps
3
+ Version: 0.12.3
4
+ Summary: Star charts and maps of the sky
5
5
  Keywords: astronomy,stars,charts,maps,constellations
6
6
  Author-email: Steve Berardi <hello@steveberardi.com>
7
7
  Description-Content-Type: text/markdown
@@ -1,5 +1,5 @@
1
- starplot/__init__.py,sha256=c-wKYCxzYPt6T2fdEVZC1XXueQNIc9GNYK5XWJsSKuY,435
2
- starplot/base.py,sha256=sSaDlw8J2krLimJ5JkusnuyYShP_4rZcomhHDRiHKsI,28801
1
+ starplot/__init__.py,sha256=ROvCW0zjX372AftSgSBZcMmqfg7ZNxC3g-ZpGW1klFI,446
2
+ starplot/base.py,sha256=QYjlLeiEZ5M3fq2NQiaQdkTjUVamzsc5_V2Ry-KWP2M,29309
3
3
  starplot/callables.py,sha256=5GZZoOhYc3wAJTzPgXt_tHdjIr-fKdhCbWjm6FT7Er8,2927
4
4
  starplot/geod.py,sha256=QJmF6dOa4dpLoLQ32QsiXaG4gBpTBuagzSFquM9OzsM,2665
5
5
  starplot/map.py,sha256=Xw6jVGGAULl1S6yI7SzGyhfUXE2oeVFJE90ehbyzIRA,31048
@@ -20,7 +20,7 @@ starplot/data/utils.py,sha256=RPk3bnfL-KtjMk1VQygDD27INz_gEya_B1hu7X4K8hU,772
20
20
  starplot/data/library/constellation_borders_inv.gpkg,sha256=UxEqiAtCQ7qMZkUa_cAQXEjh2qgZ6gcivTsX7_O4DkQ,147456
21
21
  starplot/data/library/constellation_lines_hips.json,sha256=7Hjj5quY5nBiNVCY5Y94VwoAibTOexXiY6X1qGWMCsc,18697
22
22
  starplot/data/library/constellation_lines_inv.gpkg,sha256=izwkvwvB_3OgxWgNi6YNbKUSRJKuhk_3u3EUG3FBSqg,131072
23
- starplot/data/library/constellations.gpkg,sha256=3_LyArlxiyDqgguP0Z0NfBPYgnQs2NAzhRTTxD6EwP0,155648
23
+ starplot/data/library/constellations.gpkg,sha256=0Dpom2pirPQJ-Ue6oxKkdrUyGplUwrL6RshYEsmmoDk,155648
24
24
  starplot/data/library/constellations_hip.fab,sha256=m2DxkYCNjlE2bSyaIkwdtE7BB4-nNsqomGX7F3EIoXU,10882
25
25
  starplot/data/library/de421_2001.bsp,sha256=ymkZigAd8Vgscq_DYkdR4nZ1VGD5wwPd-sxe6HiiTns,5341104
26
26
  starplot/data/library/milkyway.gpkg,sha256=m-0P-gIKqn6qlaL1azk31VyZKv0yX4w4C8hRBuMOlaQ,233472
@@ -29,7 +29,7 @@ starplot/data/library/ongc.gpkg.zip,sha256=GMalAemTlQ1Efne7v1ZmRUOPTkbt6iv0svfUy
29
29
  starplot/data/library/stars.bigsky.mag11.parquet,sha256=TOBPeE3JhVMse4EHF4KKXNNObx3-22LF0Ol3cpjL2dU,21391042
30
30
  starplot/data/library/stars.hipparcos.parquet,sha256=wipUr4K0OyYIot7VuwqPCVkQ1iQ4msKeLsk654PdA_E,4606230
31
31
  starplot/data/prep/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
- starplot/data/prep/constellations.py,sha256=C0t2LSvlOQNlKFB8MfWhF-VpzRHAFs92lDI88O4JffY,2929
32
+ starplot/data/prep/constellations.py,sha256=bZDUrtOpWjf6mvdskF7BGdUechfCS1QyXV00wgTg2-g,2948
33
33
  starplot/data/prep/dsos.py,sha256=X9UowAT8WdPvxoNQ04XZLqFREfr5LD_iMDBzCJR77z8,7273
34
34
  starplot/data/prep/utils.py,sha256=cTlJu0uDnn8GvGC_QUlRgJN1f-B8IV8r5qyXdZSxYVE,417
35
35
  starplot/models/__init__.py,sha256=nLs7icsvDYxJMS6onhjicR5pSSeOrO_YDrrktAaqlAQ,321
@@ -46,7 +46,7 @@ starplot/plotters/__init__.py,sha256=MvgqZDMPuR3NaHW9SoiAk47HyMSiFwjrv34RTa_j0rs
46
46
  starplot/plotters/dsos.py,sha256=vyFx2eB1NhSZdkumSPy7VfgoFx79E1TCIUr1q3eiDpU,9066
47
47
  starplot/plotters/stars.py,sha256=VF76I5zv8XpH97y3vbfinKMQQ8BDGqBsQpyPXfK5ho8,8455
48
48
  starplot/styles/__init__.py,sha256=luEPtL8bIpcCCUlvBojmYn7XQtGYapId-8xuA2m783U,124
49
- starplot/styles/base.py,sha256=Y3nz8jEu2zUUUX_KkdDiiiFXhdIioVxTCQVhbSuCkCs,29959
49
+ starplot/styles/base.py,sha256=S77625QNXNuTnvjvY6zI9_gzMc3tv-NUuTOjJDIePsc,30341
50
50
  starplot/styles/extensions.py,sha256=4DsFMOHy3PHpam14o-S7f73jNTR7ARNFE21ZUo8_RGU,615
51
51
  starplot/styles/helpers.py,sha256=AGgHWaHLzJZ6jicvwPzY-p5oSHE0H8gDk1raCmeRFtg,3032
52
52
  starplot/styles/markers.py,sha256=iDuzpBnRhrhElBzv5M4AWxValDxpTFaIcldq46VB4_M,2135
@@ -61,7 +61,7 @@ starplot/styles/ext/grayscale_dark.yml,sha256=6tm79qOdYpNc38bToak9RX-NHabrcE5jFN
61
61
  starplot/styles/ext/map.yml,sha256=HbP7po572UMdDmYFyA34Reac9s8V2nEoO9pi5DT9M1o,120
62
62
  starplot/styles/ext/nord.yml,sha256=AXQ-YGbKGOaQgGO6qdnNKYa1ushn3IYofg04ztE4EHE,2615
63
63
  starplot/styles/ext/optic.yml,sha256=fiTvTl8Ka07o5KqtIqqBGL65ADjnMe6oyxTBbfoHz40,236
64
- starplot-0.12.1.dist-info/LICENSE,sha256=jcjClHF4BQwhz-kDgia-KphO9Zxu0rCa2BbiA7j1jeU,1070
65
- starplot-0.12.1.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
66
- starplot-0.12.1.dist-info/METADATA,sha256=Easp7em0mN1qs1MF2C-Fzcpc0refpohSMu0RTZ2Yk3U,4120
67
- starplot-0.12.1.dist-info/RECORD,,
64
+ starplot-0.12.3.dist-info/LICENSE,sha256=jcjClHF4BQwhz-kDgia-KphO9Zxu0rCa2BbiA7j1jeU,1070
65
+ starplot-0.12.3.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
66
+ starplot-0.12.3.dist-info/METADATA,sha256=db4gi1p9ahhkJmkpLGbBuHvS2gORTop7DY2m9iCBEDQ,4131
67
+ starplot-0.12.3.dist-info/RECORD,,