Calculate Atomic Rates
Calculates rates and outputs raw data for any level-to-level transition.
- rates(
self, lratetype: np.int32 = 0, ion: str = ‘h_i’, llo: np.int32 = 0, lup: np.int32 = 0, trad: np.float64 = -1.0, rlrad38: np.float64 = 1.0, temperature: np.float64 = 1.0, density: np.float64 = 1e3, pressure: np.float64 = 0.03, lcpres: np.int32 = 0, rlogxi: np.float64 = 0.0, cfrac: np.float64 = 0.0, spectrum: str = ‘pow’, spectrum_file: str = ‘cutpow.text’, spectun: np.int32 = 0, vturbi: np.float64 = 1.0, ncn2: np.int32 = 999, run: bool = False
):
Parameters:
ion : character stringThe string specifies the ionic species using the Xstar notation; for instance, ‘o_iii’ for O III.
lratetype : integer or 2-character stringDenotes the dataset to be retrieved:
0 or ‘ALL’ : all rates
3 or ‘EC’ : bound-bound collisional
4 or ‘LA’ : bound-bound radiative
5 or ‘EI’ : bound-free collisional
7 or ‘PI’ : bound-free radiative
8 or ‘’ : total recombination
13 or ‘LV’ : energy levels
14 or ‘’ : superlevel to spect level radiative
15 or ‘’ : total collisional ionization
41 or ‘AU’ : Auger transition
42 or ‘’ : inner-shell photoabsorption
llo : integerLower level index of the ion. For
rtype= ‘LV’,llo= 0 returns all the levels whilello= -1 returns the continuum. For otherrtype,llo= 0 returns all the rates forllo<lup.lup : integerUpper level index of the ion.
lup= 0 returns all rates withlup>llo.
Note
For
llo=lup= 0, all rates forrtypeare listed.temperature : floatElectron temperature in units of 104 K.
density : floatElectron density in units of cm-3.
rlogxi : floatLog of the ionization parameter.
rlrad38 : floatLuminosity in units of 1038 ergs/s.
cfrac : floatCovering fraction.
lcpres : integerConstant pressure switch (1 = yes; 0 = no).
pressure : floatModel pressure in dynes/cm2.
vturbi : floatTurbulent velocity in Km/s.
trad : floatRadiation temperature in 107 K.
spectrum : character stringInput spectrum type:
‘bbody’ - black body spectrum
‘bremss’ - thermal bremsstrahlung
‘pow’ - power law
‘file
spectrum_file : character stringName of file containing spectrum.
spectun : integerSpectrum units (0 = energy; 1 = photon)
ncn2 : integerNumber of continuum bins.
run : BooleanRunning switch (False - allows user to specify input iteratively; True - runs function).
- Returns:
df :Dataframe listing rates:ans1: rate for forward reaction (llo –> lup)ans2: rate for inverse reaction (lup –> llo)ans3: heating rate photon point of view for forward reaction (llo –> lup)ans4: cooling rate photon point of view for inverse reaction (lup –> llo)ans5: heating rate electron point of view for forward reaction (llo –> lup)ans6}: cooling rate electron point of view for inverse reaction (lup –> llo)
Note
For
llo!= 0 andlup!= 0, a list with the raw data is produced. Additionally, ifrtype= 4 orrtype = 7, a second dataframe is produced with opacity/emission coefficients.- Examples
Recombination rate into superlevel of O I at temperature 105 K, density 1012 cm-3 and
rlogxi= -3 (rtype= 7,llo= 11, andlup= 19).
>>> y = xs.rates(lratetype=7,ion='o_i',llo=11,lup=19,temperature=10.0,density=1.0e12,rlogxi=-3.0,run=True)
U(1-1.8),U(1.8-4): 2977819120.6583405 2025810601.3355548
Lbol= 2.3400568391044851
Datasets computed = 3
[0] Ionic rates
[1] Raw data
[2] Tabulation of opacity/emission coefficients
>>> y[0]
jkk rate_type data_type llo lup ml ans1 ans2 ans3 ans4 ans5 ans6
0 29 7 99 11 19 14725 373100000.0 1.296 -2.864000e-12 -0.000089 -2.723000e-12 -0.000033
>>> y[1]
[array([ 99, 7, 0, 491, 11, 0], dtype=int32), array([3.00000e+00, 4.00000e+00, 5.00000e+00, 6.00000e+00, 7.00000e+00,
8.00000e+00, 9.00000e+00, 1.00000e+01, 1.10000e+01, 1.20000e+01,
1.30000e+01, 1.40000e+01, 1.50000e+01, 1.60000e+01, 1.70000e+01,
1.80000e+01, 1.90000e+01, 2.00000e+01, 2.10000e+01, 2.20000e+01,
1.00000e+00, 1.50000e+00, 2.00000e+00, 2.50000e+00, 3.00000e+00,
3.50000e+00, 4.00000e+00, 4.50000e+00, 5.00000e+00, 5.50000e+00,
6.00000e+00, 6.50000e+00, 7.00000e+00, 7.50000e+00, 8.00000e+00,
8.50000e+00, 9.00000e+00, 2.94911e-11, 2.94911e-11, 2.94911e-11,
2.94911e-11, 2.94911e-11, 2.94911e-11, 2.94911e-11, 2.94911e-11,
2.94911e-11, 2.66270e-11, 2.27011e-11, 1.88627e-11, 1.48138e-11,
1.14079e-11, 8.35176e-12, 5.40351e-12, 3.44860e-12, 1.38340e-12,
0.00000e+00, 0.00000e+00, 1.42341e-11, 1.42341e-11, 1.42341e-11,
1.42341e-11, 1.42341e-11, 1.42341e-11, 1.42341e-11, 1.42341e-11,
1.42341e-11, 1.34059e-11, 1.21426e-11, 1.07511e-11, 9.09039e-12,
7.50944e-12, 5.91144e-12, 4.15851e-12, 2.83980e-12, 1.24706e-12,
0.00000e+00, 0.00000e+00, 6.69040e-12, 6.69040e-12, 6.69040e-12,
6.69040e-12, 6.69040e-12, 6.69040e-12, 6.69040e-12, 6.69040e-12,
6.69040e-12, 6.46530e-12, 6.08855e-12, 5.62812e-12, 5.01552e-12,
4.36490e-12, 3.63354e-12, 2.73281e-12, 1.97359e-12, 9.36669e-13,
1.11640e-37, 4.86164e-38, 3.07984e-12, 3.07984e-12, 3.07984e-12,
3.07984e-12, 3.07984e-12, 3.07984e-12, 3.07984e-12, 3.07984e-12,
3.07984e-12, 3.02008e-12, 2.91186e-12, 2.76734e-12, 2.55612e-12,
2.30941e-12, 2.00492e-12, 1.58923e-12, 1.20145e-12, 6.09263e-13,
2.54706e-22, 1.12131e-22, 1.40238e-12, 1.40216e-12, 1.40163e-12,
1.40084e-12, 1.39989e-12, 1.39887e-12, 1.39788e-12, 1.39699e-12,
1.39623e-12, 1.37957e-12, 1.34810e-12, 1.30320e-12, 1.23248e-12,
1.14304e-12, 1.02348e-12, 8.44952e-13, 6.62881e-13, 3.55544e-13,
6.43325e-18, 2.86311e-18, 6.84236e-13, 6.83223e-13, 6.79663e-13,
6.73972e-13, 6.66820e-13, 6.58974e-13, 6.51163e-13, 6.43976e-13,
6.37800e-13, 6.28328e-13, 6.15421e-13, 5.98808e-13, 5.73541e-13,
5.40648e-13, 4.94551e-13, 4.20926e-13, 3.40047e-13, 1.91171e-13,
6.07976e-17, 2.73537e-17, 3.48222e-13, 3.47597e-13, 3.44016e-13,
3.37682e-13, 3.29352e-13, 3.19944e-13, 3.10369e-13, 3.01393e-13,
2.93553e-13, 2.85804e-13, 2.78054e-13, 2.69997e-13, 2.59645e-13,
2.46806e-13, 2.28858e-13, 1.99141e-13, 1.64566e-13, 9.61928e-14,
8.95738e-17, 4.07413e-17, 7.26527e-13, 7.24802e-13, 7.02829e-13,
6.58172e-13, 5.96250e-13, 5.24048e-13, 4.48827e-13, 3.76955e-13,
3.13106e-13, 2.59481e-13, 2.16787e-13, 1.84239e-13, 1.59529e-13,
1.40613e-13, 1.24451e-13, 1.06289e-13, 8.74542e-14, 5.24499e-14,
8.47697e-16, 3.89776e-16, 4.13900e-12, 4.13785e-12, 4.03154e-12,
3.76552e-12, 3.37249e-12, 2.89775e-12, 2.39067e-12, 1.89636e-12,
1.44956e-12, 1.07138e-12, 7.69945e-13, 5.42685e-13, 3.79530e-13,
2.67473e-13, 1.92348e-13, 1.39841e-13, 1.02340e-13, 6.02634e-14,
6.90236e-15, 3.20843e-15, 2.53580e-12, 2.53580e-12, 2.49644e-12,
2.35813e-12, 2.13708e-12, 1.85928e-12, 1.55449e-12, 1.25108e-12,
9.71891e-13, 7.31720e-13, 5.37392e-13, 3.88758e-13, 2.80470e-13,
2.04926e-13, 1.53260e-13, 1.15841e-13, 8.78328e-14, 5.31547e-14,
5.02585e-15, 2.36171e-15, 7.03065e-13, 7.03065e-13, 6.97768e-13,
6.67397e-13, 6.13679e-13, 5.43037e-13, 4.63246e-13, 3.82041e-13,
3.05926e-13, 2.39295e-13, 1.84478e-13, 1.41838e-13, 1.10104e-13,
8.73446e-14, 7.09864e-14, 5.77382e-14, 4.64774e-14, 2.90724e-14,
1.59909e-15, 7.59648e-16, 1.53736e-13, 1.53736e-13, 1.53358e-13,
1.48545e-13, 1.38763e-13, 1.25200e-13, 1.09385e-13, 9.29087e-14,
7.71656e-14, 6.31171e-14, 5.13444e-14, 4.20093e-14, 3.48724e-14,
2.95650e-14, 2.54904e-14, 2.17251e-14, 1.81178e-14, 1.15711e-14,
3.86638e-16, 1.85679e-16, 3.15573e-14, 3.15573e-14, 3.15504e-14,
3.09116e-14, 2.93130e-14, 2.69512e-14, 2.40984e-14, 2.10513e-14,
1.80809e-14, 1.53715e-14, 1.30536e-14, 1.11757e-14, 9.69428e-15,
8.54777e-15, 7.60629e-15, 6.63388e-15, 5.62663e-15, 3.63300e-15,
8.54338e-17, 4.14773e-17, 6.30457e-15, 6.30457e-15, 6.30457e-15,
6.23419e-15, 5.98686e-15, 5.59159e-15, 5.09482e-15, 4.54980e-15,
4.00724e-15, 3.49920e-15, 3.05434e-15, 2.68559e-15, 2.38494e-15,
2.14347e-15, 1.93408e-15, 1.70184e-15, 1.45245e-15, 9.41468e-16,
1.83112e-17, 8.98716e-18, 1.22532e-15, 1.22532e-15, 1.22532e-15,
1.21894e-15, 1.18238e-15, 1.11771e-15, 1.03267e-15, 9.36620e-16,
8.38863e-16, 7.44198e-16, 6.59119e-16, 5.86959e-16, 5.26237e-16,
4.76023e-16, 4.30903e-16, 3.79197e-16, 3.23462e-16, 2.09294e-16,
3.87980e-18, 1.92503e-18, 2.31676e-16, 2.31676e-16, 2.31676e-16,
2.31275e-16, 2.26171e-16, 2.15796e-16, 2.01411e-16, 1.84637e-16,
1.67162e-16, 1.49419e-16, 1.33008e-16, 1.18797e-16, 1.06503e-16,
9.61428e-17, 8.66714e-17, 7.57886e-17, 6.42838e-17, 4.13099e-17,
8.17541e-19, 4.10069e-19, 4.28415e-17, 4.28415e-17, 4.28415e-17,
4.28344e-17, 4.21836e-17, 4.05550e-17, 3.81488e-17, 3.52424e-17,
3.21380e-17, 2.87430e-17, 2.55089e-17, 2.26692e-17, 2.01620e-17,
1.80349e-17, 1.60885e-17, 1.38967e-17, 1.16642e-17, 7.40742e-18,
1.71652e-19, 8.70398e-20, 0.00000e+00, 1.84200e+02, 1.14291e-03,
1.32800e+02, 2.46423e-03, 9.58600e+01, 4.00151e-03, 6.91500e+01,
5.78989e-03, 4.98600e+01, 7.87048e-03, 3.59300e+01, 1.02910e-02,
2.58900e+01, 1.31069e-02, 1.86500e+01, 1.63831e-02, 1.34300e+01,
2.01944e-02, 9.66700e+00, 2.46285e-02, 6.95700e+00, 2.97869e-02,
5.00600e+00, 3.57883e-02, 3.60100e+00, 4.27701e-02, 2.59000e+00,
5.08927e-02, 1.86200e+00, 6.03423e-02, 1.33700e+00, 7.10732e-02,
9.67400e-01, 8.35151e-02, 6.99200e-01, 9.79416e-02, 5.04800e-01,
1.14669e-01, 3.64100e-01, 1.34063e-01, 2.62300e-01, 1.56550e-01,
1.88600e-01, 1.82625e-01, 1.35400e-01, 2.12857e-01, 9.69800e-02,
2.47055e-01, 6.98300e-02, 2.86573e-01, 5.01600e-02, 3.32240e-01,
3.59200e-02, 3.83697e-01, 2.58400e-02, 4.42959e-01, 1.85300e-02,
5.11212e-01, 1.32400e-02, 5.87816e-01, 9.49800e-03, 6.75744e-01,
6.78800e-03, 7.76673e-01, 4.83100e-03, 8.89504e-01, 3.45300e-03,
1.01858e+00, 2.45700e-03, 1.16230e+00, 1.75600e-03, 1.32617e+00,
1.25000e-03, 1.50789e+00, 8.93300e-04, 1.71439e+00, 6.36000e-04,
1.94903e+00, 4.51000e-04, 2.20820e+00, 3.21400e-04, 2.50171e+00,
2.28100e-04, 2.82458e+00, 1.62900e-04, 3.18900e+00, 1.15800e-04,
3.60031e+00, 8.21100e-05, 4.05089e+00, 5.85600e-05, 4.55776e+00,
4.16400e-05, 5.12794e+00, 2.95100e-05, 5.76934e+00, 2.08500e-05,
6.46905e+00, 1.48400e-05, 7.25350e+00, 1.05300e-05, 8.13298e+00,
7.45400e-06, 9.11901e+00, 5.26300e-06, 1.01901e+01, 3.74500e-06,
1.13869e+01, 2.66000e-06, 1.27242e+01, 1.88500e-06, 1.28102e+01,
1.84500e-06], dtype=float32), array([20, 17, 57, 12, 0, 2, 8, 1, 30, 11, 29], dtype=int32), '']
>>> y[2]
index photon_energy opacity emission_out emission_in
0 1 1.000000e-01 0.0 0.0 0.0
1 2 1.016000e-01 0.0 0.0 0.0
2 3 1.032000e-01 0.0 0.0 0.0
3 4 1.048000e-01 0.0 0.0 0.0
4 5 1.064000e-01 0.0 0.0 0.0
.. ... ... ... ... ...
994 995 8.584000e+05 0.0 0.0 0.0
995 996 9.032000e+05 0.0 0.0 0.0
996 997 9.504000e+05 0.0 0.0 0.0
997 998 1.000000e+06 0.0 0.0 0.0
998 999 1.052000e+06 0.0 0.0 0.0
[999 rows x 5 columns] >>>
Collisional excitation rate for O III from the ground state to the upper level of the 5007 line.
>>> y=xs.rates(lratetype=3,ion=xs.ion_name(31),llo=3,lup=4,temperature=1.,density=1.e+16,rlogxi=0)
Datasets computed = 2
[0] Ionic rates
[1] Raw data
>>> y[0]
jkk rate_type data_type llo lup ml ans1 ans2 ans3 ans4 ans5 ans6
0 31 3 51 3 4 17211 14940000.0 264000000.0 0.0 0.0 0.001047 0.000059
>>> y[1]
[array([51, 3, 0, 7, 5, 0], dtype=int32), array([0.1819, 0.3 , 1.303 , 1.183 , 1.237 , 1.449 , 1.488 ],
dtype=float32), array([ 2, 3, 4, 8, 31], dtype=int32), '']