/
stellar_estimators.py
220 lines (179 loc) · 8.85 KB
/
stellar_estimators.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
"""Functions to estimate stellar parameters (radius, mass, logg) using
asteroseismic scaling relations.
"""
from uncertainties import ufloat, umath
from astropy import units as u
from astropy import constants as const
from .utils import SeismologyQuantity
__all__ = ['estimate_radius', 'estimate_mass', 'estimate_logg']
"""Global parameters for the sun"""
NUMAX_SOL = ufloat(3090, 30) # microhertz | Huber et al. 2011
DELTANU_SOL = ufloat(135.1, 0.1) # microhertz | Huber et al. 2011
TEFF_SOL = ufloat(5772., 0.8) # Kelvin | Prsa et al. 2016
G_SOL = ((const.G * const.M_sun)/(const.R_sun)**2).to(u.cm/u.second**2) #cms^2
def estimate_radius(numax, deltanu, teff, numax_err=None, deltanu_err=None, teff_err=None):
"""Returns a stellar radius estimate based on the scaling relations.
The two global observable seismic parameters, numax and deltanu, along with
temperature, scale with fundamental stellar properties (Brown et al. 1991;
Kjeldsen & Bedding 1995). These scaling relations can be rearranged to
calculate a stellar radius as
R = Rsol * (numax/numax_sol)(deltanu/deltanusol)^-2(Teff/Teffsol)^0.5
where R is the radius and Teff is the effective temperature, and the suffix
'sol' indicates a solar value. In this method we use the solar values for
numax and deltanu as given in Huber et al. (2011) and for Teff as given in
Prsa et al. (2016).
This code structure borrows from work done in Bellinger et al. (2019), which
also functions as an accessible explanation of seismic scaling relations.
NOTE: These scaling relations are scaled to the Sun, and therefore do not
always produce an entirely accurate result for more evolved stars.
Parameters
----------
numax : float
The frequency of maximum power of the seismic mode envelope. If not
given an astropy unit, assumed to be in units of microhertz.
deltanu : float
The frequency spacing between two consecutive overtones of equal radial
degree. If not given an astropy unit, assumed to be in units of
microhertz.
teff : float
The effective temperature of the star. In units of Kelvin.
numax_err : float
Error on numax. Assumed to be same units as numax
deltanu_err : float
Error on deltanu. Assumed to be same units as deltanu
teff_err : float
Error on Teff. Assumed to be same units as Teff.
Returns
-------
radius : SeismologyQuantity
An estimate of the stellar radius in solar radii.
"""
numax = u.Quantity(numax, u.microhertz).value
deltanu = u.Quantity(deltanu, u.microhertz).value
teff = u.Quantity(teff, u. Kelvin).value
if all(b is not None for b in [numax_err, deltanu_err, teff_err]):
numax_err = u.Quantity(numax_err, u.microhertz).value
deltanu_err = u.Quantity(deltanu_err, u.microhertz).value
teff_err = u.Quantity(teff_err, u.Kelvin).value
unumax = ufloat(numax, numax_err)
udeltanu = ufloat(deltanu, deltanu_err)
uteff = ufloat(teff, teff_err)
else:
unumax = ufloat(numax, 0)
udeltanu = ufloat(deltanu, 0)
uteff = ufloat(teff, 0)
uR = (unumax / NUMAX_SOL) * (udeltanu / DELTANU_SOL)**(-2.) * (uteff / TEFF_SOL)**(0.5)
result = SeismologyQuantity(uR.n * u.solRad,
error=uR.s * u.solRad,
name="radius",
method="Uncorrected Scaling Relations")
return result
def estimate_mass(numax, deltanu, teff, numax_err=None, deltanu_err=None, teff_err=None):
"""Calculates mass using the asteroseismic scaling relations.
The two global observable seismic parameters, numax and deltanu, along with
temperature, scale with fundamental stellar properties (Brown et al. 1991;
Kjeldsen & Bedding 1995). These scaling relations can be rearranged to
calculate a stellar mass as
M = Msol * (numax/numax_sol)^3(deltanu/deltanusol)^-4(Teff/Teffsol)^1.5
where M is the mass and Teff is the effective temperature, and the suffix
'sol' indicates a solar value. In this method we use the solar values for
numax and deltanu as given in Huber et al. (2011) and for Teff as given in
Prsa et al. (2016).
This code structure borrows from work done in Bellinger et al. (2019), which
also functions as an accessible explanation of seismic scaling relations.
NOTE: These scaling relations are scaled to the Sun, and therefore do not
always produce an entirely accurate result for more evolved stars.
Parameters
----------
numax : float
The frequency of maximum power of the seismic mode envelope. If not
given an astropy unit, assumed to be in units of microhertz.
deltanu : float
The frequency spacing between two consecutive overtones of equal radial
degree. If not given an astropy unit, assumed to be in units of
microhertz.
teff : float
The effective temperature of the star. In units of Kelvin.
numax_err : float
Error on numax. Assumed to be same units as numax
deltanu_err : float
Error on deltanu. Assumed to be same units as deltanu
teff_err : float
Error on Teff. Assumed to be same units as Teff.
Returns
-------
mass : SeismologyQuantity
An estimate of the stellar mass in solar masses.
"""
numax = u.Quantity(numax, u.microhertz).value
deltanu = u.Quantity(deltanu, u.microhertz).value
teff = u.Quantity(teff, u.Kelvin).value
if all(b is not None for b in [numax_err, deltanu_err, teff_err]):
numax_err = u.Quantity(numax_err, u.microhertz).value
deltanu_err = u.Quantity(deltanu_err, u.microhertz).value
teff_err = u.Quantity(teff_err, u.Kelvin).value
unumax = ufloat(numax, numax_err)
udeltanu = ufloat(deltanu, deltanu_err)
uteff = ufloat(teff, teff_err)
else:
unumax = ufloat(numax, 0)
udeltanu = ufloat(deltanu, 0)
uteff = ufloat(teff, 0)
uM = (unumax / NUMAX_SOL)**3. * (udeltanu / DELTANU_SOL)**(-4.) * (uteff / TEFF_SOL)**(1.5)
result = SeismologyQuantity(uM.n * u.solMass,
error=uM.s * u.solMass,
name="mass",
method="Uncorrected Scaling Relations")
return result
def estimate_logg(numax, teff, numax_err=None, teff_err=None):
"""Calculates the log of the surface gravity using the asteroseismic scaling
relations.
The two global observable seismic parameters, numax and deltanu, along with
temperature, scale with fundamental stellar properties (Brown et al. 1991;
Kjeldsen & Bedding 1995). These scaling relations can be rearranged to
calculate a stellar surface gravity as
g = gsol * (numax/numax_sol)(Teff/Teffsol)^0.5
where g is the surface gravity and Teff is the effective temperature,
and the suffix 'sol' indicates a solar value. In this method we use the
solar values for numax as given in Huber et al. (2011) and for Teff as given
in Prsa et al. (2016). The solar surface gravity is calcluated from the
astropy constants for solar mass and radius and does not have an error.
The solar surface gravity is returned as log10(g) with units in dex, as is
common in the astrophysics literature.
This code structure borrows from work done in Bellinger et al. (2019), which
also functions as an accessible explanation of seismic scaling relations.
NOTE: These scaling relations are scaled to the Sun, and therefore do not
always produce an entirely accurate result for more evolved stars.
Parameters
----------
numax : float
The frequency of maximum power of the seismic mode envelope. If not
given an astropy unit, assumed to be in units of microhertz.
teff : float
The effective temperature of the star. In units of Kelvin.
numax_err : float
Error on numax. Assumed to be same units as numax
teff_err : float
Error on teff. Assumed to be same units as teff.
Returns
-------
logg : `.SeismologyQuantity`
The log10 of the surface gravity of the star.
"""
numax = u.Quantity(numax, u.microhertz).value
teff = u.Quantity(teff, u.Kelvin).value
if all(b is not None for b in [numax_err, teff_err]):
numax_err = u.Quantity(numax_err, u.microhertz).value
teff_err = u.Quantity(teff_err, u.Kelvin).value
unumax = ufloat(numax, numax_err)
uteff = ufloat(teff, teff_err)
else:
unumax = ufloat(numax, 0)
uteff = ufloat(teff, 0)
ug = G_SOL.value * (unumax / NUMAX_SOL) * (uteff / TEFF_SOL)**0.5
ulogg = umath.log(ug, 10)
result = SeismologyQuantity(ulogg.n * u.dex,
error=ulogg.s * u.dex,
name="logg",
method="Uncorrected Scaling Relations")
return result