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
starplot/data/db.py CHANGED
@@ -1,6 +1,6 @@
1
1
  from functools import cache
2
2
 
3
- import ibis
3
+ from ibis import duckdb
4
4
 
5
5
  from starplot.config import settings
6
6
  from starplot.data import DataFiles
@@ -8,7 +8,7 @@ from starplot.data import DataFiles
8
8
 
9
9
  @cache
10
10
  def connect():
11
- connection = ibis.duckdb.connect(
11
+ connection = duckdb.connect(
12
12
  DataFiles.DATABASE, read_only=True
13
13
  ) # , threads=2, memory_limit="1GB"
14
14
  connection.raw_sql(
starplot/data/dsos.py CHANGED
@@ -1,34 +1,14 @@
1
1
  from functools import cache
2
2
 
3
- import ibis
4
- from ibis import _
3
+ from ibis import _, row_number, coalesce
5
4
 
5
+ from starplot.config import settings
6
6
  from starplot.data import db
7
-
8
-
9
- class DsoLabelMaker(dict):
10
- """
11
- This is pretty hacky, but it helps keep a consistent interface for plotting labels and any overrides.
12
-
13
- Basically this is just a dictionary that returns the key itself for any get() call, unless
14
- the key is present in the 'overrides' dict that's passed on init
15
- """
16
-
17
- def __init__(self, *args, **kwargs):
18
- self._overrides = kwargs.get("overrides") or {}
19
-
20
- def __getitem__(self, key):
21
- return self.get(key)
22
-
23
- def get(self, key):
24
- return self._overrides.get(key) or key
25
-
26
-
27
- DSO_LABELS_DEFAULT = DsoLabelMaker()
7
+ from starplot.data.translations import language_name_column
28
8
 
29
9
 
30
10
  @cache
31
- def table():
11
+ def table(language):
32
12
  con = db.connect()
33
13
  dsos = con.table("deep_sky_objects")
34
14
 
@@ -36,16 +16,19 @@ def table():
36
16
  ra=_.ra_degrees,
37
17
  dec=_.dec_degrees,
38
18
  constellation_id=_.constellation,
39
- magnitude=ibis.coalesce(_.mag_v, _.mag_b, None),
19
+ magnitude=coalesce(_.mag_v, _.mag_b, None),
40
20
  size=_.size_deg2,
41
- rowid=ibis.row_number(),
42
- sk=ibis.row_number(),
21
+ common_names=getattr(
22
+ dsos, language_name_column(language, column_prefix="common_names")
23
+ ),
24
+ rowid=row_number(),
25
+ sk=row_number(),
43
26
  )
44
27
 
45
28
 
46
29
  def load(extent=None, filters=None, sql=None):
47
30
  filters = filters or []
48
- dsos = table()
31
+ dsos = table(language=settings.language)
49
32
 
50
33
  if extent:
51
34
  dsos = dsos.filter(_.geometry.intersects(extent))
Binary file
starplot/data/stars.py CHANGED
@@ -1,436 +1,10 @@
1
1
  from functools import cache
2
2
 
3
- import ibis
4
- from ibis import _
3
+ from ibis import _, row_number
5
4
 
5
+ from starplot.config import settings
6
6
  from starplot.data import bigsky, DataFiles, db
7
-
8
- STAR_NAMES = {
9
- 677: "Alpheratz",
10
- 746: "Caph",
11
- 1067: "Algenib",
12
- 1547: "Citadelle",
13
- 2081: "Ankaa",
14
- 2247: "Felixvarela",
15
- 2920: "Fulu",
16
- 3179: "Schedar",
17
- 3419: "Diphda",
18
- 3479: "Cocibolca",
19
- 3821: "Achird",
20
- 4422: "Castula",
21
- 5054: "Nenque",
22
- 5348: "Wurren",
23
- 5447: "Mirach",
24
- 5529: "Emiw",
25
- 5737: "Revati",
26
- 6193: "Bharani",
27
- 6411: "Adhil",
28
- 6643: "Bélénos",
29
- 6686: "Ruchbah",
30
- 7097: "Alpherg",
31
- 7513: "Titawin",
32
- 7588: "Achernar",
33
- 7607: "Nembus",
34
- 8198: "Torcular",
35
- 8645: "Baten Kaitos",
36
- 8796: "Mothallah",
37
- 8832: "Mesarthim",
38
- 8886: "Segin",
39
- 8903: "Sheratan",
40
- 9487: "Alrescha",
41
- 9640: "Almach",
42
- 9884: "Hamal",
43
- 10826: "Mira",
44
- 11767: "Polaris",
45
- 12191: "Buna",
46
- 12706: "Kaffaljidhma",
47
- 12961: "Koeia",
48
- 13061: "Lilii Borea",
49
- 13192: "Nushagak",
50
- 13268: "Miram",
51
- 13288: "Angetenar",
52
- 13701: "Azha",
53
- 13847: "Acamar",
54
- 13993: "Ayeyarwady",
55
- 14135: "Menkar",
56
- 14576: "Algol",
57
- 14668: "Misam",
58
- 14838: "Botein",
59
- 14879: "Dalim",
60
- 15197: "Zibal",
61
- 15578: "Intan",
62
- 15863: "Mirfak",
63
- 16537: "Ran",
64
- 17096: "Tupi",
65
- 17378: "Rana",
66
- 17448: "Atik",
67
- 17489: "Celaeno",
68
- 17499: "Electra",
69
- 17531: "Taygeta",
70
- 17573: "Maia",
71
- 17579: "Asterope",
72
- 17608: "Merope",
73
- 17702: "Alcyone",
74
- 17847: "Atlas",
75
- 17851: "Pleione",
76
- 18543: "Zaurak",
77
- 18614: "Menkib",
78
- 19587: "Beid",
79
- 19780: "Rhombus",
80
- 19849: "Keid",
81
- 20205: "Prima Hyadum",
82
- 20455: "Secunda Hyadum",
83
- 20535: "Beemim",
84
- 20889: "Ain",
85
- 20894: "Chamukuy",
86
- 21109: "Hoggar",
87
- 21393: "Theemin",
88
- 21421: "Aldebaran",
89
- 21594: "Sceptrum",
90
- 22449: "Tabit",
91
- 22491: "Mouhoun",
92
- 23015: "Hassaleh",
93
- 23416: "Almaaz",
94
- 23453: "Saclateni",
95
- 23767: "Haedus",
96
- 23875: "Cursa",
97
- 24003: "Mago",
98
- 24436: "Rigel",
99
- 24608: "Capella",
100
- 25336: "Bellatrix",
101
- 25428: "Elnath",
102
- 25606: "Nihal",
103
- 25930: "Mintaka",
104
- 25985: "Arneb",
105
- 26207: "Meissa",
106
- 26241: "Hatysa",
107
- 26311: "Alnilam",
108
- 26380: "Bubup",
109
- 26451: "Tianguan",
110
- 26634: "Phact",
111
- 26727: "Alnitak",
112
- 27366: "Saiph",
113
- 27628: "Wazn",
114
- 27989: "Betelgeuse",
115
- 28360: "Menkalinan",
116
- 28380: "Mahasim",
117
- 29034: "Elkurud",
118
- 29550: "Amadioha",
119
- 29655: "Propus",
120
- 30122: "Furud",
121
- 30324: "Mirzam",
122
- 30343: "Tejat",
123
- 30438: "Canopus",
124
- 30860: "Lucilinburhuc",
125
- 30905: "Lusitânia",
126
- 31681: "Alhena",
127
- 31685: "Pipit",
128
- 31895: "Nosaxa",
129
- 32246: "Mebsuta",
130
- 32349: "Sirius",
131
- 32362: "Alzirr",
132
- 32916: "Nervia",
133
- 33579: "Adhara",
134
- 33719: "Citalá",
135
- 33856: "Unurgunite",
136
- 34045: "Muliphein",
137
- 34088: "Mekbuda",
138
- 34444: "Wezen",
139
- 35550: "Wasat",
140
- 35904: "Aludra",
141
- 36188: "Gomeisa",
142
- 36850: "Castor",
143
- 37265: "Jishui",
144
- 37279: "Procyon",
145
- 37284: "Ceibo",
146
- 37826: "Pollux",
147
- 38041: "Tapecue",
148
- 38170: "Azmidi",
149
- 39429: "Naos",
150
- 39757: "Tureis",
151
- 39953: "Regor", # not officially part of IAU recognized names
152
- 40167: "Tegmine",
153
- 40526: "Tarf",
154
- 40687: "Násti",
155
- 40881: "Piautos",
156
- 41037: "Avior",
157
- 41075: "Alsciaukat",
158
- 41704: "Muscida",
159
- 42402: "Minchir",
160
- 42446: "Gakyid",
161
- 42556: "Meleph",
162
- 42806: "Asellus Borealis",
163
- 42911: "Asellus Australis",
164
- 42913: "Alsephina",
165
- 43109: "Ashlesha",
166
- 43587: "Copernicus",
167
- 43674: "Stribor",
168
- 44066: "Acubens",
169
- 44127: "Talitha",
170
- 44471: "Alkaphrah",
171
- 44816: "Suhail",
172
- 44946: "Nahn",
173
- 45238: "Miaplacidus",
174
- 45556: "Aspidiske",
175
- 45941: "Markeb",
176
- 46390: "Alphard",
177
- 46471: "Intercrus",
178
- 46750: "Alterf",
179
- 47087: "Illyrian",
180
- 47202: "Kalausi",
181
- 47431: "Ukdah",
182
- 47508: "Subra",
183
- 48235: "Natasha",
184
- 48356: "Zhang",
185
- 48455: "Rasalas",
186
- 48615: "Felis",
187
- 48711: "Bibhā",
188
- 49637: "Yunü (Yunu)",
189
- 49669: "Regulus",
190
- 50335: "Adhafera",
191
- 50372: "Tania Borealis",
192
- 50583: "Algieba",
193
- 50801: "Tania Australis",
194
- 51624: "Shaomin",
195
- 52521: "Macondo",
196
- 53229: "Praecipua",
197
- 53721: "Chalawan",
198
- 53740: "Alkes",
199
- 53910: "Merak",
200
- 54061: "Dubhe",
201
- 54158: "Dingolay",
202
- 54872: "Zosma",
203
- 54879: "Chertan",
204
- 55174: "Hunahpú",
205
- 55203: "Alula Australis",
206
- 55219: "Alula Borealis",
207
- 55664: "Shama",
208
- 56211: "Giausar",
209
- 56508: "Formosa",
210
- 56572: "Sagarmatha",
211
- 57291: "Uklun",
212
- 57370: "Flegetonte",
213
- 57399: "Taiyangshou",
214
- 57632: "Denebola",
215
- 57757: "Zavijava",
216
- 57820: "Aniara",
217
- 58001: "Phecda",
218
- 58952: "Tonatiuh",
219
- 59199: "Alchiba",
220
- 59747: "Imai",
221
- 59774: "Megrez",
222
- 59803: "Gienah",
223
- 60129: "Zaniah",
224
- 60260: "Ginan",
225
- 60644: "Tupã",
226
- 60718: "Acrux",
227
- 60965: "Algorab",
228
- 61084: "Gacrux",
229
- 61177: "Funi",
230
- 61317: "Chara",
231
- 61359: "Kraz",
232
- 61394: "Phyllon Kissinou",
233
- 61941: "Porrima",
234
- 62223: "La Superba",
235
- 62423: "Tianyi",
236
- 62434: "Mimosa",
237
- 62956: "Alioth",
238
- 63076: "Taiyi",
239
- 63090: "Minelauva",
240
- 63125: "Cor Caroli",
241
- 63608: "Vindemiatrix",
242
- 64241: "Diadem",
243
- 65378: "Mizar",
244
- 65474: "Spica",
245
- 65477: "Alcor",
246
- 66047: "Dofida",
247
- 66192: "Liesma",
248
- 66249: "Heze",
249
- 67301: "Alkaid",
250
- 67927: "Muphrid",
251
- 68002: "Leepwal",
252
- 68702: "Hadar",
253
- 68756: "Thuban",
254
- 68933: "Menkent",
255
- 69427: "Kang",
256
- 69673: "Arcturus",
257
- 69701: "Syrma",
258
- 69732: "Xuange",
259
- 69974: "Khambalia",
260
- 70755: "Elgafar",
261
- 70890: "Proxima Centauri",
262
- 71075: "Seginus",
263
- 71681: "Toliman",
264
- 71683: "Rigil Kentaurus",
265
- 71860: "Uridim",
266
- 72105: "Izar",
267
- 72339: "Mönch",
268
- 72487: "Merga",
269
- 72607: "Kochab",
270
- 72622: "Zubenelgenubi",
271
- 72845: "Arcalís",
272
- 73136: "Baekdu",
273
- 73555: "Nekkar",
274
- 73714: "Brachium",
275
- 74785: "Zubeneschamali",
276
- 74961: "Nikawiy",
277
- 75097: "Pherkad",
278
- 75411: "Alkalurops",
279
- 75458: "Edasich",
280
- 75695: "Nusakan",
281
- 76267: "Alphecca",
282
- 76333: "Zubenelhakrabi",
283
- 76351: "Karaka",
284
- 77070: "Unukalhai",
285
- 77450: "Gudja",
286
- 78104: "Iklil",
287
- 78265: "Fang",
288
- 78401: "Dschubba",
289
- 78820: "Acrab",
290
- 79043: "Marsic",
291
- 79219: "Kamuy",
292
- 79374: "Jabbah",
293
- 79431: "Sharjah",
294
- 79593: "Yed Prior",
295
- 79882: "Yed Posterior",
296
- 80112: "Alniyat",
297
- 80331: "Athebyne",
298
- 80463: "Cujam",
299
- 80687: "Timir",
300
- 80763: "Antares",
301
- 80816: "Kornephoros",
302
- 80838: "Ogma",
303
- 80883: "Marfik",
304
- 81022: "Rosaliadecastro",
305
- 81266: "Paikauhale",
306
- 82273: "Atria",
307
- 82396: "Larawag",
308
- 82514: "Xamidimura",
309
- 82545: "Pipirima",
310
- 82651: "Mahsati",
311
- 83547: "Rapeto",
312
- 83608: "Alrakis",
313
- 83895: "Aldhibah",
314
- 84012: "Sabik",
315
- 84345: "Rasalgethi",
316
- 84379: "Sarin",
317
- 84405: "Guniibuu",
318
- 84787: "Inquill",
319
- 85670: "Rastaban",
320
- 85693: "Maasym",
321
- 85696: "Lesath",
322
- 85822: "Yildun",
323
- 85927: "Shaula",
324
- 86032: "Rasalhague",
325
- 86228: "Sargas",
326
- 86614: "Dziban",
327
- 86742: "Cebalrai",
328
- 86782: "Alruba",
329
- 86796: "Cervantes",
330
- 87108: "Bake-eo (or Bake Eo)",
331
- 87261: "Fuyue",
332
- 87585: "Grumium",
333
- 87833: "Eltanin",
334
- 87937: "Barnard's Star",
335
- 88414: "Pincoya",
336
- 88635: "Alnasl",
337
- 89341: "Polis",
338
- 89931: "Kaus Media",
339
- 90004: "Alasia",
340
- 90185: "Kaus Australis",
341
- 90344: "Fafnir",
342
- 90496: "Kaus Borealis",
343
- 91262: "Vega",
344
- 91852: "Xihe",
345
- 92420: "Sheliak",
346
- 92761: "Ainalrami",
347
- 92855: "Nunki",
348
- 92895: "Kaveh",
349
- 92946: "Alya",
350
- 93194: "Sulafat",
351
- 93506: "Ascella",
352
- 93747: "Okab",
353
- 94114: "Meridiana",
354
- 94141: "Albaldah",
355
- 94376: "Altais",
356
- 94481: "Aladfar",
357
- 94645: "Gumala",
358
- 95124: "Belel",
359
- 95241: "Arkab Prior",
360
- 95262: "Sika",
361
- 95294: "Arkab Posterior",
362
- 95347: "Rukbat",
363
- 95947: "Albireo",
364
- 96078: "Uruk",
365
- 96100: "Alsafi",
366
- 96757: "Sham",
367
- 97165: "Fawaris",
368
- 97278: "Tarazed",
369
- 97649: "Altair",
370
- 97938: "Libertas",
371
- 98036: "Alshain",
372
- 98066: "Terebellum",
373
- 98823: "Tianfu",
374
- 99473: "Antinous",
375
- 99711: "Phoenicia",
376
- 99894: "Chechia",
377
- 100064: "Algedi",
378
- 100310: "Alshat",
379
- 100345: "Dabih",
380
- 100453: "Sadr",
381
- 100751: "Peacock",
382
- 101421: "Aldulfin",
383
- 101769: "Rotanev",
384
- 101958: "Sualocin",
385
- 102098: "Deneb",
386
- 102488: "Aljanah",
387
- 102618: "Albali",
388
- 103527: "Musica",
389
- 104382: "Polaris Australis",
390
- 104987: "Kitalpha",
391
- 105199: "Alderamin",
392
- 106032: "Alfirk",
393
- 106278: "Sadalsuud",
394
- 106786: "Bunda",
395
- 106824: "Sāmaya",
396
- 106985: "Nashira",
397
- 107136: "Azelfafage",
398
- 107251: "Bosona",
399
- 107259: "Garnet Star",
400
- 107315: "Enif",
401
- 107556: "Deneb Algedi",
402
- 108085: "Aldhanab",
403
- 108375: "Itonda",
404
- 108917: "Kurhah",
405
- 109074: "Sadalmelik",
406
- 109268: "Alnair",
407
- 109427: "Biham",
408
- 110003: "Ancha",
409
- 110130: "Lang-Exster",
410
- 110395: "Sadachbia",
411
- 110813: "Lionrock",
412
- 111169: "Stellio",
413
- 111710: "Situla",
414
- 112029: "Homam",
415
- 112122: "Tiaki",
416
- 112158: "Matar",
417
- 112748: "Sadalbari",
418
- 113136: "Skat",
419
- 113288: "Tengshe",
420
- 113357: "Helvetios",
421
- 113368: "Fomalhaut",
422
- 113881: "Scheat",
423
- 113889: "Fumalsamakah",
424
- 113963: "Markab",
425
- 114322: "Ebla",
426
- 115250: "Salm",
427
- 115623: "Alkarab",
428
- 116076: "Veritate",
429
- 116084: "Poerava",
430
- 116727: "Errai",
431
- 118319: "Axólotl",
432
- }
433
- """Star names by their HIP id. You can override these values when calling `stars()`"""
7
+ from starplot.data.translations import language_name_column
434
8
 
435
9
 
436
10
  class StarCatalog:
@@ -459,7 +33,11 @@ class StarCatalog:
459
33
 
460
34
 
461
35
  @cache
462
- def table(catalog: StarCatalog = StarCatalog.BIG_SKY_MAG11, table_name="stars"):
36
+ def table(
37
+ catalog: StarCatalog = StarCatalog.BIG_SKY_MAG11,
38
+ table_name="stars",
39
+ language: str = "en-us",
40
+ ):
463
41
  con = db.connect()
464
42
 
465
43
  if catalog == StarCatalog.BIG_SKY_MAG11:
@@ -480,8 +58,12 @@ def table(catalog: StarCatalog = StarCatalog.BIG_SKY_MAG11, table_name="stars"):
480
58
  ra_hours=_.ra_degrees / 15,
481
59
  # stars parquet does not have geometry field
482
60
  geometry=_.ra_degrees.point(_.dec_degrees),
483
- rowid=ibis.row_number(),
484
- sk=ibis.row_number(),
61
+ rowid=row_number(),
62
+ sk=row_number(),
63
+ )
64
+
65
+ designations = designations.mutate(
66
+ name=getattr(designations, language_name_column(language))
485
67
  )
486
68
 
487
69
  stars = stars.join(
@@ -503,7 +85,7 @@ def load(
503
85
  sql=None,
504
86
  ):
505
87
  filters = filters or []
506
- stars = table(catalog)
88
+ stars = table(catalog, language=settings.language)
507
89
 
508
90
  if extent:
509
91
  stars = stars.filter(stars.geometry.intersects(extent))