From a41edfcaa7398c1c1a7f351188192380acd2986e Mon Sep 17 00:00:00 2001 From: SGCMarkus Date: Wed, 21 May 2025 17:59:23 +0200 Subject: [PATCH] add latex table generation file --- generate_latex_table.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 generate_latex_table.py diff --git a/generate_latex_table.py b/generate_latex_table.py new file mode 100644 index 0000000..919caed --- /dev/null +++ b/generate_latex_table.py @@ -0,0 +1,31 @@ +import pandas as pd +from main.astrodatagui.db.StarsDB import StarDB + +db: StarDB = StarDB.getInstance("stars.db") +starMainIDs = db.getAllStars() +res = [] +for mainID in starMainIDs: + altNames = db.getStarAltNames(mainID) + infos = db.getStarInfos(mainID) + kicName = "-" + ticName = "-" + spType = "-" + for name in altNames: + if name[0].startswith("TIC"): + ticName = name[0] + if name[0].startswith("KIC"): + kicName = name[0] + spType = infos["SpType"] + res.append({"MainID": mainID, + "Spectral Type": spType, + "TIC": ticName, + "KIC": kicName}) + +resDF = pd.DataFrame(res) +resDF.sort_values(by=["Spectral Type", "MainID"]) #.to_latex(index=False) + +for sptype in ["M", "K", "G", "F"]: + texFile = open(f"table_{sptype}.tex", "w") + tex = resDF[resDF["Spectral Type"].str.startswith(sptype)].sort_values(by=["Spectral Type", "MainID"]).to_latex(index=False) + texFile.write(tex) + texFile.close() \ No newline at end of file