add latex table generation file

This commit is contained in:
2025-05-21 17:59:23 +02:00
parent 44d5da5975
commit a41edfcaa7
+31
View File
@@ -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()