identify_unknown_sptypes: print UBV only match
This commit is contained in:
+25
-13
@@ -44,26 +44,38 @@ for star in bvStars:
|
||||
fluxDiff = pd.DataFrame(fluxDiff)
|
||||
fluxDiffValColumns = fluxDiff.columns[fluxDiff.notna().iloc[0]]
|
||||
|
||||
matchingColumnsUBV = spTypeTable.columns.intersection(fluxDiffValColumns)
|
||||
distancesUBV = spTypeTable[matchingColumnsUBV].sub(fluxDiff.iloc[0]).pow(2).sum(axis=1)
|
||||
bestMatchIndexUBV = distancesUBV.idxmin()
|
||||
bestMatchNameUBV = spTypeTable.iloc[bestMatchIndexUBV, 0]
|
||||
matchingColumnsUBVIJHK = spTypeTable.columns.intersection(fluxDiffValColumns)
|
||||
distancesUBV = spTypeTable[matchingColumnsUBVIJHK].sub(fluxDiff.iloc[0]).pow(2).sum(axis=1)
|
||||
bestMatchIndexUBVIJHK = distancesUBV.idxmin()
|
||||
bestMatchNameUBV = spTypeTable.iloc[bestMatchIndexUBVIJHK, 0]
|
||||
|
||||
distancesUBVweighted = (
|
||||
spTypeTable[matchingColumnsUBV]
|
||||
.sub(fluxDiff.iloc[0][matchingColumnsUBV])
|
||||
distancesUBVIJHKweighted = (
|
||||
spTypeTable[matchingColumnsUBVIJHK]
|
||||
.sub(fluxDiff.iloc[0][matchingColumnsUBVIJHK])
|
||||
.pow(2)
|
||||
.multiply([weights[col] for col in matchingColumnsUBV], axis=1)
|
||||
.multiply([weights[col] for col in matchingColumnsUBVIJHK], axis=1)
|
||||
.sum(axis=1)
|
||||
)
|
||||
bestMatchIndexUBVweighted = distancesUBVweighted.idxmin()
|
||||
bestMatchNameUBVweighted = spTypeTable.iloc[bestMatchIndexUBVweighted, 0]
|
||||
bestMatchIndexUBVIJHKweighted = distancesUBVIJHKweighted.idxmin()
|
||||
bestMatchNameUBVweighted = spTypeTable.iloc[bestMatchIndexUBVIJHKweighted, 0]
|
||||
|
||||
print(f"{star['MAIN_ID'].value[0]}: {bestMatchNameUBV}/{bestMatchNameUBVweighted} type star")
|
||||
distancesUBVonlyWeighted = (
|
||||
spTypeTable[matchingColumnsUBVIJHK]
|
||||
.sub(fluxDiff.iloc[0][matchingColumnsUBVIJHK])
|
||||
.pow(2)
|
||||
.multiply([1.0 if(col == "U-B" or col == "B-V") else 0.0 for col in matchingColumnsUBVIJHK], axis=1)
|
||||
.sum(axis=1)
|
||||
)
|
||||
bestMatchIndexUBVonlyWeighted = distancesUBVonlyWeighted.idxmin()
|
||||
bestMatchNameUBVonlyWeighted = spTypeTable.iloc[bestMatchIndexUBVonlyWeighted, 0]
|
||||
|
||||
print(f"--- {star['MAIN_ID'].value[0]} ---")
|
||||
print("Table entry: ")
|
||||
print(spTypeTable.iloc[bestMatchIndexUBV:bestMatchIndexUBV+1])
|
||||
print(spTypeTable.iloc[bestMatchIndexUBVIJHK:bestMatchIndexUBVIJHK+1])
|
||||
print("Weighted Table entry:")
|
||||
print(spTypeTable.iloc[bestMatchIndexUBVweighted:bestMatchIndexUBVweighted+1])
|
||||
print(spTypeTable.iloc[bestMatchIndexUBVIJHKweighted:bestMatchIndexUBVIJHKweighted+1])
|
||||
print("UBV Table entry:")
|
||||
print(spTypeTable.iloc[bestMatchIndexUBVonlyWeighted:bestMatchIndexUBVonlyWeighted+1])
|
||||
print("Star: ")
|
||||
print(fluxDiff)
|
||||
print("-------------------------------------------------------------------------------------")
|
||||
Reference in New Issue
Block a user