Systems lua to json#5911
Conversation
3df6c14 to
41f459a
Compare
|
OK, positions above were off by factor 8, below is script to fix it, and gif now comparing. There's one star that seems to be moving south east of Sol: Codeimport json
# fpath = "partial/02_local_stars.json"
fpath = "partial/03_bright_stars.json"
with open(fpath) as f:
systems = json.load(f)
# All Lua values for in-sector position need to be multiplied by 8 to
# turn them into lightyears (TLDR: json uses ly for units, lua uses
# percent-of-a-sector)
for i in range(len(systems)):
systems[i]['pos'] = [s * 8 for s in systems[i]['pos']]
# Dump as is
# with open('data.json', 'w') as f:
# json.dump(systems, f)
# Don't json format
out = json.dumps(systems, indent=None)
# Make one system per line:
out = out.replace("}, {", "},\n{")
with open('data.json', 'w') as f:
f.write(out)Comparison |
|
Just checked on master. The star that's popping in/out above is "GJ 1075", this was the only star in 02_local_stars.json on master, and was copied over from it's lua counterpart and had already been multiplied with x8, thus I should rollback the x8 my parsing just did for that line. |
41f459a to
73a3f34
Compare
| {"name": "Xi Bo\u00f6tis", "stars": ["STAR_G", "STAR_K"], "sector": [-2, 1, 0], "pos": [1.96, 7.136, 7.152]}, | ||
| {"name": "Gliese 205", "stars": ["STAR_M"], "sector": [2, -1, -1], "pos": [2.376, 5.696, 6.808]}, | ||
| {"name": "NN 3976", "stars": ["STAR_M"], "sector": [-4, 1, 1], "pos": [3.216, 0.944, 4.456]}, | ||
| {"name": "Alpha Centauri", "stars": ["STAR_G", "STAR_K"], "otherNames": ["Bungula", "Toliman", "\u03b1 Centauri", "Rigil Kentaurus", "Gliese 551", "Gliese 559", "FK5 538", "HIP 70890"], "sector": [-1, 0, -1], "pos": [6.624, 1.632, 4.16]}, |
There was a problem hiding this comment.
These should be using utf-8 codepoints, not ASCII-fied UTF-16 escapes (which is the default python json.dump behavior).
73a3f34 to
d026aee
Compare
| {"name": "Gliese 102", "stars": ["STAR_M"], "sector": [2, -3, 1], "pos": [1.944, 1.368, 5.432]}, | ||
| {"name": "Gliese 103", "stars": ["STAR_K"], "sector": [2, -3, -4], "pos": [0.904, 2.816, 6.016]}, | ||
| {"name": "Upsilon Andromedae", "stars": ["STAR_F"], "sector": [1, -4, 3], "pos": [5.504, 1.944, 5.056]}, | ||
| {"name": "Luyten\"s Star", "stars": ["STAR_M"], "sector": [1, 0, 0], "pos": [3.448, 4.592, 1.128]}, |
There was a problem hiding this comment.
One final issue - the apostrophe-to-double quote path is converting this Lua-side escaped apostrophe into an escaped double-quote. Feel free to manually fix it (with a grep for other occurrences).
d026aee to
0c9f716
Compare








Convert the local stars and bright stars tables to json (from lua)
Commit message:Note following comments could not be carried over:
44 Boötis B/C are a W-Ursae-Majoris-type shallow contact binary system,both G class,
'40 Eridani' - Problem: the secondary and tertiary are co-orbital,and as a system orbit the primary.
'Mu Herculis' - Problem: the secondary and tertiary are co-orbital,and as a system orbit the primary.
'Alpha Centauri' - Comment: "Gliese 559", "FK5 538", "GC 19728","CCDM J14396-6050"
EDIT: I've updated above comments into the
commentfield I did not know our json format had.