Compare commits

..

4 Commits

2 changed files with 120 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
SpType,U-B,B-V,V-R,V-I,V-J,V-H,V-K,V-L,V-M,V-N
B0.0,-1.08,-0.30,-0.19,-0.31,-0.80,-0.92,-0.97,-1.13,-1.00,-9.99
B0.5,-1.00,-0.28,-0.18,-0.31,-0.77,-0.89,-0.95,-1.11,-0.99,-9.99
B1.0,-0.95,-0.26,-0.16,-0.30,-0.73,-0.85,-0.93,-1.08,-0.96,-9.99
B1.5,-0.88,-0.25,-0.15,-0.29,-0.70,-0.82,-0.91,-1.05,-0.94,-9.99
B2.0,-0.81,-0.24,-0.14,-0.29,-0.67,-0.79,-0.89,-1.02,-0.92,-9.99
B2.5,-0.72,-0.22,-0.13,-0.28,-0.64,-0.76,-0.86,-0.97,-0.88,-0.96
B3.0,-0.68,-0.20,-0.12,-0.27,-0.60,-0.72,-0.82,-0.92,-0.84,-0.91
B3.5,-0.65,-0.19,-0.12,-0.26,-0.58,-0.70,-0.80,-0.90,-0.82,-0.87
B4.0,-0.63,-0.18,-0.11,-0.25,-0.56,-0.68,-0.77,-0.86,-0.79,-0.84
B4.5,-0.61,-0.17,-0.11,-0.24,-0.54,-0.65,-0.74,-0.83,-0.76,-0.80
B5.0,-0.58,-0.16,-0.10,-0.24,-0.51,-0.62,-0.71,-0.78,-0.73,-0.75
B6.0,-0.49,-0.14,-0.10,-0.21,-0.46,-0.57,-0.64,-0.70,-0.65,-0.66
B7.0,-0.43,-0.13,-0.09,-0.19,-0.41,-0.51,-0.57,-0.61,-0.58,-0.58
B7.5,-0.40,-0.12,-0.09,-0.17,-0.39,-0.48,-0.54,-0.57,-0.54,-0.53
B8.0,-0.36,-0.11,-0.08,-0.16,-0.36,-0.45,-0.49,-0.52,-0.49,-0.48
B8.5,-0.27,-0.09,-0.08,-0.13,-0.31,-0.40,-0.43,-0.43,-0.42,-0.39
B9.0,-0.18,-0.07,-0.07,-0.10,-0.26,-0.34,-0.33,-0.34,-0.34,-0.30
B9.5,-0.10,-0.04,-0.05,-0.08,-0.22,-0.29,-0.26,-0.27,-0.26,-0.22
A0.0,-0.02,-0.01,-0.04,-0.04,-0.16,-0.19,-0.17,-0.18,-0.18,-0.14
A1.0,0.01,0.02,-0.02,-0.02,-0.11,-0.12,-0.11,-0.12,-0.13,-0.08
A2.0,0.05,0.05,-0.01,0.00,-0.07,-0.04,-0.05,-0.07,-0.08,-0.02
A3.0,0.08,0.08,0.01,0.02,-0.02,0.03,0.01,-0.01,-0.02,0.03
A4.0,0.09,0.12,0.02,0.05,0.03,0.11,0.08,0.05,-0.04,0.09
A5.0,0.09,0.15,0.04,0.09,0.09,0.19,0.15,0.12,0.10,0.16
A6.0,0.10,0.17,0.05,0.12,0.13,0.30,0.21,0.17,0.15,0.21
A7.0,0.10,0.20,0.06,0.15,0.18,0.32,0.27,0.23,0.20,0.26
A8.0,0.09,0.27,0.09,0.20,0.25,0.42,0.36,0.33,0.29,0.34
A9.0,0.08,0.30,0.10,0.24,0.31,0.49,0.44,0.41,0.36,0.41
F0.0,0.03,0.32,0.12,0.28,0.37,0.57,0.52,0.49,0.43,0.48
F1.0,0.00,0.34,0.14,0.31,0.43,0.64,0.58,0.57,0.49,0.54
F2.0,0.00,0.35,0.15,0.35,0.48,0.71,0.66,0.66,0.56,0.60
F5.0,-0.02,0.45,0.21,0.44,0.67,0.93,0.89,0.90,0.77,0.80
F8.0,0.02,0.53,0.24,0.50,0.79,1.06,1.03,1.06,0.91,0.91
G0.0,0.06,0.60,0.27,0.54,0.87,1.15,1.14,1.18,1.01,1.01
G2.0,0.09,0.63,0.30,0.58,0.97,1.25,1.26,1.31,1.12,1.11
G3.0,0.12,0.65,0.30,0.59,0.98,1.27,1.28,1.33,1.14,1.13
G5.0,0.20,0.68,0.31,0.61,1.02,1.31,1.32,1.38,1.18,1.17
G8.0,0.30,0.74,0.35,0.66,1.14,1.44,1.47,1.55,1.34,1.30
K0.0,0.44,0.81,0.42,0.75,1.34,1.67,1.74,1.85,1.61,1.54
K1.0,0.48,0.86,0.46,0.82,1.46,1.80,1.89,2.02,1.78,1.68
K2.0,0.67,0.92,0.50,0.89,1.60,1.94,2.06,2.21,1.97,1.84
K3.0,0.73,0.95,0.55,0.97,1.73,2.09,2.23,2.40,2.17,2.01
K4.0,1.00,1.00,0.60,1.04,1.84,2.22,2.38,2.57,2.36,2.15
K5.0,1.06,1.15,0.68,1.20,2.04,2.46,2.66,2.87,2.71,2.44
K7.0,1.21,1.33,0.62,1.45,2.30,2.78,3.01,3.25,3.21,2.83
M0.0,1.23,1.37,0.70,1.67,2.49,3.04,3.29,3.54,3.65,3.16
M1.0,1.18,1.47,0.76,1.84,2.61,3.22,3.47,3.72,3.95,3.39
M2.0,1.15,1.47,0.83,2.06,2.74,3.42,3.67,3.92,4.31,3.66
M3.0,1.17,1.50,0.89,2.24,2.84,3.58,3.83,4.08,4.62,3.89
M4.0,1.07,1.52,0.94,2.43,2.93,3.74,3.98,4.22,4.93,4.11
+69
View File
@@ -0,0 +1,69 @@
from astroquery.simbad import Simbad
import pandas as pd
simbad = Simbad()
bvStars = ["1RXS J064643.6-770027", "BD-08 995", "CPD-19 878", "PM J07058-5848", "TYC 1360-957-1", "TYC 4595-107-1"]
jhcStars = ["2MASS J18524052+4156057", "2MASS J18534407+4208274", "2MASS J18535462+4135227", "2MASS J19335656+4010546"]
filters = ["U", "B", "V", "R", "I", "J", "H", "K", "u", "g", "r", "i", "z", "G", "F150W", "F200W", "F444W"]
for f in filters:
simbad.add_votable_fields(f"flux({f})")
spTypeTable = pd.read_csv("cousins.cols")
weights = {"SpType": 0.0,
"U-B": 1.0,
"B-V": 1.0,
"V-R": 0.0,
"V-I": 0.0,
"V-J": 0.0,
"V-H": 0.0,
"V-K": 0.0,
"V-L": 0.0,
"V-M": 0.0,
"V-N": 0.0}
for star in bvStars:
star = simbad.query_object(star)
U_B = star["FLUX_U"] - star["FLUX_B"]
B_V = star["FLUX_B"] - star["FLUX_V"]
V_R = star["FLUX_V"] - star["FLUX_R"]
V_I = star["FLUX_V"] - star["FLUX_I"]
V_J = star["FLUX_V"] - star["FLUX_J"]
V_H = star["FLUX_V"] - star["FLUX_H"]
V_K = star["FLUX_V"] - star["FLUX_K"]
fluxDiff = {"U-B": U_B,
"B-V": B_V,
"V-R": V_R,
"V-I": V_I,
"V-J": V_J,
"V-H": V_H,
"V-K": V_K}
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]
distancesUBVweighted = (
spTypeTable[matchingColumnsUBV]
.sub(fluxDiff.iloc[0][matchingColumnsUBV])
.pow(2)
.multiply([weights[col] for col in matchingColumnsUBV], axis=1)
.sum(axis=1)
)
bestMatchIndexUBVweighted = distancesUBVweighted.idxmin()
bestMatchNameUBVweighted = spTypeTable.iloc[bestMatchIndexUBVweighted, 0]
print(f"{star['MAIN_ID'].value[0]}: {bestMatchNameUBV}/{bestMatchNameUBVweighted} type star")
print("Table entry: ")
print(spTypeTable.iloc[bestMatchIndexUBV:bestMatchIndexUBV+1])
print("Weighted Table entry:")
print(spTypeTable.iloc[bestMatchIndexUBVweighted:bestMatchIndexUBVweighted+1])
print("Star: ")
print(fluxDiff)
print("-------------------------------------------------------------------------------------")