Skip to content

Commit fcc8742

Browse files
authored
v0.15.6 (#143)
* degrees * allow constellation line collision * format * get constellation stars separately * plot hii * fix polygon clipping * changelog
1 parent 51c7a5f commit fcc8742

File tree

6 files changed

+70
-49
lines changed

6 files changed

+70
-49
lines changed

docs/changelog.md

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
- [**v0.15.5**]
1717
- Fixes compatibility with Ibis 10.x
1818
- Fixes bug with getting star names and designations
19+
- [**v0.15.6**]
20+
- Removes dependency on plotting stars before constellation labels
21+
- Fixes static constellation label plotting
22+
- Fixes polygon clipping on optic plots
23+
- Adds HII Regions to the `nebula()` function
1924

2025
## v0.14.x
2126
[Documentation](https://archives.starplot.dev/0.14.0/)

hash_checks/hashlock.yml

+36-36
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
horizon_base:
2-
dhash: 2f83990dc60b44702e83890d461b44700383cd0d861b4460
2+
dhash: 0687590d4409c4700683490d4419c4d006a34d0d441b4460
33
filename: /starplot/hash_checks/data/horizon-base.png
4-
phash: e3b81ced14b63386
4+
phash: e3ba1ce506e23387
55
horizon_north_celestial_pole:
6-
dhash: 30aa6ad0c2728c54212a6850c272a45431aa48c8c262ac54
6+
dhash: 30aa48d0e232a45430aa48d08232a44431aa49c8e232ac54
77
filename: /starplot/hash_checks/data/horizon-north-celestial-pole.png
8-
phash: d59a38c94ad20be7
8+
phash: d59a3ad94ad24bc2
99
map_coma_berenices_dso_size:
1010
dhash: aa84acecc888c0c0a2848ceca888c6c08a8a92a2a882c282
1111
filename: /starplot/hash_checks/data/map-coma-berenices-dso-size.png
@@ -31,94 +31,94 @@ map_mollweide:
3131
filename: /starplot/hash_checks/data/map-mollweide.png
3232
phash: ebcbb69ce3249460
3333
map_moon_phase_waxing_crescent:
34-
dhash: 0814284d4d2814080814284d4d6814080804084d4d480408
34+
dhash: 0814284d4d6814080814284d4d6814080804084d4d480408
3535
filename: /starplot/hash_checks/data/map-moon-phase-waxing-crescent.png
3636
phash: b3cccc3333cccc31
3737
map_orion_base:
38-
dhash: 18393b5e3e2f656819393b5e2e2d65681c392bce2e2f6468
38+
dhash: 18193b5e3a2f646919393bde2a2d646958192bce2a2f6469
3939
filename: /starplot/hash_checks/data/map-orion-base.png
40-
phash: bf795a649504b594
40+
phash: bf795a241784359c
4141
map_orion_extra:
42-
dhash: 193b1b7f3b656d17193b1b7f2b656d0f1c3b0b4e2b256c0f
42+
dhash: 191b3b7f3b65690f1b191b7f2b25690d1c1b0b4e2b25690d
4343
filename: /starplot/hash_checks/data/map-orion-extra.png
44-
phash: be71e01ee117e491
44+
phash: be71e01ee117a499
4545
map_plot_custom_clip_path_virgo:
4646
dhash: 060521339d1c04040625252f0d1c0404062525270d1c0404
4747
filename: /starplot/hash_checks/data/map-custom-clip-path-virgo.png
4848
phash: e66e8591b10d4bda
4949
map_plot_limit_by_geometry:
50-
dhash: 12288086440c1204a2aa8286040c124432a880c6450c1242
50+
dhash: 12e8c086440c124422cac286040c124432e8c086450c5242
5151
filename: /starplot/hash_checks/data/map-limit-by-geometry.png
52-
phash: a40999be6679539a
52+
phash: a4509bbe2ee9328e
5353
map_scope_bino_fov:
5454
dhash: 86c092848ca28400868633454d21920c868633454d21920c
5555
filename: /starplot/hash_checks/data/map-scope-bino-fov.png
5656
phash: e465997166649979
5757
map_stereo_base:
58-
dhash: 77766470353b5412777664f435185416777664f0b598d412
58+
dhash: 7372647231385412737264f431185416737664f2b498d412
5959
filename: /starplot/hash_checks/data/map-stereo-north-base.png
60-
phash: 9dce6961c291f23a
60+
phash: 9dce6979e81162b2
6161
map_with_planets:
6262
dhash: 639344668ddb323b629304668ddb323b2a9304668ddb323b
6363
filename: /starplot/hash_checks/data/map-mercator-planets.png
6464
phash: e8c29d89a67f5312
6565
map_wrapping:
66-
dhash: 0f332ccd655231150f332ccd655231150f332ccd65523115
66+
dhash: 0f352ccd655231150f352ccd655231150f352ccd65523115
6767
filename: /starplot/hash_checks/data/map-wrapping.png
68-
phash: ba36d8c583c2b716
68+
phash: ba36d8c583c2b536
6969
optic_camera_rotated:
7070
dhash: 25468b13261c1a6525468b13261c1a6525468b13261c1a65
7171
filename: /starplot/hash_checks/data/optic-camera-rotated-m45.png
72-
phash: bc6cc6941ed97285
72+
phash: ac6cc6941edb7285
7373
optic_clipping:
74-
dhash: 70d898f062e4fc5d70d898f0eae4f85971f098f2e6e4fc71
74+
dhash: 7099b874e2f4fc4d70d9b8f4eaf4fc5971e898f2d2f4fc71
7575
filename: /starplot/hash_checks/data/optic-clipping.png
76-
phash: 95696a872f9a7870
76+
phash: 95696a87279c7871
7777
optic_m45_binoculars:
7878
dhash: 8e17237133330e4d8e17237133330e4d8e17237133330e4d
7979
filename: /starplot/hash_checks/data/optic-m45-binoculars.png
80-
phash: aa7b84f186d18ac7
80+
phash: ae7b80f182d18ed3
8181
optic_m45_camera:
82-
dhash: 4d715151716559754d715151716559754d71515171655975
82+
dhash: 4d717151716549754d717151716549754d71715171654975
8383
filename: /starplot/hash_checks/data/optic-m45-camera.png
84-
phash: ba7b846e843b84d5
84+
phash: ae7b846e907b84c5
8585
optic_m45_reflector:
86-
dhash: 8e172b7123330e4d8e172b7123330e4d8e172b7123330e4d
86+
dhash: 8e173b712b330e4d8e173b712b330e4d8e173b712b330e4d
8787
filename: /starplot/hash_checks/data/optic-m45-reflector.png
88-
phash: ba7b80e5c6b19a92
88+
phash: ba7b84e086e59a93
8989
optic_m45_scope:
90-
dhash: 8e173b5123230e4d8e173b5123230e4d8e173b5123230e4d
90+
dhash: 8e172b5133230e4d8e172b5133230e4d8e172b5133230e4d
9191
filename: /starplot/hash_checks/data/optic-m45-scope.png
92-
phash: aa7b84e586b18e93
92+
phash: ae7b84e492b1ce83
9393
optic_moon_phase_full:
9494
dhash: 0e2b553333552b0e0e2b553333552b0e0e2b553333552b0e
9595
filename: /starplot/hash_checks/data/optic-moon-phase-full.png
96-
phash: fb6ba06295718725
96+
phash: fb6fa02395658721
9797
optic_moon_phase_new:
9898
dhash: 13498e96968e491313498e96968e491313498e96968e4913
9999
filename: /starplot/hash_checks/data/optic-moon-phase-new.png
100-
phash: e1649e9669496766
100+
phash: e5259ec6694c6761
101101
optic_moon_phase_waxing_crescent:
102102
dhash: 0e33454d59712b0e0e33454d59712b0e0e33454d59712b0e
103103
filename: /starplot/hash_checks/data/optic-moon-phase-waxing-crescent.png
104104
phash: bb26e4999166c699
105105
optic_orion_nebula_refractor:
106-
dhash: 8e1f2d7163230e4d8e1f2d7163230e4d8e1f2d7163230e4d
106+
dhash: 8e17257163238e4d8e17257163238e4d8e17257163238e4d
107107
filename: /starplot/hash_checks/data/optic-orion-nebula-refractor.png
108-
phash: ae3ab065c7919e92
108+
phash: ae3ab061c3939e96
109109
optic_polaris_binoculars:
110110
dhash: 8e172b5523338e4d8e172b5523338e4d8e172b5523338e4d
111111
filename: /starplot/hash_checks/data/optic-binoculars-polaris.png
112-
phash: aa7b84f182d18ed3
112+
phash: aa7b84e186d18ed3
113113
optic_solar_eclipse_binoculars:
114-
dhash: 0779649a9ae461071759e49a9ae461170359c09c9cc06903
114+
dhash: 0769f0cccccc710f0769f0cccccc710f0369c0cccccc610b
115115
filename: /starplot/hash_checks/data/optic-binoculars-eclipse.png
116-
phash: b1ccce3131cece31
116+
phash: b38ccc3333cccc33
117117
optic_wrapping:
118-
dhash: 71f0ec92d2d8650a71e0d4aca4c4782a71e8d4aca4c4713a
118+
dhash: 71f0ecd2dad8650a71e0d4aca4c4782a71e8d4aca4c4793a
119119
filename: /starplot/hash_checks/data/optic-wrapping.png
120-
phash: d1846e1b792ef138
120+
phash: d1846e1a792ef139
121121
zenith_base:
122-
dhash: 1771d4b8865d338e1771d4b6865d338e1771d49e865d3b0e
122+
dhash: 1771cc8ad67d338e1771cc86d47d338e1771c486947d3b0e
123123
filename: /starplot/hash_checks/data/zenith-base.png
124-
phash: ba40eb3be1788764
124+
phash: be40fb3ee5289660

src/starplot/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Star charts and maps of the sky"""
22

3-
__version__ = "0.15.5"
3+
__version__ = "0.15.6"
44

55
from .base import BasePlot # noqa: F401
66
from .map import MapPlot, Projection # noqa: F401

src/starplot/base.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,9 @@ def _text_point(
360360

361361
x, y = self._prepare_coords(ra, dec)
362362
kwargs["path_effects"] = kwargs.get("path_effects", [self.text_border])
363+
remove_on_constellation_collision = kwargs.pop(
364+
"remove_on_constellation_collision", True
365+
)
363366

364367
original_va = kwargs.pop("va", None)
365368
original_ha = kwargs.pop("ha", None)
@@ -386,7 +389,10 @@ def _text_point(
386389
x, y, text, **kwargs, va=va, ha=ha, xytext=(offset_x, offset_y)
387390
)
388391
removed = self._maybe_remove_label(
389-
label, remove_on_collision=hide_on_collision, remove_on_clipped=clip_on
392+
label,
393+
remove_on_collision=hide_on_collision,
394+
remove_on_clipped=clip_on,
395+
remove_on_constellation_collision=remove_on_constellation_collision,
390396
)
391397

392398
if force or not removed:
@@ -868,10 +874,13 @@ def _polygon(self, points: list, style: PolygonStyle, **kwargs):
868874
# closed=False, # needs to be false for circles at poles?
869875
**style.matplot_kwargs(self.scale),
870876
**kwargs,
871-
clip_on=True,
872-
clip_path=self._background_clip_path,
877+
# clip_on=True,
878+
# clip_path=self._background_clip_path,
873879
)
874880
self.ax.add_patch(patch)
881+
# Need to set clip path AFTER adding patch
882+
patch.set_clip_on(True)
883+
patch.set_clip_path(self._background_clip_path)
875884

876885
@use_style(PolygonStyle)
877886
def polygon(

src/starplot/plotters/constellations.py

+12-9
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
from starplot.data.stars import load as load_stars, StarCatalog
1313
from starplot.data.constellations import (
1414
CONSTELLATIONS_FULL_NAMES,
15-
CONSTELLATION_HIP_IDS,
1615
)
1716
from starplot.data.constellation_stars import CONSTELLATION_HIPS
17+
from starplot.models import Star
1818
from starplot.models.constellation import from_tuple as constellation_from_tuple
1919
from starplot.projections import Projection
2020
from starplot.profile import profile
@@ -262,11 +262,17 @@ def constellation_borders(self, style: LineStyle = None):
262262
self.ax.add_collection(line_collection)
263263

264264
def _constellation_labels_auto(self, style, labels, settings):
265+
hips = []
266+
for c in self.objects.constellations:
267+
hips.extend(c.star_hip_ids)
268+
269+
all_constellation_stars = Star.find(where=[_.hip.isin(hips)])
270+
265271
for constellation in self.objects.constellations:
266272
constellation_line_stars = [
267273
s
268-
for s in self.objects.stars
269-
if s.hip in CONSTELLATION_HIP_IDS[constellation.iau_id]
274+
for s in all_constellation_stars
275+
if s.hip in constellation.star_hip_ids
270276
]
271277
if not constellation_line_stars:
272278
continue
@@ -302,10 +308,11 @@ def _constellation_labels_static(self, style, labels):
302308
text = labels.get(con.lower())
303309
self.text(
304310
text,
305-
ra,
311+
ra * 15,
306312
dec,
307313
style,
308314
hide_on_collision=self.hide_colliding_labels,
315+
remove_on_constellation_collision=False,
309316
gid="constellations-label-name",
310317
)
311318

@@ -319,7 +326,7 @@ def constellation_labels(
319326
auto_adjust_settings: dict = DEFAULT_AUTO_ADJUST_SETTINGS,
320327
):
321328
"""
322-
Plots constellation labels.
329+
Plots constellation labels for all constellations that have been plotted. This means you must plot the constellations before plotting their labels.
323330
324331
It's good to plot these last because they're area-based labels (vs point-based, like for star names), and area-based labels have more freedom to move around. If you plot area-based labels first, then it would limit the available space for point-based labels.
325332
@@ -328,10 +335,6 @@ def constellation_labels(
328335
labels: A dictionary where the keys are each constellation's 3-letter IAU abbreviation, and the values are how the constellation will be labeled on the plot.
329336
auto_adjust: If True (the default), then labels will be automatically adjusted to avoid collisions with other labels and stars **Important: you must plot stars and constellations first for this to work**. This uses a fairly simple method: for each constellation it finds the centroid of all plotted constellation stars with lines and then generates random points in the constellation boundary starting at the centroid and then progressively increasing the distance from the centroid.
330337
auto_adjust_settings: Optional settings for the auto adjustment algorithm.
331-
332-
TODO:
333-
make this work without plotting constellations first
334-
335338
"""
336339

337340
if auto_adjust:

src/starplot/plotters/dsos.py

+4
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ def nebula(self, **kwargs):
8585
- Emission Nebula
8686
- Star Cluster Nebula
8787
- Reflection Nebula
88+
- HII Ionized Regions
89+
90+
* Note that this does NOT plot dark nebulae
8891
8992
This is just a small wrapper around the `dsos()` function, so any `kwargs` will be passed through.
9093
"""
@@ -94,6 +97,7 @@ def nebula(self, **kwargs):
9497
DsoType.EMISSION_NEBULA,
9598
DsoType.STAR_CLUSTER_NEBULA,
9699
DsoType.REFLECTION_NEBULA,
100+
DsoType.HII_IONIZED_REGION,
97101
]
98102
where = kwargs.pop("where", [])
99103
where.append(_.type.isin(nebula_types))

0 commit comments

Comments
 (0)