add latex table generation file
This commit is contained in:
@@ -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()
|
||||
Reference in New Issue
Block a user