-
Notifications
You must be signed in to change notification settings - Fork 0
/
Subdwarfs_Yband.py
111 lines (89 loc) · 6.28 KB
/
Subdwarfs_Yband.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
# ------------------------------------------------------------------------------------
# ------------------- Read in Spectra and Photometry files ---------------------------
# ------------------------------------------------------------------------------------
# Read all in as pandas dataframes
# None for 1256-1408, and problem for 0616
df_1256 = pd.read_csv('Data/correctpi1256-0224 (L3.5sd) SED.txt', sep=" ", comment='#', header=None,
names=["w", "f", "err"])
# -------------- Subdwarfs ----------------------------------
df_0532 = pd.read_csv('Data/0532+8246 (L7sd) SED.txt', sep=" ", comment='#', header=None, names=["w", "f", "err"])
df_0616 = pd.read_csv('Data/0616-6407 (L5sd) SED.txt', sep=" ", comment='#', header=None, names=["w", "f", "err"])
df_1013 = pd.read_csv('Data/1013-1356 (-) SED.txt', sep=" ", comment='#', header=None, names=["w", "f", "err"])
# df_125614 = pd.read_csv('', sep=" ", comment='#', header=None, names=["w", "f", "err"])
df_HD = pd.read_csv('Data/HD114762B (M9sd) SED.txt', sep=" ", comment='#', header=None, names=["w", "f", "err"])
df_1425 = pd.read_csv('Data/1425+7102 (M8sd) SED.txt', sep=" ", comment='#', header=None, names=["w", "f", "err"])
df_LHS = pd.read_csv('Data/1439+1839 (M7sd) SED.txt', sep=" ", comment='#', header=None, names=["w", "f", "err"])
df_1444 = pd.read_csv('Data/1444-2019 (M9sd) SED.txt', sep=" ", comment='#', header=None, names=["w", "f", "err"])
df_1610 = pd.read_csv('Data/1610-0040 (M7sd) SED.txt', sep=" ", comment='#', header=None, names=["w", "f", "err"])
df_1626 = pd.read_csv('Data/1626+3925 (L4sd) SED.txt', sep=" ", comment='#', header=None, names=["w", "f", "err"])
df_2036 = pd.read_csv('Data/2036+5059 (M7.5sd) SED.txt', sep=" ", comment='#', header=None, names=["w", "f", "err"])
# -------------------------------------------------------------------------------------
# ---------------------- Remove Tails ------------------------------------------------
# -------------------------------------------------------------------------------------
df_HD = df_HD[(df_HD['w'] > 0.91) & (df_HD['w'] <= 3)]
# --- Trim from connecting ----
df_0532 = df_0532[(df_0532['w'] <= 1.0095)]
df_0616 = df_0616[(df_0616['w'] <= 1.01)]
# -------------------------------------------------------------------------------------
# --------- Normalize the spectra to same as before for 1256 --------------------------
# -------------------------------------------------------------------------------------
# Determine region good for all spectra to take the average flux over
norm_region = df_1256[(df_1256['w'] >= 0.98) & (df_1256['w'] <= 0.988)]
norm_df_1256 = df_1256['f']/(np.average(norm_region['f']))
norm_region_0532 = df_0532[(df_0532['w'] >= 0.98) & (df_0532['w'] <= 0.988)]
norm_df_0532 = df_0532['f']/(np.average(norm_region_0532['f']))
norm_region_0616 = df_0616[(df_0616['w'] >= 0.98) & (df_0616['w'] <= 0.988)]
norm_df_0616 = df_0616['f']/(np.average(norm_region_0616['f']))
norm_region_1626 = df_1626[(df_1626['w'] >= 0.98) & (df_1626['w'] <= 0.988)]
norm_df_1626 = df_1626['f']/(np.average(norm_region_1626['f']))
norm_region_1444 = df_1444[(df_1444['w'] >= 0.98) & (df_1444['w'] <= 0.988)]
norm_df_1444 = df_1444['f']/(np.average(norm_region_1444['f']))
norm_region_1013 = df_1013[(df_1013['w'] >= 0.98) & (df_1013['w'] <= 0.988)]
norm_df_1013 = df_1013['f']/(np.average(norm_region_1013['f']))
norm_region_LHS = df_LHS[(df_LHS['w'] >= 0.98) & (df_LHS['w'] <= 0.988)]
norm_df_LHS = df_LHS['f']/(np.average(norm_region_LHS['f']))
norm_region_1425 = df_1425[(df_1425['w'] >= 0.98) & (df_1425['w'] <= 0.988)]
norm_df_1425 = df_1425['f']/(np.average(norm_region_1425['f']))
norm_region_1610 = df_1610[(df_1610['w'] >= 0.98) & (df_1610['w'] <= 0.988)]
norm_df_1610 = df_1610['f']/(np.average(norm_region_1610['f']))
norm_region_HD = df_HD[(df_HD['w'] >= 0.98) & (df_HD['w'] <= 0.988)]
norm_df_HD = df_HD['f']/(np.average(norm_region_HD['f']))
norm_region_2036 = df_2036[(df_2036['w'] >= 0.98) & (df_2036['w'] <= 0.988)]
norm_df_2036 = df_2036['f']/(np.average(norm_region_2036['f']))
# norm_region_125614 = df_125614[(df_125614['w'] >= 0.98) & (df_125614['w'] <= 0.988)]
# norm_df_125614 = df_125614['f']/(np.average(norm_region_125614['f']))
# -------------------------------------------------------------------------------------
# --------- Plotting: Comparison of in order of decreasing Teff/ Spt Type -------------
# -------------------------------------------------------------------------------------
# ------ Set up figure layout --------
fig = plt.figure()
ax1 = fig.add_subplot(111)
fig.set_size_inches(8, 10) # to make sure proper size run entire code at once
plt.gcf().subplots_adjust(bottom=0.15, left=0.15)
plt.xlim([0.95, 1.10])
plt.ylim([0, 10.5])
# ------ Axes Labels --------
plt.xticks(fontsize=20)
plt.yticks(fontsize=20)
plt.xlabel('Wavelength ($\mu m$)', fontsize=25)
plt.ylabel('Normalized Flux ($F_\lambda$)', fontsize=25)
# -------- Add data -----------
ax1.plot(df_0532['w'], norm_df_0532, c='indigo') # sdL7 1647
ax1.plot(df_0616['w'], norm_df_0616 + 1, c='darkviolet') # sdL5 ???
ax1.plot(df_1626['w'], norm_df_1626 + 2, c='#531CF7') # sdL4 2158
ax1.plot(df_1444['w'], norm_df_1444 + 3, c='mediumblue') # sdM9 2303
ax1.plot(df_1256['w'], norm_df_1256 + 4, c='k') # sdL3.5 2338
ax1.plot(df_1013['w'], norm_df_1013 + 5, c='#015DF7') # sdM9.5 2457
ax1.plot(df_LHS['w'], norm_df_LHS + 6, c='#01A1D6') # sdM7 2775
# ax1.plot(df_1425['w'], norm_df_1425, c='#09D5D6') # sdM8 2823
ax1.plot(df_1610['w'], norm_df_1610 + 7, c='#04A57F') # sdM7 2852
ax1.plot(df_HD['w'], norm_df_HD + 8, c='#09D67E') # sd--IRM9 2859
ax1.plot(df_2036['w'], norm_df_2036 + 9, c='#F7BE0F') # sdM7.5 3049
# ax1.plot(df_125614['w'], norm_df_125614, c='#C56201') # sdM8
# ------- Label Sources -------------
ax1.text(0, 0.88, 'HD114762BB (IR: sdM9 ) T$_\mathrm{eff}: 2859 \pm 50$ K', transform=ax1.transAxes, color='#09D67E',
fontsize=12)
plt.savefig('Plots/Subdwarfs_Ybandstack.png')