From 8deda52594edf1a6b430f96f85f2da5de9445fd0 Mon Sep 17 00:00:00 2001 From: Brandon Rhodes Date: Mon, 17 Feb 2025 12:41:55 -0500 Subject: [PATCH] Fix #244: tweak `rebuild-star-data` for new format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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`. --- bin/rebuild-star-data | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/rebuild-star-data b/bin/rebuild-star-data index 23450d9..d047a3a 100755 --- a/bin/rebuild-star-data +++ b/bin/rebuild-star-data @@ -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)