This notebook is available at https://github.com/tardis-sn/tardis/tree/master/docs/io/configuration/components/models/converters/stella_to_tardis.ipynb


STELLA Files to TARDIS

[5]:
from tardis.io.parsers import stella
from astropy import units as u
[2]:
data = stella.read_stella_data('mesa.stella.dat')
[3]:
data
[3]:
mass_of_cell cell_center_m cell_center_R cell_center_v avg_density radiation_pressure avg_temperature radiation_temperature avg_opacity tau ... cr48 cr60 fe52 fe54 fe56 co56 ni56 luminosity n_bar n_e
1 6.006769e+29 5.190243e+33 2.517209e+13 3.930633e+06 1.005529e-11 11237.954506 45943.453023 45943.453023 0.162712 5403.504881 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079500e-03 7.648868e+38 6.055413e+12 2.412188e+12
2 1.262406e+30 5.191506e+33 2.970626e+13 5.050403e+06 2.928088e-11 11236.544022 45942.182229 45942.182229 0.164412 5381.678444 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079500e-03 9.609214e+38 1.762304e+13 6.969790e+12
3 1.264624e+30 5.192771e+33 3.198879e+13 5.680288e+06 4.619659e-11 11133.526767 45836.518142 45836.518142 0.165012 5364.280084 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079500e-03 1.050921e+39 2.783916e+13 1.091728e+13
4 1.263067e+30 5.194034e+33 3.357130e+13 6.135230e+06 5.896887e-11 11133.526767 45836.518142 45836.518142 0.165310 5348.854704 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079500e-03 1.100921e+39 3.545183e+13 1.392188e+13
5 1.259387e+30 5.195293e+33 3.480638e+13 6.495173e+06 6.912717e-11 11032.838720 45732.362031 45732.362031 0.165510 5334.724893 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079500e-03 1.140921e+39 4.166219e+13 1.632649e+13
6 1.258091e+30 5.196550e+33 3.583450e+13 6.805058e+06 7.774308e-11 11031.453980 45731.097076 45731.097076 0.165709 5321.480960 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079500e-03 1.180921e+39 4.687026e+13 1.832995e+13
7 1.256430e+30 5.197807e+33 3.672346e+13 7.075000e+06 8.524104e-11 11031.453980 45731.097076 45731.097076 0.165809 5308.917604 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079500e-03 1.210921e+39 5.127832e+13 2.013225e+13
8 1.253971e+30 5.199061e+33 3.751183e+13 7.310000e+06 9.155072e-11 11031.453980 45731.097076 45731.097076 0.165820 5296.950388 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079500e-03 1.240806e+39 5.518408e+13 2.153570e+13
9 1.253773e+30 5.200314e+33 3.822537e+13 7.520000e+06 9.719899e-11 10930.317002 45625.918471 45625.918471 0.165936 5285.442617 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079500e-03 1.260806e+39 5.848984e+13 2.283801e+13
10 1.252728e+30 5.201567e+33 3.888202e+13 7.715000e+06 1.017798e-10 10930.317002 45625.918471 45625.918471 0.166444 5274.319278 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079380e-03 1.290806e+39 6.129444e+13 2.403916e+13
11 1.251315e+30 5.202818e+33 3.949364e+13 7.899942e+06 1.056026e-10 10930.317002 45625.918471 45625.918471 0.167443 5263.504963 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079205e-03 1.310806e+39 6.359790e+13 2.504031e+13
12 1.248465e+30 5.204067e+33 4.006494e+13 8.069885e+06 1.095625e-10 10930.317002 45625.918471 45625.918471 0.168344 5252.968552 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079205e-03 1.330806e+39 6.600135e+13 2.594261e+13
13 1.243739e+30 5.205311e+33 4.060165e+13 8.224885e+06 1.128950e-10 10830.107253 45520.981771 45520.981771 0.169143 5242.720455 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079205e-03 1.350806e+39 6.810366e+13 2.674377e+13
14 1.243959e+30 5.206554e+33 4.111083e+13 8.374827e+06 1.160579e-10 10830.107253 45520.981771 45520.981771 0.169941 5232.678533 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079205e-03 1.380691e+39 6.990711e+13 2.744492e+13
15 1.245057e+30 5.207799e+33 4.159658e+13 8.514827e+06 1.190315e-10 10830.107253 45520.981771 45520.981771 0.170541 5222.818389 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079205e-03 1.400691e+39 7.160942e+13 2.814492e+13
16 1.231934e+30 5.209033e+33 4.205671e+13 8.644827e+06 1.215239e-10 10830.107253 45520.981771 45520.981771 0.171141 5213.249350 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079205e-03 1.420806e+39 7.311172e+13 2.864722e+13
17 1.216115e+30 5.210248e+33 4.249330e+13 8.769770e+06 1.237832e-10 10730.816233 45416.286418 45416.286418 0.172941 5203.903812 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079205e-03 1.440806e+39 7.451402e+13 2.924722e+13
18 1.218289e+30 5.211465e+33 4.291475e+13 8.889770e+06 1.257945e-10 10730.816233 45416.286418 45416.286418 0.173441 5194.709058 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079205e-03 1.470691e+39 7.571633e+13 2.974837e+13
19 1.220635e+30 5.212687e+33 4.332273e+13 9.009712e+06 1.275483e-10 10730.816233 45416.286418 45416.286418 0.173841 5185.663371 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079205e-03 1.490691e+39 7.691748e+13 3.014953e+13
20 1.218599e+30 5.213906e+33 4.371717e+13 9.119712e+06 1.293227e-10 10730.816233 45416.286418 45416.286418 0.174240 5176.775982 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079205e-03 1.510691e+39 7.791978e+13 3.054953e+13
21 1.218527e+30 5.215123e+33 4.409991e+13 9.224712e+06 1.311178e-10 10730.816233 45416.286418 45416.286418 0.174541 5168.017132 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079205e-03 1.530691e+39 7.891978e+13 3.094953e+13
22 1.216195e+30 5.216341e+33 4.447132e+13 9.329654e+06 1.323350e-10 10632.435519 45311.831858 45311.831858 0.174840 5159.424248 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079205e-03 1.560576e+39 7.982093e+13 3.125068e+13
23 1.213956e+30 5.217554e+33 4.483239e+13 9.429654e+06 1.338634e-10 10632.435519 45311.831858 45311.831858 0.175140 5150.959409 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079205e-03 1.580691e+39 8.062209e+13 3.155183e+13
24 1.214388e+30 5.218768e+33 4.518466e+13 9.524654e+06 1.351020e-10 10632.435519 45311.831858 45311.831858 0.175440 5142.610227 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079205e-03 1.600691e+39 8.132324e+13 3.185183e+13
25 1.212675e+30 5.219981e+33 4.552823e+13 9.619654e+06 1.360385e-10 10632.435519 45311.831858 45311.831858 0.175640 5134.401425 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079205e-03 1.630576e+39 8.202439e+13 3.215183e+13
26 1.210647e+30 5.221192e+33 4.586395e+13 9.714654e+06 1.369815e-10 10632.435519 45311.831858 45311.831858 0.175839 5126.315470 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.079156e-03 1.650576e+39 8.252554e+13 3.235183e+13
27 1.209411e+30 5.222402e+33 4.619471e+13 9.799654e+06 1.369815e-10 10631.113103 45310.581383 45310.581383 0.175839 5118.349189 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.078789e-03 1.670691e+39 8.242554e+13 3.255183e+13
28 1.204720e+30 5.223605e+33 4.651757e+13 9.884654e+06 1.379268e-10 10534.956764 45207.617536 45207.617536 0.175940 5110.514635 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.078789e-03 1.690691e+39 8.292669e+13 3.275183e+13
29 1.203253e+30 5.224809e+33 4.683392e+13 9.969654e+06 1.385676e-10 10534.956764 45207.617536 45207.617536 0.176139 5102.793922 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.078789e-03 1.720576e+39 8.342669e+13 3.285298e+13
30 1.204574e+30 5.226014e+33 4.714483e+13 1.005460e+07 1.392072e-10 10534.956764 45207.617536 45207.617536 0.176240 5095.166450 ... 0.0 0.0 0.0 0.0 0.000021 0.0 4.078789e-03 1.740576e+39 8.382669e+13 3.305298e+13
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
370 1.503278e+31 2.573607e+34 1.104475e+15 2.429600e+08 9.175628e-14 0.300826 3954.619710 3304.761442 0.000273 0.007314 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.769424e+41 5.528062e+10 1.237947e+07
371 1.503744e+31 2.575109e+34 1.115499e+15 2.454950e+08 8.803103e-14 0.295301 3936.449883 3289.487890 0.000275 0.007047 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.769424e+41 5.307717e+10 1.117371e+07
372 1.504194e+31 2.576615e+34 1.126760e+15 2.480850e+08 8.464919e-14 0.287253 3918.469727 3266.843215 0.000278 0.006782 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.769424e+41 5.097371e+10 1.016680e+07
373 1.504628e+31 2.578119e+34 1.138255e+15 2.507250e+08 8.121491e-14 0.279425 3900.465994 3244.354424 0.000281 0.006520 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.769424e+41 4.887141e+10 9.161043e+06
374 1.505049e+31 2.579624e+34 1.149979e+15 2.534200e+08 7.809493e-14 0.269286 3864.706307 3214.522692 0.000282 0.006262 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.759539e+41 4.696911e+10 7.638489e+06
375 1.505456e+31 2.581128e+34 1.161939e+15 2.561650e+08 7.492656e-14 0.264341 3846.949594 3199.666590 0.000284 0.006008 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.759539e+41 4.516565e+10 6.863536e+06
376 1.505850e+31 2.582634e+34 1.174137e+15 2.589650e+08 7.204815e-14 0.257137 3829.170696 3177.640241 0.000287 0.005755 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.759539e+41 4.336335e+10 6.169275e+06
377 1.506231e+31 2.584142e+34 1.186582e+15 2.618250e+08 6.912510e-14 0.250129 3811.577254 3155.765519 0.000290 0.005506 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.759539e+41 4.165989e+10 5.535128e+06
378 1.506601e+31 2.585648e+34 1.199285e+15 2.647400e+08 6.631867e-14 0.243340 3794.064648 3134.126315 0.000293 0.005259 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.759539e+41 3.995759e+10 4.971328e+06
379 1.506960e+31 2.587156e+34 1.212262e+15 2.677200e+08 6.362427e-14 0.236709 3768.048602 3112.551141 0.000296 0.005015 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.759539e+41 3.825528e+10 4.457872e+06
380 1.507308e+31 2.588661e+34 1.225533e+15 2.707700e+08 6.090078e-14 0.230258 3750.735991 3091.124490 0.000299 0.004773 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.759539e+41 3.665298e+10 3.994763e+06
381 1.507645e+31 2.590169e+34 1.239120e+15 2.738900e+08 5.816152e-14 0.223982 3733.502925 3069.845338 0.000302 0.004534 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.759424e+41 3.505068e+10 3.581883e+06
382 1.507973e+31 2.591677e+34 1.253046e+15 2.770850e+08 5.554217e-14 0.219869 3707.801671 3055.657872 0.000306 0.004298 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.759424e+41 3.344837e+10 3.209349e+06
383 1.508291e+31 2.593187e+34 1.267340e+15 2.803650e+08 5.292036e-14 0.211916 3682.277344 3027.643432 0.000309 0.004064 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.749539e+41 3.184607e+10 2.765894e+06
384 1.508601e+31 2.594695e+34 1.282036e+15 2.837450e+08 5.030635e-14 0.206141 3656.928725 3006.801281 0.000312 0.003833 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.749539e+41 3.024492e+10 2.463821e+06
385 1.508902e+31 2.596204e+34 1.297177e+15 2.872300e+08 4.771147e-14 0.200523 3640.028019 2986.102607 0.000316 0.003605 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.749539e+41 2.874146e+10 2.201978e+06
386 1.509194e+31 2.597712e+34 1.312826e+15 2.908350e+08 4.504388e-14 0.195058 3615.068208 2965.546421 0.000321 0.003379 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.749539e+41 2.713916e+10 1.960251e+06
387 1.509479e+31 2.599222e+34 1.329057e+15 2.945800e+08 4.242636e-14 0.189742 3590.182254 2945.131743 0.000326 0.003154 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.749539e+41 2.553686e+10 1.738753e+06
388 1.509756e+31 2.600732e+34 1.345972e+15 2.984900e+08 3.968586e-14 0.184571 3565.467613 2924.857599 0.000332 0.002932 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.749539e+41 2.393455e+10 1.537486e+06
389 1.510025e+31 2.602242e+34 1.363690e+15 3.025900e+08 3.695182e-14 0.177895 3540.923106 2898.042343 0.000338 0.002710 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.739654e+41 2.223225e+10 1.366104e+06
390 1.510288e+31 2.603751e+34 1.382340e+15 3.069150e+08 3.416928e-14 0.173047 3508.555024 2878.092360 0.000345 0.002490 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.739654e+41 2.062995e+10 1.205068e+06
391 1.510544e+31 2.605263e+34 1.402096e+15 3.115150e+08 3.137876e-14 0.166788 3468.392927 2851.705850 0.000352 0.002272 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.739654e+41 1.892764e+10 1.033916e+06
392 1.510793e+31 2.606773e+34 1.423208e+15 3.164600e+08 2.855110e-14 0.160755 3436.594510 2825.561254 0.000361 0.002054 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.739539e+41 1.722419e+10 9.080521e+05
393 1.511037e+31 2.608285e+34 1.446057e+15 3.218649e+08 2.556441e-14 0.154940 3405.087622 2799.656353 0.000372 0.001837 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.739539e+41 1.542188e+10 7.863841e+05
394 1.511274e+31 2.609797e+34 1.471245e+15 3.279099e+08 2.242001e-14 0.149336 3366.109906 2773.988949 0.000386 0.001619 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.729654e+41 1.351958e+10 6.707967e+05
395 1.511505e+31 2.611308e+34 1.499835e+15 3.349250e+08 1.908195e-14 0.143918 3319.925147 2748.482551 0.000405 0.001398 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.729654e+41 1.151612e+10 5.573015e+05
396 1.511731e+31 2.612818e+34 1.533756e+15 3.435050e+08 1.540408e-14 0.136196 3259.329684 2710.845252 0.000430 0.001173 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.729654e+41 9.283015e+09 4.408753e+05
397 1.511951e+31 2.614332e+34 1.576303e+15 3.545750e+08 1.168519e-14 0.128874 3192.480784 2673.651060 0.000467 0.000941 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.719770e+41 7.040251e+09 3.305759e+05
398 1.512167e+31 2.615844e+34 1.632356e+15 3.682800e+08 8.348776e-15 0.119719 3126.918024 2624.851429 0.000525 0.000695 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.719654e+41 5.027256e+09 2.333801e+05
399 1.512377e+31 2.617356e+34 1.698066e+15 4.244850e+08 6.601396e-15 0.110183 3055.657872 2570.946173 0.000569 0.000448 ... 0.0 0.0 0.0 0.0 0.000017 0.0 1.108306e-14 3.709770e+41 3.975759e+09 1.842764e+05

399 rows × 36 columns

[6]:
# extract outer radius boundaries
radius = data.loc[:,'outer_edge_r'].values * u.cm

# calculate t_expl_s
t_expl = 50 * u.day #days

# calculate outer velocities of each zone assuming homologous expansion (d =v*t)

vel = (radius/t_expl).to(u.km/u.s)

# create a new column of our velocities (OPTIONAL)
data['velocity'] = vel
[7]:
density_dat = data[['velocity', 'avg_density']].reset_index(drop=True)
density_dat.to_csv('density_parse.csv', sep = ' ')
[8]:
# import all elements and isotopes and export to TARDIS

data_elements = data.iloc[12:33].reset_index(drop=True)
abund = data_elements.to_csv('abund_parse.csv', sep = ' ')