Skip to content

Commit

Permalink
Fix #244: tweak rebuild-star-data for new format
Browse files Browse the repository at this point in the history
It looks like the format of IAU-CSN.txt has changed, so let’s tweak our
own code to match (even though we might never need this script again).
Thanks to GitHub user Bernmeister for suggesting these fixes.  I have
verified that the script still generates exactly the lines in `stars.py`.
  • Loading branch information
brandon-rhodes committed Feb 17, 2025
1 parent e86d411 commit 8deda52
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bin/rebuild-star-data
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ name_to_hip = {}
f = api.load.open('http://www.pas.rochester.edu/~emamajek/WGSN/IAU-CSN.txt')
for line in f:
line = line.decode('utf-8')
if line.startswith('#'):
if line.startswith('#') or line.startswith('$') or line.isspace():
continue
name = line[0:18].strip()
hip = line[86:93].strip()
name = line[0:17].strip() # 1 - 17 -> 0 - 16 -> 0 - 17
hip = line[90:96].strip() # 91 - 96 -> 90 - 95 -> 90 - 96
if hip == '_':
continue
name_to_hip[name] = int(hip)
Expand Down

0 comments on commit 8deda52

Please sign in to comment.