tried to add custom entries like andromeda, but they end up mislocated

This commit is contained in:
yuni 2024-03-18 22:56:51 +01:00
parent 6b0f9c671a
commit 3738e661d9

View file

@ -6,6 +6,20 @@ import csv
import sys import sys
import math import math
#def entry(ra_hour, ra_min, ra_sec, dec_deg, dec_min, dec_sec, mag, name, color_index):
# return [
# ra_hour*15 + ra_min*0.25 + ra_sec*0.004166,
# dec_deg + dec_min/60 + dec_sec/3600,
# mag,
# name,
# color_index,
# ]
#
#
#CUSTOM_ENTRIES = [
# entry(0, 42, 44.3, 41, 16, 9, 3.44-15, 0.63, "Andromeda Galaxy"),
#]
# Lower apparent magnitude = brighter. # Lower apparent magnitude = brighter.
# Sun = -26.7 # Sun = -26.7
# Sirius = -1.44 # Sirius = -1.44
@ -21,7 +35,8 @@ print("")
print("pub const STARS: &[[f32; 5]] = &[") print("pub const STARS: &[[f32; 5]] = &[")
def render(ra, dec, mag, proper): def render(ra, dec, mag, ci, proper):
# Takes ra/deg in degrees
ra = float(ra) ra = float(ra)
dec = float(dec) dec = float(dec)
mag = float(mag) mag = float(mag)
@ -46,6 +61,7 @@ def render(ra, dec, mag, proper):
total = 0 total = 0
count = 0 count = 0
count_extra = 0
with open("hygdata_v41.csv", "r", encoding="utf-8") as f: with open("hygdata_v41.csv", "r", encoding="utf-8") as f:
for entry in csv.DictReader(f): for entry in csv.DictReader(f):
total += 1 total += 1
@ -59,8 +75,11 @@ with open("hygdata_v41.csv", "r", encoding="utf-8") as f:
continue continue
if float(mag) > MAX_APPARENT_MAGNITUDE: if float(mag) > MAX_APPARENT_MAGNITUDE:
continue continue
render(ra, dec, mag, proper) render(ra, dec, mag, ci, proper)
count += 1 count += 1
#for entry in CUSTOM_ENTRIES:
# render(entry[0], entry[1], entry[2], entry[3], entry[4])
# count_extra += 1
print("];") print("];")
print(f"Wrote {count} stars (total={total}).", file=sys.stderr) print(f"Wrote {count} stars (total={total}) + {count_extra} extra entries.", file=sys.stderr)