starplot 0.13.0__py2.py3-none-any.whl → 0.15.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 (74) hide show
  1. starplot/__init__.py +5 -2
  2. starplot/base.py +311 -197
  3. starplot/cli.py +33 -0
  4. starplot/coordinates.py +6 -0
  5. starplot/data/__init__.py +6 -24
  6. starplot/data/bigsky.py +58 -40
  7. starplot/data/constellation_lines.py +827 -0
  8. starplot/data/constellation_stars.py +1501 -0
  9. starplot/data/constellations.py +600 -27
  10. starplot/data/db.py +17 -0
  11. starplot/data/dsos.py +24 -141
  12. starplot/data/stars.py +45 -24
  13. starplot/geod.py +0 -6
  14. starplot/geometry.py +181 -0
  15. starplot/horizon.py +302 -231
  16. starplot/map.py +100 -463
  17. starplot/mixins.py +75 -14
  18. starplot/models/__init__.py +1 -1
  19. starplot/models/base.py +18 -129
  20. starplot/models/constellation.py +55 -32
  21. starplot/models/dso.py +132 -67
  22. starplot/models/moon.py +57 -78
  23. starplot/models/planet.py +44 -69
  24. starplot/models/star.py +91 -60
  25. starplot/models/sun.py +32 -53
  26. starplot/optic.py +21 -18
  27. starplot/plotters/__init__.py +2 -0
  28. starplot/plotters/constellations.py +342 -0
  29. starplot/plotters/dsos.py +49 -68
  30. starplot/plotters/experimental.py +171 -0
  31. starplot/plotters/milkyway.py +39 -0
  32. starplot/plotters/stars.py +126 -122
  33. starplot/profile.py +16 -0
  34. starplot/settings.py +26 -0
  35. starplot/styles/__init__.py +2 -0
  36. starplot/styles/base.py +56 -34
  37. starplot/styles/ext/antique.yml +11 -9
  38. starplot/styles/ext/blue_dark.yml +8 -10
  39. starplot/styles/ext/blue_gold.yml +135 -0
  40. starplot/styles/ext/blue_light.yml +14 -12
  41. starplot/styles/ext/blue_medium.yml +23 -20
  42. starplot/styles/ext/cb_wong.yml +9 -7
  43. starplot/styles/ext/grayscale.yml +4 -3
  44. starplot/styles/ext/grayscale_dark.yml +7 -5
  45. starplot/styles/ext/map.yml +9 -6
  46. starplot/styles/ext/nord.yml +7 -7
  47. starplot/styles/ext/optic.yml +1 -1
  48. starplot/styles/extensions.py +1 -0
  49. starplot/utils.py +19 -0
  50. starplot/warnings.py +21 -0
  51. {starplot-0.13.0.dist-info → starplot-0.15.0.dist-info}/METADATA +19 -18
  52. starplot-0.15.0.dist-info/RECORD +97 -0
  53. starplot-0.15.0.dist-info/entry_points.txt +3 -0
  54. starplot/data/bayer.py +0 -3499
  55. starplot/data/flamsteed.py +0 -2682
  56. starplot/data/library/constellation_borders_inv.gpkg +0 -0
  57. starplot/data/library/constellation_lines_hips.json +0 -709
  58. starplot/data/library/constellation_lines_inv.gpkg +0 -0
  59. starplot/data/library/constellations.gpkg +0 -0
  60. starplot/data/library/constellations_hip.fab +0 -88
  61. starplot/data/library/milkyway.gpkg +0 -0
  62. starplot/data/library/milkyway_inv.gpkg +0 -0
  63. starplot/data/library/ongc.gpkg.zip +0 -0
  64. starplot/data/library/stars.bigsky.mag11.parquet +0 -0
  65. starplot/data/library/stars.hipparcos.parquet +0 -0
  66. starplot/data/messier.py +0 -111
  67. starplot/data/prep/__init__.py +0 -0
  68. starplot/data/prep/constellations.py +0 -108
  69. starplot/data/prep/dsos.py +0 -299
  70. starplot/data/prep/utils.py +0 -16
  71. starplot/models/geometry.py +0 -44
  72. starplot-0.13.0.dist-info/RECORD +0 -101
  73. {starplot-0.13.0.dist-info → starplot-0.15.0.dist-info}/LICENSE +0 -0
  74. {starplot-0.13.0.dist-info → starplot-0.15.0.dist-info}/WHEEL +0 -0
@@ -1,8 +1,7 @@
1
- import json
1
+ import ibis
2
+ from ibis import _
2
3
 
3
- from skyfield.data import stellarium
4
-
5
- from starplot.data import DataFiles, load as _load
4
+ from starplot.data import db
6
5
 
7
6
 
8
7
  """
@@ -88,7 +87,8 @@ properties = {
88
87
  "Scl": ("Sculptor", 0.33, -32.01),
89
88
  "Sco": ("Scorpius", 16.9, -33.55),
90
89
  "Sct": ("Scutum", 18.54, -12.35),
91
- "Ser": ("Serpens", 16.45, 3.59),
90
+ "Ser1": ("Serpens\nCaput", 16.45, 3.59),
91
+ "Ser2": ("Serpens\nCauda", 18.2, -7.29),
92
92
  "Sex": ("Sextans", 10.55, -4.24),
93
93
  "Sge": ("Sagitta", 19.74, 14.92),
94
94
  "Sgr": ("Sagittarius", 18.81, -26.05),
@@ -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,37 +112,609 @@ 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
+ "ser1": {
582
+ 77450,
583
+ 77516,
584
+ 77070,
585
+ 77233,
586
+ 76852,
587
+ 76276,
588
+ 77622,
589
+ 78072,
590
+ },
591
+ "ser2": {86263, 89962, 88048, 92946},
592
+ "sex": {51437, 49641, 51362, 48437},
593
+ "sge": {98337, 96837, 96757, 97365},
594
+ "sgr": {
595
+ 90496,
596
+ 95168,
597
+ 93506,
598
+ 93864,
599
+ 90185,
600
+ 92041,
601
+ 89931,
602
+ 89642,
603
+ 93085,
604
+ 93683,
605
+ 92855,
606
+ 89341,
607
+ 88635,
608
+ 94141,
609
+ },
610
+ "tau": {
611
+ 18724,
612
+ 20455,
613
+ 20205,
614
+ 21421,
615
+ 26451,
616
+ 16083,
617
+ 25428,
618
+ 16852,
619
+ 20889,
620
+ 18907,
621
+ 15900,
622
+ 20894,
623
+ },
624
+ "tel": {89112, 90422, 90568},
625
+ "tra": {77952, 82273, 74946, 76440},
626
+ "tri": {10064, 8796, 10670},
627
+ "tuc": {110130, 118322, 2484, 114996, 110838, 1599},
628
+ "uma": {
629
+ 46853,
630
+ 54539,
631
+ 46733,
632
+ 58001,
633
+ 53910,
634
+ 55203,
635
+ 54061,
636
+ 55219,
637
+ 44471,
638
+ 57399,
639
+ 48319,
640
+ 50372,
641
+ 44127,
642
+ 65378,
643
+ 67301,
644
+ 41704,
645
+ 62956,
646
+ 50801,
647
+ 59774,
648
+ },
649
+ "umi": {82080, 79822, 11767, 72607, 75097, 85822, 77055},
650
+ "vel": {42913, 48774, 50191, 44816, 39953, 45941, 52727, 46651},
651
+ "vir": {
652
+ 60129,
653
+ 65474,
654
+ 58948,
655
+ 57380,
656
+ 69701,
657
+ 68520,
658
+ 66249,
659
+ 64238,
660
+ 63090,
661
+ 61941,
662
+ 71957,
663
+ 63608,
664
+ 72220,
665
+ 57757,
666
+ },
667
+ "vol": {41312, 34481, 39794, 35228, 44382},
668
+ "vul": {95771, 97886},
669
+ }
670
+
671
+
672
+ def load(extent=None, filters=None):
673
+ filters = filters or []
674
+ con = db.connect()
675
+ c = con.table("constellations")
676
+ c = c.mutate(
677
+ ra=_.center_ra,
678
+ dec=_.center_dec,
679
+ constellation_id=_.iau_id,
680
+ rowid=ibis.row_number(),
681
+ boundary=_.geometry,
682
+ )
683
+
684
+ if extent:
685
+ filters.append(_.geometry.intersects(extent))
114
686
 
115
- def _load_deprecated():
116
- with _load.open("constellations_hip.fab") as f:
117
- consdata = stellarium.parse_constellations(f)
118
- return consdata
687
+ if filters:
688
+ return c.filter(*filters)
119
689
 
690
+ return c
120
691
 
121
- def load(**kwargs):
122
- import geopandas as gpd
123
- import numpy as np
124
- from starplot.data import DataFiles
125
692
 
126
- cons = gpd.read_file(
127
- DataFiles.CONSTELLATIONS.value,
128
- engine="pyogrio",
129
- use_arrow=True,
130
- **kwargs,
693
+ def load_borders(extent=None, filters=None):
694
+ filters = filters or []
695
+ con = db.connect()
696
+ c = con.table("constellation_borders")
697
+ c = c.mutate(
698
+ # ra=_.center_ra,
699
+ # dec=_.center_dec,
700
+ # constellation_id=_.iau_id,
701
+ rowid=ibis.row_number(),
702
+ # boundary=_.geometry,
131
703
  )
132
- cons = cons.replace({np.nan: None})
133
- return cons
704
+
705
+ if extent:
706
+ filters.append(_.geometry.intersects(extent))
707
+
708
+ if filters:
709
+ return c.filter(*filters)
710
+
711
+ return c
134
712
 
135
713
 
136
714
  def get(constellation_id: str):
137
- return properties.get(constellation_id)
715
+ return CONSTELLATIONS.get(constellation_id)
138
716
 
139
717
 
140
718
  def iterator():
141
- for c in properties.keys():
719
+ for c in CONSTELLATIONS.keys():
142
720
  yield c
143
-
144
-
145
- def lines():
146
- with open(DataFiles.CONSTELLATION_LINES_HIP, "r") as conlines:
147
- return json.loads(conlines.read())
starplot/data/db.py ADDED
@@ -0,0 +1,17 @@
1
+ from functools import cache
2
+
3
+ import ibis
4
+
5
+ from starplot import settings
6
+ from starplot.data import DataFiles
7
+
8
+
9
+ @cache
10
+ def connect():
11
+ connection = ibis.duckdb.connect(
12
+ DataFiles.DATABASE, read_only=True
13
+ ) # , threads=2, memory_limit="1GB"
14
+ connection.raw_sql(
15
+ f"SET extension_directory = '{str(settings.DUCKDB_EXTENSION_PATH)}';"
16
+ )
17
+ return connection