starplot 0.16.1__py2.py3-none-any.whl → 0.17.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.
Files changed (40) hide show
  1. starplot/__init__.py +28 -2
  2. starplot/base.py +42 -60
  3. starplot/config.py +41 -9
  4. starplot/data/bigsky.py +1 -1
  5. starplot/data/constellations.py +9 -681
  6. starplot/data/db.py +2 -2
  7. starplot/data/dsos.py +11 -28
  8. starplot/data/library/bigsky.0.4.0.stars.mag11.parquet +0 -0
  9. starplot/data/library/sky.db +0 -0
  10. starplot/data/stars.py +15 -433
  11. starplot/data/translations.py +161 -0
  12. starplot/geometry.py +52 -6
  13. starplot/horizon.py +18 -12
  14. starplot/map.py +1 -5
  15. starplot/mixins.py +283 -0
  16. starplot/models/__init__.py +19 -7
  17. starplot/models/base.py +1 -1
  18. starplot/models/comet.py +332 -0
  19. starplot/models/constellation.py +10 -0
  20. starplot/models/dso.py +24 -0
  21. starplot/{optics.py → models/optics.py} +4 -4
  22. starplot/models/satellite.py +158 -0
  23. starplot/models/star.py +10 -0
  24. starplot/optic.py +24 -13
  25. starplot/plotters/__init__.py +1 -0
  26. starplot/plotters/arrow.py +162 -0
  27. starplot/plotters/constellations.py +34 -56
  28. starplot/plotters/dsos.py +8 -14
  29. starplot/plotters/experimental.py +560 -8
  30. starplot/plotters/legend.py +5 -0
  31. starplot/plotters/stars.py +7 -16
  32. starplot/styles/base.py +20 -1
  33. starplot/styles/extensions.py +10 -1
  34. starplot/zenith.py +4 -1
  35. {starplot-0.16.1.dist-info → starplot-0.17.0.dist-info}/METADATA +20 -17
  36. {starplot-0.16.1.dist-info → starplot-0.17.0.dist-info}/RECORD +40 -36
  37. /starplot/{observer.py → models/observer.py} +0 -0
  38. {starplot-0.16.1.dist-info → starplot-0.17.0.dist-info}/WHEEL +0 -0
  39. {starplot-0.16.1.dist-info → starplot-0.17.0.dist-info}/entry_points.txt +0 -0
  40. {starplot-0.16.1.dist-info → starplot-0.17.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,5 +1,3 @@
1
- import geopandas as gpd
2
-
3
1
  from shapely import MultiPolygon
4
2
  from shapely import (
5
3
  MultiPoint,
@@ -9,17 +7,571 @@ from shapely import (
9
7
  )
10
8
 
11
9
  from starplot.data import DataFiles
12
- from starplot.data.constellations import (
13
- CONSTELLATIONS_FULL_NAMES,
14
- CONSTELLATION_HIP_IDS,
15
- )
16
10
  from starplot.styles import PathStyle
17
11
 
18
12
 
13
+ CONSTELLATION_HIP_IDS = {
14
+ "and": {
15
+ 2912,
16
+ 1473,
17
+ 7607,
18
+ 677,
19
+ 116805,
20
+ 5447,
21
+ 9640,
22
+ 3881,
23
+ 116584,
24
+ 3693,
25
+ 4463,
26
+ 3031,
27
+ 3092,
28
+ 4436,
29
+ 116631,
30
+ 5434,
31
+ 113726,
32
+ },
33
+ "ant": {46515, 51172, 53502},
34
+ "aps": {81065, 72370, 81852, 80047},
35
+ "aql": {
36
+ 97804,
37
+ 95501,
38
+ 93805,
39
+ 97649,
40
+ 99473,
41
+ 93747,
42
+ 98036,
43
+ 96468,
44
+ 93429,
45
+ 93244,
46
+ 97278,
47
+ },
48
+ "aqr": {
49
+ 112961,
50
+ 114724,
51
+ 114341,
52
+ 106278,
53
+ 111497,
54
+ 112716,
55
+ 115438,
56
+ 110960,
57
+ 110672,
58
+ 109074,
59
+ 109139,
60
+ 110003,
61
+ 113136,
62
+ 115033,
63
+ 102618,
64
+ 110395,
65
+ },
66
+ "ara": {85792, 83081, 88714, 85258, 83153, 85267, 82363, 85727},
67
+ "ari": {8832, 13209, 9884, 8903},
68
+ "aur": {24608, 28358, 23015, 28360, 25428, 23767, 23416, 28380, 23453},
69
+ "boo": {
70
+ 70497,
71
+ 71075,
72
+ 69732,
73
+ 69673,
74
+ 74666,
75
+ 72105,
76
+ 69483,
77
+ 71053,
78
+ 67275,
79
+ 73555,
80
+ 71795,
81
+ 67927,
82
+ },
83
+ "cae": {21770, 23595, 21060, 21861},
84
+ "cam": {23040, 23522, 16228, 17959, 29997, 17884, 33694, 22783},
85
+ "cap": {100064, 102978, 106723, 107556, 106985, 105881, 104139, 102485, 100345},
86
+ "car": {
87
+ 54463,
88
+ 42913,
89
+ 52419,
90
+ 50371,
91
+ 53253,
92
+ 30438,
93
+ 38827,
94
+ 41037,
95
+ 39953,
96
+ 50099,
97
+ 45556,
98
+ 45238,
99
+ 51576,
100
+ 54301,
101
+ 54751,
102
+ },
103
+ "cas": {746, 3179, 4427, 8886, 6686},
104
+ "cen": {
105
+ 55425,
106
+ 71683,
107
+ 67464,
108
+ 65936,
109
+ 68245,
110
+ 60823,
111
+ 68002,
112
+ 56243,
113
+ 71352,
114
+ 59449,
115
+ 68282,
116
+ 59196,
117
+ 68933,
118
+ 70090,
119
+ 65109,
120
+ 61789,
121
+ 68702,
122
+ 66657,
123
+ 61932,
124
+ 73334,
125
+ 68862,
126
+ },
127
+ "cep": {
128
+ 109857,
129
+ 101093,
130
+ 105199,
131
+ 106032,
132
+ 110991,
133
+ 112724,
134
+ 109492,
135
+ 102422,
136
+ 116727,
137
+ 107259,
138
+ },
139
+ "cet": {
140
+ 13954,
141
+ 12706,
142
+ 12387,
143
+ 8645,
144
+ 8102,
145
+ 6537,
146
+ 10826,
147
+ 5364,
148
+ 14135,
149
+ 1562,
150
+ 3419,
151
+ 11484,
152
+ 12828,
153
+ },
154
+ "cha": {60000, 58484, 52633, 40702, 51839},
155
+ "cir": {74824, 75323, 71908},
156
+ "cma": {33152, 35904, 33347, 31592, 33160, 33579, 34444, 30324, 34045, 32349},
157
+ "cmi": {36188, 37279},
158
+ "cnc": {44066, 40526, 42806, 42911, 43103},
159
+ "col": {25859, 30277, 28199, 28328, 26634, 27628},
160
+ "com": {64241, 64394, 60742},
161
+ "cra": {93825, 94114, 90982, 94160, 94005},
162
+ "crb": {77512, 76267, 75695, 78159, 76952, 78493, 76127},
163
+ "crt": {57283, 55687, 56633, 53740, 58188, 55282, 55705, 54682},
164
+ "cru": {62434, 59747, 61084, 60718},
165
+ "crv": {60965, 61359, 59316, 59803, 59199},
166
+ "cvn": {63125, 61317},
167
+ "cyg": {100453, 99848, 95947, 97165, 95853, 102098, 103413, 102488, 94779, 104732},
168
+ "del": {102532, 101958, 101769, 102281, 101421},
169
+ "dor": {21281, 23693, 27890, 26069, 19893, 27100},
170
+ "dra": {
171
+ 61281,
172
+ 75458,
173
+ 87585,
174
+ 97433,
175
+ 85829,
176
+ 85670,
177
+ 94376,
178
+ 80331,
179
+ 89937,
180
+ 56211,
181
+ 68756,
182
+ 89908,
183
+ 83895,
184
+ 87833,
185
+ 78527,
186
+ },
187
+ "equ": {104521, 104858, 104987},
188
+ "eri": {
189
+ 21248,
190
+ 19587,
191
+ 13701,
192
+ 11407,
193
+ 21393,
194
+ 15510,
195
+ 13847,
196
+ 16537,
197
+ 7588,
198
+ 18216,
199
+ 12843,
200
+ 9007,
201
+ 20535,
202
+ 17593,
203
+ 14146,
204
+ 23875,
205
+ 21444,
206
+ 12486,
207
+ 20042,
208
+ 17874,
209
+ 22109,
210
+ 17378,
211
+ 12770,
212
+ 16611,
213
+ 16870,
214
+ 18543,
215
+ 18673,
216
+ 15474,
217
+ 17651,
218
+ 12413,
219
+ },
220
+ "for": {13147, 9677, 14879},
221
+ "gem": {
222
+ 31681,
223
+ 36962,
224
+ 37826,
225
+ 30883,
226
+ 34693,
227
+ 30343,
228
+ 34088,
229
+ 32362,
230
+ 37740,
231
+ 36046,
232
+ 29655,
233
+ 36850,
234
+ 35350,
235
+ 32246,
236
+ 28734,
237
+ 33018,
238
+ 35550,
239
+ },
240
+ "gru": {113638, 112623, 109268, 108085, 110997, 109111, 112122},
241
+ "her": {
242
+ 87808,
243
+ 83207,
244
+ 86414,
245
+ 84379,
246
+ 84380,
247
+ 81693,
248
+ 81833,
249
+ 80170,
250
+ 87933,
251
+ 80816,
252
+ 85112,
253
+ 85693,
254
+ 86974,
255
+ 77760,
256
+ 80463,
257
+ 88794,
258
+ 81126,
259
+ 81008,
260
+ 79992,
261
+ 84345,
262
+ 79101,
263
+ },
264
+ "hor": {14240, 12225, 19747, 12484, 12653, 13884},
265
+ "hya": {
266
+ 56343,
267
+ 45336,
268
+ 54682,
269
+ 68895,
270
+ 42402,
271
+ 43813,
272
+ 42799,
273
+ 49841,
274
+ 46390,
275
+ 64962,
276
+ 47431,
277
+ 42313,
278
+ 52943,
279
+ 57936,
280
+ 43234,
281
+ 48356,
282
+ 43109,
283
+ 53740,
284
+ 49402,
285
+ 72571,
286
+ 51069,
287
+ },
288
+ "hyi": {11001, 9236, 2021, 17678},
289
+ "ind": {105319, 101772, 108431, 103227, 102333},
290
+ "lac": {111104, 111169, 111944, 110538, 111022, 110351, 110609, 109937, 109754},
291
+ "leo": {
292
+ 57632,
293
+ 46146,
294
+ 47908,
295
+ 49669,
296
+ 48455,
297
+ 55434,
298
+ 54879,
299
+ 49583,
300
+ 50583,
301
+ 54872,
302
+ 55642,
303
+ 46750,
304
+ 50335,
305
+ },
306
+ "lep": {
307
+ 27072,
308
+ 25985,
309
+ 23685,
310
+ 25606,
311
+ 27654,
312
+ 28103,
313
+ 24327,
314
+ 24845,
315
+ 28910,
316
+ 24305,
317
+ 27288,
318
+ },
319
+ "lib": {74785, 76333, 72622, 73714, 76470, 76600},
320
+ "lmi": {51233, 46952, 53229, 51056, 49593},
321
+ "lup": {75264, 77634, 75141, 76297, 75177, 78384, 71860, 73273, 74395},
322
+ "lyn": {45860, 33449, 30060, 36145, 41075, 45688, 44700, 44248},
323
+ "lyr": {91971, 92420, 93194, 91919, 92791, 91262},
324
+ "men": {23467, 29271},
325
+ "mic": {103738, 105140, 105382, 102831},
326
+ "mon": {32578, 37447, 31978, 31216, 34769, 30419, 30867, 29651, 39863},
327
+ "mus": {61199, 61585, 62322, 57363, 59929, 63613},
328
+ "nor": {80000, 78914, 80582, 78639},
329
+ "oct": {107089, 112405, 70638},
330
+ "oph": {
331
+ 81377,
332
+ 87108,
333
+ 79593,
334
+ 79882,
335
+ 84970,
336
+ 84012,
337
+ 85423,
338
+ 86032,
339
+ 88048,
340
+ 80473,
341
+ 80883,
342
+ 80628,
343
+ 86742,
344
+ 80343,
345
+ 83000,
346
+ 80569,
347
+ 80894,
348
+ },
349
+ "ori": {
350
+ 27913,
351
+ 22797,
352
+ 22549,
353
+ 28716,
354
+ 22957,
355
+ 22449,
356
+ 23607,
357
+ 22845,
358
+ 25281,
359
+ 28614,
360
+ 26311,
361
+ 25930,
362
+ 23123,
363
+ 27989,
364
+ 26207,
365
+ 27366,
366
+ 26727,
367
+ 22509,
368
+ 29038,
369
+ 29426,
370
+ 24436,
371
+ 25336,
372
+ },
373
+ "pav": {
374
+ 92609,
375
+ 105858,
376
+ 88866,
377
+ 99240,
378
+ 100751,
379
+ 91792,
380
+ 86929,
381
+ 90098,
382
+ 93015,
383
+ 102395,
384
+ 98495,
385
+ },
386
+ "peg": {
387
+ 109410,
388
+ 677,
389
+ 113963,
390
+ 112748,
391
+ 109176,
392
+ 1067,
393
+ 107315,
394
+ 109427,
395
+ 112440,
396
+ 113881,
397
+ 107354,
398
+ 112029,
399
+ 112158,
400
+ },
401
+ "per": {
402
+ 8068,
403
+ 19343,
404
+ 14354,
405
+ 17448,
406
+ 14632,
407
+ 18614,
408
+ 18246,
409
+ 14668,
410
+ 17358,
411
+ 13268,
412
+ 13531,
413
+ 19167,
414
+ 18532,
415
+ 19812,
416
+ 20070,
417
+ 12777,
418
+ 14576,
419
+ 15863,
420
+ 14328,
421
+ },
422
+ "phe": {2081, 5348, 7083, 5165, 6867, 765},
423
+ "pic": {27321, 27530, 32607},
424
+ "psa": {109285, 111954, 112948, 111188, 107380, 113368, 107608, 113246},
425
+ "psc": {
426
+ 116928,
427
+ 116771,
428
+ 8198,
429
+ 4906,
430
+ 3786,
431
+ 7884,
432
+ 5742,
433
+ 9487,
434
+ 6193,
435
+ 5586,
436
+ 115830,
437
+ 7097,
438
+ 115738,
439
+ 114971,
440
+ 118268,
441
+ },
442
+ "pup": {
443
+ 35264,
444
+ 39429,
445
+ 31685,
446
+ 30438,
447
+ 39757,
448
+ 37229,
449
+ 37677,
450
+ 39953,
451
+ 36917,
452
+ 38070,
453
+ 38170,
454
+ },
455
+ "pyx": {43409, 42515, 42828, 39429},
456
+ "ret": {17440, 19921, 19780, 18597},
457
+ "scl": {4577, 117452, 115102, 116231},
458
+ "sco": {
459
+ 85696,
460
+ 78401,
461
+ 87073,
462
+ 78820,
463
+ 85927,
464
+ 82729,
465
+ 86670,
466
+ 84143,
467
+ 80112,
468
+ 79374,
469
+ 81266,
470
+ 82514,
471
+ 86228,
472
+ 78104,
473
+ 78265,
474
+ 80763,
475
+ 82396,
476
+ 87261,
477
+ },
478
+ "sct": {90595, 91117, 91726, 92175},
479
+ "ser1": {
480
+ 77450,
481
+ 77516,
482
+ 77070,
483
+ 77233,
484
+ 76852,
485
+ 76276,
486
+ 77622,
487
+ 78072,
488
+ },
489
+ "ser2": {86263, 89962, 88048, 92946},
490
+ "sex": {51437, 49641, 51362, 48437},
491
+ "sge": {98337, 96837, 96757, 97365},
492
+ "sgr": {
493
+ 90496,
494
+ 95168,
495
+ 93506,
496
+ 93864,
497
+ 90185,
498
+ 92041,
499
+ 89931,
500
+ 89642,
501
+ 93085,
502
+ 93683,
503
+ 92855,
504
+ 89341,
505
+ 88635,
506
+ 94141,
507
+ },
508
+ "tau": {
509
+ 18724,
510
+ 20455,
511
+ 20205,
512
+ 21421,
513
+ 26451,
514
+ 16083,
515
+ 25428,
516
+ 16852,
517
+ 20889,
518
+ 18907,
519
+ 15900,
520
+ 20894,
521
+ },
522
+ "tel": {89112, 90422, 90568},
523
+ "tra": {77952, 82273, 74946, 76440},
524
+ "tri": {10064, 8796, 10670},
525
+ "tuc": {110130, 118322, 2484, 114996, 110838, 1599},
526
+ "uma": {
527
+ 46853,
528
+ 54539,
529
+ 46733,
530
+ 58001,
531
+ 53910,
532
+ 55203,
533
+ 54061,
534
+ 55219,
535
+ 44471,
536
+ 57399,
537
+ 48319,
538
+ 50372,
539
+ 44127,
540
+ 65378,
541
+ 67301,
542
+ 41704,
543
+ 62956,
544
+ 50801,
545
+ 59774,
546
+ },
547
+ "umi": {82080, 79822, 11767, 72607, 75097, 85822, 77055},
548
+ "vel": {42913, 48774, 50191, 44816, 39953, 45941, 52727, 46651},
549
+ "vir": {
550
+ 60129,
551
+ 65474,
552
+ 58948,
553
+ 57380,
554
+ 69701,
555
+ 68520,
556
+ 66249,
557
+ 64238,
558
+ 63090,
559
+ 61941,
560
+ 71957,
561
+ 63608,
562
+ 72220,
563
+ 57757,
564
+ },
565
+ "vol": {41312, 34481, 39794, 35228, 44382},
566
+ "vul": {95771, 97886},
567
+ }
568
+
569
+
19
570
  class ExperimentalPlotterMixin:
20
571
  def _constellation_borders(self):
21
572
  from shapely import LineString, MultiLineString
22
573
  from shapely.ops import unary_union
574
+ import geopandas as gpd
23
575
 
24
576
  constellation_borders = gpd.read_file(
25
577
  DataFiles.CONSTELLATIONS,
@@ -95,7 +647,7 @@ class ExperimentalPlotterMixin:
95
647
  def _plot_constellation_labels_experimental(
96
648
  self,
97
649
  style: PathStyle = None,
98
- labels: dict[str, str] = CONSTELLATIONS_FULL_NAMES,
650
+ label_fn=None,
99
651
  ):
100
652
  def sorter(g):
101
653
  # higher score is better
@@ -156,7 +708,7 @@ class ExperimentalPlotterMixin:
156
708
  else:
157
709
  ra, dec = constellation.ra, constellation.dec
158
710
 
159
- text = labels.get(constellation.iau_id)
711
+ text = label_fn(constellation)
160
712
  style = style or self.style.constellation.label
161
713
  style.anchor_point = "center"
162
714
  self.text(
@@ -5,6 +5,7 @@ from matplotlib.legend import Legend
5
5
  from matplotlib.lines import Line2D
6
6
 
7
7
  from starplot import callables
8
+ from starplot.data.translations import translate
8
9
  from starplot.models.star import Star
9
10
  from starplot.styles import (
10
11
  MarkerStyle,
@@ -105,6 +106,8 @@ class LegendPlotterMixin:
105
106
 
106
107
  target = self.ax
107
108
 
109
+ title = translate(title, self.language)
110
+
108
111
  if style.location.startswith("outside"):
109
112
  target = self.fig
110
113
 
@@ -191,6 +194,8 @@ class LegendPlotterMixin:
191
194
  if style.location.startswith("outside"):
192
195
  target = self.fig
193
196
 
197
+ title = translate(title, self.language)
198
+
194
199
  def scale(
195
200
  size_fn,
196
201
  style: MarkerStyle,
@@ -1,4 +1,4 @@
1
- from typing import Callable, Mapping
1
+ from typing import Callable
2
2
 
3
3
  import rtree
4
4
  import numpy as np
@@ -8,6 +8,7 @@ from skyfield.api import Star as SkyfieldStar, wgs84
8
8
  from starplot import callables
9
9
  from starplot.data import stars
10
10
  from starplot.data.stars import StarCatalog
11
+ from starplot.data.translations import translate
11
12
  from starplot.models.star import Star, from_tuple
12
13
  from starplot.styles import ObjectStyle, use_style
13
14
  from starplot.profile import profile
@@ -60,7 +61,6 @@ class StarPlotterMixin:
60
61
  star_sizes: list[float],
61
62
  label_row_ids: list,
62
63
  style: ObjectStyle,
63
- labels: Mapping[str, str],
64
64
  bayer_labels: bool,
65
65
  flamsteed_labels: bool,
66
66
  label_fn: Callable[[Star], str],
@@ -85,13 +85,7 @@ class StarPlotterMixin:
85
85
  elif s.tyc:
86
86
  self._labeled_stars.append(s.tyc)
87
87
 
88
- if label_fn is not None:
89
- label = label_fn(s)
90
- elif s.hip in labels:
91
- label = labels.get(s.hip)
92
- else:
93
- label = s.name
94
-
88
+ label = label_fn(s)
95
89
  bayer_desig = s.bayer
96
90
  flamsteed_num = s.flamsteed
97
91
 
@@ -162,8 +156,7 @@ class StarPlotterMixin:
162
156
  size_fn: Callable[[Star], float] = callables.size_by_magnitude,
163
157
  alpha_fn: Callable[[Star], float] = None,
164
158
  color_fn: Callable[[Star], str] = None,
165
- label_fn: Callable[[Star], str] = None,
166
- labels: Mapping[int, str] = None,
159
+ label_fn: Callable[[Star], str] = Star.get_label,
167
160
  legend_label: str = "Star",
168
161
  bayer_labels: bool = False,
169
162
  flamsteed_labels: bool = False,
@@ -189,8 +182,7 @@ class StarPlotterMixin:
189
182
  size_fn: Callable for calculating the marker size of each star. If `None`, then the marker style's size will be used.
190
183
  alpha_fn: Callable for calculating the alpha value (aka "opacity") of each star. If `None`, then the marker style's alpha will be used.
191
184
  color_fn: Callable for calculating the color of each star. If `None`, then the marker style's color will be used.
192
- label_fn: Callable for determining the label of each star. If `None`, then the names in the `labels` kwarg will be used.
193
- labels: A dictionary that maps a star's HIP id to the label that'll be plotted for that star. If `None`, then the star's IAU-designated name will be used.
185
+ label_fn: Callable for determining the label of each star.
194
186
  legend_label: Label for stars in the legend. If `None`, then they will not be in the legend.
195
187
  bayer_labels: If True, then Bayer labels for stars will be plotted.
196
188
  flamsteed_labels: If True, then Flamsteed number labels for stars will be plotted.
@@ -209,7 +201,6 @@ class StarPlotterMixin:
209
201
  where = where or []
210
202
  where_labels = where_labels or []
211
203
  stars_to_index = []
212
- labels = labels or {}
213
204
 
214
205
  star_results = self._load_stars(catalog, filters=where, sql=sql)
215
206
 
@@ -325,7 +316,8 @@ class StarPlotterMixin:
325
316
  else "none",
326
317
  )
327
318
 
328
- self._add_legend_handle_marker(legend_label, style.marker)
319
+ _legend_label = translate(legend_label, self.language) or legend_label
320
+ self._add_legend_handle_marker(_legend_label, style.marker)
329
321
 
330
322
  if stars_to_index:
331
323
  self._stars_rtree = rtree.index.Index(stars_to_index)
@@ -335,7 +327,6 @@ class StarPlotterMixin:
335
327
  sizes,
336
328
  label_row_ids,
337
329
  style,
338
- labels,
339
330
  bayer_labels,
340
331
  flamsteed_labels,
341
332
  label_fn,