starplot 0.13.0__py2.py3-none-any.whl → 0.14.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.

Potentially problematic release.


This version of starplot might be problematic. Click here for more details.

@@ -104,6 +104,7 @@ properties = {
104
104
  "Vol": ("Volans", 8.01, -67.92),
105
105
  "Vul": ("Vulpecula", 20.13, 22.21),
106
106
  }
107
+ CONSTELLATIONS = {k.lower(): v for k, v in properties.items()}
107
108
 
108
109
  CONSTELLATIONS_FULL_NAMES = {k.lower(): v[0].upper() for k, v in properties.items()}
109
110
  """Constellation full names"""
@@ -111,6 +112,567 @@ CONSTELLATIONS_FULL_NAMES = {k.lower(): v[0].upper() for k, v in properties.item
111
112
  CONSTELLATIONS_ABBREVIATIONS = {k.lower(): k.upper() for k in properties.keys()}
112
113
  """Constellation 3-letter abbreviations"""
113
114
 
115
+ CONSTELLATION_HIP_IDS = {
116
+ "and": {
117
+ 2912,
118
+ 1473,
119
+ 7607,
120
+ 677,
121
+ 116805,
122
+ 5447,
123
+ 9640,
124
+ 3881,
125
+ 116584,
126
+ 3693,
127
+ 4463,
128
+ 3031,
129
+ 3092,
130
+ 4436,
131
+ 116631,
132
+ 5434,
133
+ 113726,
134
+ },
135
+ "ant": {46515, 51172, 53502},
136
+ "aps": {81065, 72370, 81852, 80047},
137
+ "aql": {
138
+ 97804,
139
+ 95501,
140
+ 93805,
141
+ 97649,
142
+ 99473,
143
+ 93747,
144
+ 98036,
145
+ 96468,
146
+ 93429,
147
+ 93244,
148
+ 97278,
149
+ },
150
+ "aqr": {
151
+ 112961,
152
+ 114724,
153
+ 114341,
154
+ 106278,
155
+ 111497,
156
+ 112716,
157
+ 115438,
158
+ 110960,
159
+ 110672,
160
+ 109074,
161
+ 109139,
162
+ 110003,
163
+ 113136,
164
+ 115033,
165
+ 102618,
166
+ 110395,
167
+ },
168
+ "ara": {85792, 83081, 88714, 85258, 83153, 85267, 82363, 85727},
169
+ "ari": {8832, 13209, 9884, 8903},
170
+ "aur": {24608, 28358, 23015, 28360, 25428, 23767, 23416, 28380, 23453},
171
+ "boo": {
172
+ 70497,
173
+ 71075,
174
+ 69732,
175
+ 69673,
176
+ 74666,
177
+ 72105,
178
+ 69483,
179
+ 71053,
180
+ 67275,
181
+ 73555,
182
+ 71795,
183
+ 67927,
184
+ },
185
+ "cae": {21770, 23595, 21060, 21861},
186
+ "cam": {23040, 23522, 16228, 17959, 29997, 17884, 33694, 22783},
187
+ "cap": {100064, 102978, 106723, 107556, 106985, 105881, 104139, 102485, 100345},
188
+ "car": {
189
+ 54463,
190
+ 42913,
191
+ 52419,
192
+ 50371,
193
+ 53253,
194
+ 30438,
195
+ 38827,
196
+ 41037,
197
+ 39953,
198
+ 50099,
199
+ 45556,
200
+ 45238,
201
+ 51576,
202
+ 54301,
203
+ 54751,
204
+ },
205
+ "cas": {746, 3179, 4427, 8886, 6686},
206
+ "cen": {
207
+ 55425,
208
+ 71683,
209
+ 67464,
210
+ 65936,
211
+ 68245,
212
+ 60823,
213
+ 68002,
214
+ 56243,
215
+ 71352,
216
+ 59449,
217
+ 68282,
218
+ 59196,
219
+ 68933,
220
+ 70090,
221
+ 65109,
222
+ 61789,
223
+ 68702,
224
+ 66657,
225
+ 61932,
226
+ 73334,
227
+ 68862,
228
+ },
229
+ "cep": {
230
+ 109857,
231
+ 101093,
232
+ 105199,
233
+ 106032,
234
+ 110991,
235
+ 112724,
236
+ 109492,
237
+ 102422,
238
+ 116727,
239
+ 107259,
240
+ },
241
+ "cet": {
242
+ 13954,
243
+ 12706,
244
+ 12387,
245
+ 8645,
246
+ 8102,
247
+ 6537,
248
+ 10826,
249
+ 5364,
250
+ 14135,
251
+ 1562,
252
+ 3419,
253
+ 11484,
254
+ 12828,
255
+ },
256
+ "cha": {60000, 58484, 52633, 40702, 51839},
257
+ "cir": {74824, 75323, 71908},
258
+ "cma": {33152, 35904, 33347, 31592, 33160, 33579, 34444, 30324, 34045, 32349},
259
+ "cmi": {36188, 37279},
260
+ "cnc": {44066, 40526, 42806, 42911, 43103},
261
+ "col": {25859, 30277, 28199, 28328, 26634, 27628},
262
+ "com": {64241, 64394, 60742},
263
+ "cra": {93825, 94114, 90982, 94160, 94005},
264
+ "crb": {77512, 76267, 75695, 78159, 76952, 78493, 76127},
265
+ "crt": {57283, 55687, 56633, 53740, 58188, 55282, 55705, 54682},
266
+ "cru": {62434, 59747, 61084, 60718},
267
+ "crv": {60965, 61359, 59316, 59803, 59199},
268
+ "cvn": {63125, 61317},
269
+ "cyg": {100453, 99848, 95947, 97165, 95853, 102098, 103413, 102488, 94779, 104732},
270
+ "del": {102532, 101958, 101769, 102281, 101421},
271
+ "dor": {21281, 23693, 27890, 26069, 19893, 27100},
272
+ "dra": {
273
+ 61281,
274
+ 75458,
275
+ 87585,
276
+ 97433,
277
+ 85829,
278
+ 85670,
279
+ 94376,
280
+ 80331,
281
+ 89937,
282
+ 56211,
283
+ 68756,
284
+ 89908,
285
+ 83895,
286
+ 87833,
287
+ 78527,
288
+ },
289
+ "equ": {104521, 104858, 104987},
290
+ "eri": {
291
+ 21248,
292
+ 19587,
293
+ 13701,
294
+ 11407,
295
+ 21393,
296
+ 15510,
297
+ 13847,
298
+ 16537,
299
+ 7588,
300
+ 18216,
301
+ 12843,
302
+ 9007,
303
+ 20535,
304
+ 17593,
305
+ 14146,
306
+ 23875,
307
+ 21444,
308
+ 12486,
309
+ 20042,
310
+ 17874,
311
+ 22109,
312
+ 17378,
313
+ 12770,
314
+ 16611,
315
+ 16870,
316
+ 18543,
317
+ 18673,
318
+ 15474,
319
+ 17651,
320
+ 12413,
321
+ },
322
+ "for": {13147, 9677, 14879},
323
+ "gem": {
324
+ 31681,
325
+ 36962,
326
+ 37826,
327
+ 30883,
328
+ 34693,
329
+ 30343,
330
+ 34088,
331
+ 32362,
332
+ 37740,
333
+ 36046,
334
+ 29655,
335
+ 36850,
336
+ 35350,
337
+ 32246,
338
+ 28734,
339
+ 33018,
340
+ 35550,
341
+ },
342
+ "gru": {113638, 112623, 109268, 108085, 110997, 109111, 112122},
343
+ "her": {
344
+ 87808,
345
+ 83207,
346
+ 86414,
347
+ 84379,
348
+ 84380,
349
+ 81693,
350
+ 81833,
351
+ 80170,
352
+ 87933,
353
+ 80816,
354
+ 85112,
355
+ 85693,
356
+ 86974,
357
+ 77760,
358
+ 80463,
359
+ 88794,
360
+ 81126,
361
+ 81008,
362
+ 79992,
363
+ 84345,
364
+ 79101,
365
+ },
366
+ "hor": {14240, 12225, 19747, 12484, 12653, 13884},
367
+ "hya": {
368
+ 56343,
369
+ 45336,
370
+ 54682,
371
+ 68895,
372
+ 42402,
373
+ 43813,
374
+ 42799,
375
+ 49841,
376
+ 46390,
377
+ 64962,
378
+ 47431,
379
+ 42313,
380
+ 52943,
381
+ 57936,
382
+ 43234,
383
+ 48356,
384
+ 43109,
385
+ 53740,
386
+ 49402,
387
+ 72571,
388
+ 51069,
389
+ },
390
+ "hyi": {11001, 9236, 2021, 17678},
391
+ "ind": {105319, 101772, 108431, 103227, 102333},
392
+ "lac": {111104, 111169, 111944, 110538, 111022, 110351, 110609, 109937, 109754},
393
+ "leo": {
394
+ 57632,
395
+ 46146,
396
+ 47908,
397
+ 49669,
398
+ 48455,
399
+ 55434,
400
+ 54879,
401
+ 49583,
402
+ 50583,
403
+ 54872,
404
+ 55642,
405
+ 46750,
406
+ 50335,
407
+ },
408
+ "lep": {
409
+ 27072,
410
+ 25985,
411
+ 23685,
412
+ 25606,
413
+ 27654,
414
+ 28103,
415
+ 24327,
416
+ 24845,
417
+ 28910,
418
+ 24305,
419
+ 27288,
420
+ },
421
+ "lib": {74785, 76333, 72622, 73714, 76470, 76600},
422
+ "lmi": {51233, 46952, 53229, 51056, 49593},
423
+ "lup": {75264, 77634, 75141, 76297, 75177, 78384, 71860, 73273, 74395},
424
+ "lyn": {45860, 33449, 30060, 36145, 41075, 45688, 44700, 44248},
425
+ "lyr": {91971, 92420, 93194, 91919, 92791, 91262},
426
+ "men": {23467, 29271},
427
+ "mic": {103738, 105140, 105382, 102831},
428
+ "mon": {32578, 37447, 31978, 31216, 34769, 30419, 30867, 29651, 39863},
429
+ "mus": {61199, 61585, 62322, 57363, 59929, 63613},
430
+ "nor": {80000, 78914, 80582, 78639},
431
+ "oct": {107089, 112405, 70638},
432
+ "oph": {
433
+ 81377,
434
+ 87108,
435
+ 79593,
436
+ 79882,
437
+ 84970,
438
+ 84012,
439
+ 85423,
440
+ 86032,
441
+ 88048,
442
+ 80473,
443
+ 80883,
444
+ 80628,
445
+ 86742,
446
+ 80343,
447
+ 83000,
448
+ 80569,
449
+ 80894,
450
+ },
451
+ "ori": {
452
+ 27913,
453
+ 22797,
454
+ 22549,
455
+ 28716,
456
+ 22957,
457
+ 22449,
458
+ 23607,
459
+ 22845,
460
+ 25281,
461
+ 28614,
462
+ 26311,
463
+ 25930,
464
+ 23123,
465
+ 27989,
466
+ 26207,
467
+ 27366,
468
+ 26727,
469
+ 22509,
470
+ 29038,
471
+ 29426,
472
+ 24436,
473
+ 25336,
474
+ },
475
+ "pav": {
476
+ 92609,
477
+ 105858,
478
+ 88866,
479
+ 99240,
480
+ 100751,
481
+ 91792,
482
+ 86929,
483
+ 90098,
484
+ 93015,
485
+ 102395,
486
+ 98495,
487
+ },
488
+ "peg": {
489
+ 109410,
490
+ 677,
491
+ 113963,
492
+ 112748,
493
+ 109176,
494
+ 1067,
495
+ 107315,
496
+ 109427,
497
+ 112440,
498
+ 113881,
499
+ 107354,
500
+ 112029,
501
+ 112158,
502
+ },
503
+ "per": {
504
+ 8068,
505
+ 19343,
506
+ 14354,
507
+ 17448,
508
+ 14632,
509
+ 18614,
510
+ 18246,
511
+ 14668,
512
+ 17358,
513
+ 13268,
514
+ 13531,
515
+ 19167,
516
+ 18532,
517
+ 19812,
518
+ 20070,
519
+ 12777,
520
+ 14576,
521
+ 15863,
522
+ 14328,
523
+ },
524
+ "phe": {2081, 5348, 7083, 5165, 6867, 765},
525
+ "pic": {27321, 27530, 32607},
526
+ "psa": {109285, 111954, 112948, 111188, 107380, 113368, 107608, 113246},
527
+ "psc": {
528
+ 116928,
529
+ 116771,
530
+ 8198,
531
+ 4906,
532
+ 3786,
533
+ 7884,
534
+ 5742,
535
+ 9487,
536
+ 6193,
537
+ 5586,
538
+ 115830,
539
+ 7097,
540
+ 115738,
541
+ 114971,
542
+ 118268,
543
+ },
544
+ "pup": {
545
+ 35264,
546
+ 39429,
547
+ 31685,
548
+ 30438,
549
+ 39757,
550
+ 37229,
551
+ 37677,
552
+ 39953,
553
+ 36917,
554
+ 38070,
555
+ 38170,
556
+ },
557
+ "pyx": {43409, 42515, 42828, 39429},
558
+ "ret": {17440, 19921, 19780, 18597},
559
+ "scl": {4577, 117452, 115102, 116231},
560
+ "sco": {
561
+ 85696,
562
+ 78401,
563
+ 87073,
564
+ 78820,
565
+ 85927,
566
+ 82729,
567
+ 86670,
568
+ 84143,
569
+ 80112,
570
+ 79374,
571
+ 81266,
572
+ 82514,
573
+ 86228,
574
+ 78104,
575
+ 78265,
576
+ 80763,
577
+ 82396,
578
+ 87261,
579
+ },
580
+ "sct": {90595, 91117, 91726, 92175},
581
+ "ser": {
582
+ 79593,
583
+ 77450,
584
+ 89962,
585
+ 77516,
586
+ 84012,
587
+ 77070,
588
+ 88048,
589
+ 77233,
590
+ 92946,
591
+ 76852,
592
+ 76276,
593
+ 77622,
594
+ 86263,
595
+ 78072,
596
+ },
597
+ "sex": {51437, 49641, 51362, 48437},
598
+ "sge": {98337, 96837, 96757, 97365},
599
+ "sgr": {
600
+ 90496,
601
+ 95168,
602
+ 93506,
603
+ 93864,
604
+ 90185,
605
+ 92041,
606
+ 89931,
607
+ 89642,
608
+ 93085,
609
+ 93683,
610
+ 92855,
611
+ 89341,
612
+ 88635,
613
+ 94141,
614
+ },
615
+ "tau": {
616
+ 18724,
617
+ 20455,
618
+ 20205,
619
+ 21421,
620
+ 26451,
621
+ 16083,
622
+ 25428,
623
+ 16852,
624
+ 20889,
625
+ 18907,
626
+ 15900,
627
+ 20894,
628
+ },
629
+ "tel": {89112, 90422, 90568},
630
+ "tra": {77952, 82273, 74946, 76440},
631
+ "tri": {10064, 8796, 10670},
632
+ "tuc": {110130, 118322, 2484, 114996, 110838, 1599},
633
+ "uma": {
634
+ 46853,
635
+ 54539,
636
+ 46733,
637
+ 58001,
638
+ 53910,
639
+ 55203,
640
+ 54061,
641
+ 55219,
642
+ 44471,
643
+ 57399,
644
+ 48319,
645
+ 50372,
646
+ 44127,
647
+ 65378,
648
+ 67301,
649
+ 41704,
650
+ 62956,
651
+ 50801,
652
+ 59774,
653
+ },
654
+ "umi": {82080, 79822, 11767, 72607, 75097, 85822, 77055},
655
+ "vel": {42913, 48774, 50191, 44816, 39953, 45941, 52727, 46651},
656
+ "vir": {
657
+ 60129,
658
+ 65474,
659
+ 58948,
660
+ 57380,
661
+ 69701,
662
+ 68520,
663
+ 66249,
664
+ 64238,
665
+ 63090,
666
+ 61941,
667
+ 71957,
668
+ 63608,
669
+ 72220,
670
+ 57757,
671
+ },
672
+ "vol": {41312, 34481, 39794, 35228, 44382},
673
+ "vul": {95771, 97886},
674
+ }
675
+
114
676
 
115
677
  def _load_deprecated():
116
678
  with _load.open("constellations_hip.fab") as f:
@@ -134,11 +696,11 @@ def load(**kwargs):
134
696
 
135
697
 
136
698
  def get(constellation_id: str):
137
- return properties.get(constellation_id)
699
+ return CONSTELLATIONS.get(constellation_id)
138
700
 
139
701
 
140
702
  def iterator():
141
- for c in properties.keys():
703
+ for c in CONSTELLATIONS.keys():
142
704
  yield c
143
705
 
144
706
 
starplot/geometry.py ADDED
@@ -0,0 +1,82 @@
1
+ import random
2
+ import math
3
+
4
+ from shapely.geometry import Point, Polygon
5
+
6
+
7
+ def unwrap_polygon(polygon: Polygon) -> Polygon:
8
+ points = list(zip(*polygon.exterior.coords.xy))
9
+ new_points = []
10
+ prev = None
11
+
12
+ for x, y in points:
13
+ if prev is not None and prev > 20 and x < 12:
14
+ x += 24
15
+ elif prev is not None and prev < 12 and x > 20:
16
+ x -= 24
17
+ new_points.append((x, y))
18
+ prev = x
19
+
20
+ return Polygon(new_points)
21
+
22
+
23
+ def random_point_in_polygon(
24
+ polygon: Polygon, max_iterations: int = 100, seed: int = None
25
+ ) -> Point:
26
+ """Returns a random point inside a shapely polygon"""
27
+ if seed:
28
+ random.seed(seed)
29
+
30
+ ctr = 0
31
+ x0, y0, x1, y1 = polygon.bounds
32
+
33
+ while ctr < max_iterations:
34
+ x = random.uniform(x0, x1)
35
+ y = random.uniform(y0, y1)
36
+ point = Point(x, y)
37
+ if polygon.contains(point):
38
+ return point
39
+
40
+ return None
41
+
42
+
43
+ def random_point_in_polygon_at_distance(
44
+ polygon: Polygon,
45
+ origin_point: Point,
46
+ distance: int,
47
+ max_iterations: int = 100,
48
+ seed: int = None,
49
+ ) -> Point:
50
+ """Returns a random point inside a polygon, at a specified distance from the origin point"""
51
+ if seed:
52
+ random.seed(seed)
53
+
54
+ ctr = 0
55
+ while ctr < max_iterations:
56
+ ctr += 1
57
+ angle = random.uniform(0, 2 * math.pi)
58
+ x = origin_point.x + distance * math.cos(angle)
59
+ y = origin_point.y + distance * math.sin(angle)
60
+ point = Point(x, y)
61
+
62
+ if polygon.contains(point):
63
+ return point
64
+
65
+ return None
66
+
67
+
68
+ def wrapped_polygon_adjustment(polygon: Polygon) -> int:
69
+ if "MultiPolygon" == str(polygon.geom_type):
70
+ return 0
71
+
72
+ points = list(zip(*polygon.exterior.coords.xy))
73
+ prev = None
74
+
75
+ for ra, _ in points:
76
+ if prev is not None and prev > 20 and ra < 12:
77
+ return 24
78
+ elif prev is not None and prev < 12 and ra > 20:
79
+ return -24
80
+ prev = ra
81
+
82
+ return 0