Документ взят из кэша поисковой машины. Адрес оригинального документа : http://star.arm.ac.uk/~vek/macc.py
Дата изменения: Mon Aug 17 13:40:11 2015
Дата индексирования: Sun Apr 10 00:17:57 2016
Кодировка:

Поисковые слова: http astrokuban.info astrokuban
from pylab import *
import numpy as np


# not tested, only a quick macc calculator, do not use otherwise


# list of Teff and Haflam computed for log g = 4.0 from Castelli & Kurucz (2004) models

Teff_base = ([45000, 43000, 41000, 39000, 38000, 37000, 36000, 35000, 34000, 33000, 32000, 30000, 25000, 19000, 15000, 12000, 9500, 9250, 8250, 8250, 7250, 7000, 6500, 6250, 6000, 5750, 5750, 5500, 5250, 4750, 4500, 4250, 4000, 3750, 3500]) # K

Ha_cflux_base = ([3.99845610e+08, 3.79471596e+08, 3.59062782e+08, 3.42605336e+08, 3.32105327e+08, 3.21170520e+08, 3.09274959e+08, 2.96179366e+08, 2.81683771e+08, 2.66183778e+08, 2.50079366e+08, 2.17266114e+08, 1.51769459e+08, 9.36877381e+07, 6.30862148e+07, 4.13318672e+07, 2.43043190e+07, 2.28668633e+07, 1.73826737e+07, 1.73826737e+07, 1.28179892e+07, 1.17226880e+07, 9.57926901e+06, 8.51393499e+06, 7.50547848e+06, 6.51950815e+06, 6.51950815e+06, 5.56411196e+06, 4.64229018e+06, 2.96710974e+06, 2.25096649e+06, 1.63917676e+06, 1.13900002e+06, 7.37748075e+05, 4.47944696e+05]) # ergs/s/cm2/A




def cal_ha_macc(haew, cflux, mass, radius):
"""Returns the mass accretion rate from Halpha equivalent width.

Arguments:
haew -- Halpha equivalent width (Angstorms)
cflux -- Halpha continuum flux (ergs/s/cm2/A)
Mass -- Mass (solar masses)
Radius -- Radius (solar radii)

Returns:
Halpha Mass accretion rate in solar Masses/ year

Tests:
>>> planck_flux(3000, 1, 140, 3.8)
1.8391821989335082e-11
>>> planck_flux(6000, 1.2, 2000, 0.7)
9.6246759728693138e-12
"""


R_sun = 6.955e10 # read solar radii in cm
PI = np.pi # read pi value from numpy
# Ha line flux
HaFlux = cflux*haew # ergs/s/cm2/A * A
# Convert solar radii to cm
R = radius/R_sun
# Convert Ha line flux to line luminosity
Halum = HaFlux*4*PI*R*R # ergs/s/cm2 * cm2
Halum_sun = Halum/3.845e33 # convert to sol units
log_LHa = np.log10(Halum_sun) # convert to log
log_Lacc = 1.72 + log_LHa # taken from De Marchi et al. (2010) converts Ha line luminosity to accretion luminosity
logR = np.log10(R) # log of radius
logM = np.log10(mass) # log of mass
Macc = -7.39 + log_Lacc + logR - logM # mass accretion rate formula in solar units, R_in = 1.5 from Gullbring et al. (1998)
return Macc