tried to add custom entries like andromeda, but they end up mislocated
This commit is contained in:
parent
6b0f9c671a
commit
3738e661d9
|
@ -6,6 +6,20 @@ import csv
|
|||
import sys
|
||||
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.
|
||||
# Sun = -26.7
|
||||
# Sirius = -1.44
|
||||
|
@ -21,7 +35,8 @@ print("")
|
|||
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)
|
||||
dec = float(dec)
|
||||
mag = float(mag)
|
||||
|
@ -46,6 +61,7 @@ def render(ra, dec, mag, proper):
|
|||
|
||||
total = 0
|
||||
count = 0
|
||||
count_extra = 0
|
||||
with open("hygdata_v41.csv", "r", encoding="utf-8") as f:
|
||||
for entry in csv.DictReader(f):
|
||||
total += 1
|
||||
|
@ -59,8 +75,11 @@ with open("hygdata_v41.csv", "r", encoding="utf-8") as f:
|
|||
continue
|
||||
if float(mag) > MAX_APPARENT_MAGNITUDE:
|
||||
continue
|
||||
render(ra, dec, mag, proper)
|
||||
render(ra, dec, mag, ci, proper)
|
||||
count += 1
|
||||
#for entry in CUSTOM_ENTRIES:
|
||||
# render(entry[0], entry[1], entry[2], entry[3], entry[4])
|
||||
# count_extra += 1
|
||||
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue