astrodatagui: add custom results to simbad queries
This commit is contained in:
@@ -21,12 +21,21 @@ class AstrodataGUI(QtWidgets.QMainWindow):
|
|||||||
self.listDownloaded.itemClicked.connect(self.starSelected)
|
self.listDownloaded.itemClicked.connect(self.starSelected)
|
||||||
self.listSequences.itemClicked.connect(self.sequenceSelected)
|
self.listSequences.itemClicked.connect(self.sequenceSelected)
|
||||||
|
|
||||||
|
self.setupCustomSimbadQueries()
|
||||||
|
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
self.loadDB()
|
self.loadDB()
|
||||||
|
|
||||||
self.updateStarList()
|
self.updateStarList()
|
||||||
|
|
||||||
|
def setupCustomSimbadQueries(self):
|
||||||
|
self.simbad = Simbad()
|
||||||
|
self.simbad.add_votable_fields("sptype")
|
||||||
|
self.simbad.add_votable_fields("velocity")
|
||||||
|
self.simbad.add_votable_fields("diameter")
|
||||||
|
self.simbad.add_votable_fields("distance")
|
||||||
|
|
||||||
def loadDB(self):
|
def loadDB(self):
|
||||||
try:
|
try:
|
||||||
self.starDB: StarDB = StarDB.getInstance(DEFAULT_DB)
|
self.starDB: StarDB = StarDB.getInstance(DEFAULT_DB)
|
||||||
@@ -57,9 +66,14 @@ class AstrodataGUI(QtWidgets.QMainWindow):
|
|||||||
diag = NewStarDialog()
|
diag = NewStarDialog()
|
||||||
if not diag.exec():
|
if not diag.exec():
|
||||||
return
|
return
|
||||||
|
try:
|
||||||
|
result = self.simbad.query_object(diag.starIdentifier)
|
||||||
|
except:
|
||||||
|
self.showErrorMessage("Simbad Error", "Failed to fetcch information from Simbad, aborting...")
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mainName = Simbad.query_object(diag.starIdentifier)["MAIN_ID"][0]
|
mainName = result["MAIN_ID"][0]
|
||||||
except:
|
except:
|
||||||
self.showErrorMessage("Main Identifier Error", "Failed to grab main identifier, aborting...")
|
self.showErrorMessage("Main Identifier Error", "Failed to grab main identifier, aborting...")
|
||||||
return
|
return
|
||||||
@@ -70,6 +84,28 @@ class AstrodataGUI(QtWidgets.QMainWindow):
|
|||||||
self.showErrorMessage("Identifier Error", "Failed to grab all identifiers, aborting...")
|
self.showErrorMessage("Identifier Error", "Failed to grab all identifiers, aborting...")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
|
specType = result["SP_TYPE"][0]
|
||||||
|
except:
|
||||||
|
print("No spectral type found")
|
||||||
|
specType = "-"
|
||||||
|
|
||||||
|
rotVel = "-"
|
||||||
|
rotVelUnit = ""
|
||||||
|
try:
|
||||||
|
if(result["RVZ_TYPE"][0] == "v"):
|
||||||
|
rotVel = result["RV_VALUE"][0]
|
||||||
|
rotVelUnit = str(result["RV_VALUE"].unit)
|
||||||
|
except:
|
||||||
|
print("No radial velocity found")
|
||||||
|
|
||||||
|
try:
|
||||||
|
dist = result["Distance_distance"][0]
|
||||||
|
distUnit = result["Distance_unit"][0]
|
||||||
|
except:
|
||||||
|
dist = "-"
|
||||||
|
distUnit = ""
|
||||||
|
|
||||||
self.starDB.insertStar(mainName, altNames, diag.productManifest)
|
self.starDB.insertStar(mainName, altNames, diag.productManifest)
|
||||||
|
|
||||||
self.updateStarList()
|
self.updateStarList()
|
||||||
|
|||||||
Reference in New Issue
Block a user