Processing Single Stars with POSYDON

This tutorial shows you how to process the single stellar models into a PSyGrid object.

WARNING: Unfortunatly, the software to resample the raw MESA histories into equivalent evolutionary points (EEPs) is not available in POSYDON yet, but we are using the standalone Fortran code of Aaron Dotter, see http://adsabs.harvard.edu/abs/2016ApJS..222….8D . This tutorial will be updated as soon as they are available.

If you are a POSYDON developer, then you should know that you can find the EEP code we used to export the v2.0.0 single star grids on Yggdrasil HPC in /srv/beegfs/scratch/shares/astro/posydon/POSYDON_GRIDS_v2/single_HMS/eep_code.

The steps are the following: 1. You should create a work directory, say eeps where you will create two directories grid_name where you will copy the raw MESA history files from all your MESA single stellar models and eeps_grid_name where the code will export the resample EEP histories. 2. You should create a input.grid_name file in the eep_code directory that will run the EEP code to resample the histories.

Generating the EEP history files

The following cell shows you how to copy the histories in ./eeps/grid where we use the 10 single HMS models we run in the step 3 tutorial (step 1).

[3]:
import numpy as np
import csv
import os
import shutil

grid_name = 'single_hms_1e-01_Zsun'
dirs = [ d for d in os.listdir('../'+grid_name) if 'initial_mass' in d]
missing = []
print(len(dirs))
for i in range(len(dirs)):
    filename = '../'+grid_name+'/'+dirs[i]+'/LOGS1/history.data'
    if os.path.exists(filename):
        shutil.copy(filename,'./eeps/'+grid_name+'/'+dirs[i]+'.data')
        print(dirs[i]+'.data')
    else:
        missing += [filename]
if len(missing)>0:
    print(len(dirs)-len(missing))
    for f in missing:
        print(f)
10
Zbase_0.0014_initial_mass_26.4098_initial_z_1.4200e-03_grid_index_5.data
Zbase_0.0014_initial_mass_9.7294_initial_z_1.4200e-03_grid_index_2.data
Zbase_0.0014_initial_mass_13.5721_initial_z_1.4200e-03_grid_index_3.data
Zbase_0.0014_initial_mass_71.6871_initial_z_1.4200e-03_grid_index_8.data
Zbase_0.0014_initial_mass_18.9324_initial_z_1.4200e-03_grid_index_4.data
Zbase_0.0014_initial_mass_36.8403_initial_z_1.4200e-03_grid_index_6.data
Zbase_0.0014_initial_mass_5.0000_initial_z_1.4200e-03_grid_index_0.data
Zbase_0.0014_initial_mass_51.3904_initial_z_1.4200e-03_grid_index_7.data
Zbase_0.0014_initial_mass_100.0000_initial_z_1.4200e-03_grid_index_9.data
Zbase_0.0014_initial_mass_6.9748_initial_z_1.4200e-03_grid_index_1.data

Copy the above list of file names in the input file below.

[5]:
%%writefile input.single_hms_1e-01_Zsun
#version string, max 8 characters
POSYDON
#initial Y,      initial Z,       [Fe/H], [alpha/Fe], v/vcrit
0.2703              0.0142           -1.0         0.0      0.0
#data directories: 1) history files, 2) eeps, 3) isochrones
/srv/beegfs/scratch/shares/astro/posydon/simone/documentation/running_mesa/processing_single_hms/eeps/single_hms_1e-01_Zsun
/srv/beegfs/scratch/shares/astro/posydon/simone/documentation/running_mesa/processing_single_hms/eeps/eeps_single_hms_1e-01_Zsun
/dev/null
# read history_columns
/srv/beegfs/scratch/shares/astro/posydon/POSYDON_GRIDS_v2/single_HMS/eep_code/posydon_history_columns.list
#tracks 10
10
Zbase_0.0014_initial_mass_26.4098_initial_z_1.4200e-03_grid_index_5.data
Zbase_0.0014_initial_mass_9.7294_initial_z_1.4200e-03_grid_index_2.data
Zbase_0.0014_initial_mass_13.5721_initial_z_1.4200e-03_grid_index_3.data
Zbase_0.0014_initial_mass_71.6871_initial_z_1.4200e-03_grid_index_8.data
Zbase_0.0014_initial_mass_18.9324_initial_z_1.4200e-03_grid_index_4.data
Zbase_0.0014_initial_mass_36.8403_initial_z_1.4200e-03_grid_index_6.data
Zbase_0.0014_initial_mass_5.0000_initial_z_1.4200e-03_grid_index_0.data
Zbase_0.0014_initial_mass_51.3904_initial_z_1.4200e-03_grid_index_7.data
Zbase_0.0014_initial_mass_100.0000_initial_z_1.4200e-03_grid_index_9.data
Zbase_0.0014_initial_mass_6.9748_initial_z_1.4200e-03_grid_index_1.data
Writing input.single_hms_1e-01_Zsun

Now run the eep code as follows.

[12]:
!cd /srv/beegfs/scratch/shares/astro/posydon/POSYDON_GRIDS_v2/single_HMS/eep_code/ && ./make_eep /srv/beegfs/scratch/shares/astro/posydon/simone/documentation/running_mesa/processing_single_hms/input.single_hms_1e-01_Zsun
    1    1                      surface_mu   10
    1    2                        star_age    8
    1    3                       star_mass    9
    1    4                       star_mdot    9
    1    5                    log_abs_mdot   12
    1    6                          log_dt    6
    1    7      log_total_angular_momentum   26
    1    8                  mass_conv_core   14
    1    9                    conv_mx1_top   12
    1   10                    conv_mx1_bot   12
    1   11                    conv_mx2_top   12
    1   12                    conv_mx2_bot   12
    1   13                  conv_mx1_top_r   14
    1   14                  conv_mx1_bot_r   14
    1   15                  conv_mx2_top_r   14
    1   16                  conv_mx2_bot_r   14
    1   17                    he_core_mass   12
    1   18                  he_core_radius   14
    1   19                     c_core_mass   11
    1   20                   c_core_radius   13
    1   21                     o_core_mass   11
    1   22                   o_core_radius   13
    1   23                   envelope_mass   13
    1   24                          log_LH    6
    1   25                         log_LHe    7
    1   26                          log_LZ    6
    1   27                        log_Lnuc    8
    1   28                        log_Lneu    8
    1   29                   log_abs_Lgrav   13
    1   30                        log_Teff    8
    1   31                   photosphere_r   13
    1   32        photosphere_cell_density   24
    1   33                           log_L    5
    1   34                           log_R    5
    1   35                           log_g    5
    1   36                  log_L_div_Ledd   14
    1   37                  surf_avg_j_rot   14
    1   38                  surf_avg_omega   14
    1   39             surf_avg_omega_crit   19
    1   40   surf_avg_omega_div_omega_crit   29
    1   41                  surf_avg_v_rot   14
    1   42                 surf_avg_v_crit   15
    1   43          surf_avg_Lrad_div_Ledd   22
    1   44           rotational_mdot_boost   21
    1   45   surf_r_equatorial_div_r_polar   29
    1   46         surf_r_equatorial_div_r   23
    1   47              surf_r_polar_div_r   18
    1   48                    log_center_T   12
    1   49                  log_center_Rho   14
    1   50                    log_center_P   12
    1   51               center_degeneracy   17
    1   52                    center_gamma   12
    1   53                       center_mu    9
    1   54                       center_ye    9
    1   55                    center_omega   12
    1   56                       center_h1    9
    1   57                      center_he3   10
    1   58                      center_he4   10
    1   59                      center_c12   10
    1   60                      center_n14   10
    1   61                      center_o16   10
    1   62                     center_ne20   11
    1   63                     center_si28   11
    1   64                      center_s32   10
    1   65                     center_ca40   11
    1   66                     center_ti44   11
    1   67                     center_fe56   11
    1   68                      surface_h1   10
    1   69                     surface_he3   11
    1   70                     surface_he4   11
    1   71                     surface_c12   11
    1   72                     surface_n14   11
    1   73                     surface_o16   11
    1   74                    surface_ne20   12
    1   75                    surface_si28   12
    1   76                     surface_s32   11
    1   77                    surface_ca40   12
    1   78                    surface_ti44   12
    1   79                    surface_fe56   12
    1   80                   total_mass_h1   13
    1   81                  total_mass_he4   14
    1   82                              pp    2
    1   83                             cno    3
    1   84                        tri_alfa    8
    1   85                          burn_c    6
    1   86                          burn_n    6
    1   87                          burn_o    6
    1   88                         burn_ne    7
    1   89                         c12_c12    7
    1   90                        delta_nu    8
    1   91                        delta_Pg    8
    1   92                          nu_max    6
    1   93                 acoustic_cutoff   15
    1   94               v_div_csound_surf   17
    1   95                       e_thermal    9
    1   96         max_conv_vel_div_csound   23
    1   97             max_gradT_div_grada   19
    1   98              surf_c12_minus_o16   18
    1   99                  min_Pgas_div_P   14
    1  100           total_internal_energy   21
    1  101      total_gravitational_energy   26
    1  102     total_radial_kinetic_energy   27
    1  103 total_rotational_kinetic_energy   31
    1  104                    total_energy   12
    1  105                  total_eps_grav   14
    1  106               conv_env_top_mass   17
    1  107               conv_env_bot_mass   17
    1  108             conv_env_top_radius   19
    1  109             conv_env_bot_radius   19
    1  110        conv_env_turnover_time_g   24
    1  111      conv_env_turnover_time_l_b   26
    1  112      conv_env_turnover_time_l_t   26
    1  113         envelope_binding_energy   23
    1  114         total_moment_of_inertia   23
    1  115                  spin_parameter   14
    1  116                 avg_c_in_c_core   15
    1  117          mass_conv_reg_fortides   22
    1  118     thickness_conv_reg_fortides   27
    1  119        radius_conv_reg_fortides   24
    1  120                 lambda_CE_1cent   15
    1  121                lambda_CE_10cent   16
    1  122                lambda_CE_30cent   16
    1  123                    co_core_mass   12
    1  124                  co_core_radius   14
    1  125   lambda_CE_pure_He_star_10cent   29
    1  126              he_core_mass_1cent   18
    1  127             he_core_mass_10cent   19
    1  128             he_core_mass_30cent   19
    1  129            he_core_radius_1cent   20
    1  130           he_core_radius_10cent   21
    1  131           he_core_radius_30cent   21
    2    1                      surface_mu   10
    2    2                        star_age    8
    2    3                       star_mass    9
    2    4                       star_mdot    9
    2    5                    log_abs_mdot   12
    2    6                          log_dt    6
    2    7      log_total_angular_momentum   26
    2    8                  mass_conv_core   14
    2    9                    conv_mx1_top   12
    2   10                    conv_mx1_bot   12
    2   11                    conv_mx2_top   12
    2   12                    conv_mx2_bot   12
    2   13                  conv_mx1_top_r   14
    2   14                  conv_mx1_bot_r   14
    2   15                  conv_mx2_top_r   14
    2   16                  conv_mx2_bot_r   14
    2   17                    he_core_mass   12
    2   18                  he_core_radius   14
    2   19                     c_core_mass   11
    2   20                   c_core_radius   13
    2   21                     o_core_mass   11
    2   22                   o_core_radius   13
    2   23                   envelope_mass   13
    2   24                          log_LH    6
    2   25                         log_LHe    7
    2   26                          log_LZ    6
    2   27                        log_Lnuc    8
    2   28                        log_Lneu    8
    2   29                   log_abs_Lgrav   13
    2   30                        log_Teff    8
    2   31                   photosphere_r   13
    2   32        photosphere_cell_density   24
    2   33                           log_L    5
    2   34                           log_R    5
    2   35                           log_g    5
    2   36                  log_L_div_Ledd   14
    2   37                  surf_avg_j_rot   14
    2   38                  surf_avg_omega   14
    2   39             surf_avg_omega_crit   19
    2   40   surf_avg_omega_div_omega_crit   29
    2   41                  surf_avg_v_rot   14
    2   42                 surf_avg_v_crit   15
    2   43          surf_avg_Lrad_div_Ledd   22
    2   44           rotational_mdot_boost   21
    2   45   surf_r_equatorial_div_r_polar   29
    2   46         surf_r_equatorial_div_r   23
    2   47              surf_r_polar_div_r   18
    2   48                    log_center_T   12
    2   49                  log_center_Rho   14
    2   50                    log_center_P   12
    2   51               center_degeneracy   17
    2   52                    center_gamma   12
    2   53                       center_mu    9
    2   54                       center_ye    9
    2   55                    center_omega   12
    2   56                       center_h1    9
    2   57                      center_he3   10
    2   58                      center_he4   10
    2   59                      center_c12   10
    2   60                      center_n14   10
    2   61                      center_o16   10
    2   62                     center_ne20   11
    2   63                     center_si28   11
    2   64                      center_s32   10
    2   65                     center_ca40   11
    2   66                     center_ti44   11
    2   67                     center_fe56   11
    2   68                      surface_h1   10
    2   69                     surface_he3   11
    2   70                     surface_he4   11
    2   71                     surface_c12   11
    2   72                     surface_n14   11
    2   73                     surface_o16   11
    2   74                    surface_ne20   12
    2   75                    surface_si28   12
    2   76                     surface_s32   11
    2   77                    surface_ca40   12
    2   78                    surface_ti44   12
    2   79                    surface_fe56   12
    2   80                   total_mass_h1   13
    2   81                  total_mass_he4   14
    2   82                              pp    2
    2   83                             cno    3
    2   84                        tri_alfa    8
    2   85                          burn_c    6
    2   86                          burn_n    6
    2   87                          burn_o    6
    2   88                         burn_ne    7
    2   89                         c12_c12    7
    2   90                        delta_nu    8
    2   91                        delta_Pg    8
    2   92                          nu_max    6
    2   93                 acoustic_cutoff   15
    2   94               v_div_csound_surf   17
    2   95                       e_thermal    9
    2   96         max_conv_vel_div_csound   23
    2   97             max_gradT_div_grada   19
    2   98              surf_c12_minus_o16   18
    2   99                  min_Pgas_div_P   14
    2  100           total_internal_energy   21
    2  101      total_gravitational_energy   26
    2  102     total_radial_kinetic_energy   27
    2  103 total_rotational_kinetic_energy   31
    2  104                    total_energy   12
    2  105                  total_eps_grav   14
    2  106               conv_env_top_mass   17
    2  107               conv_env_bot_mass   17
    2  108             conv_env_top_radius   19
    2  109             conv_env_bot_radius   19
    2  110        conv_env_turnover_time_g   24
    2  111      conv_env_turnover_time_l_b   26
    2  112      conv_env_turnover_time_l_t   26
    2  113         envelope_binding_energy   23
    2  114         total_moment_of_inertia   23
    2  115                  spin_parameter   14
    2  116                 avg_c_in_c_core   15
    2  117          mass_conv_reg_fortides   22
    2  118     thickness_conv_reg_fortides   27
    2  119        radius_conv_reg_fortides   24
    2  120                 lambda_CE_1cent   15
    2  121                lambda_CE_10cent   16
    2  122                lambda_CE_30cent   16
    2  123                    co_core_mass   12
    2  124                  co_core_radius   14
    2  125   lambda_CE_pure_He_star_10cent   29
    2  126              he_core_mass_1cent   18
    2  127             he_core_mass_10cent   19
    2  128             he_core_mass_30cent   19
    2  129            he_core_radius_1cent   20
    2  130           he_core_radius_10cent   21
    2  131           he_core_radius_30cent   21
 process_history_columns: ncol =          131
  number of history columns =          131
  star_age column =            2
  star_mass column=            3
     main =           32
     head =           28
     xtra =            1
 Zbase_0.0014_initial_mass_26.4098_initial_z_1.4200e-03_grid_index_5.data   0.0000000000000000            11701
 number of columns:          131
 do not have surface_mu
 do not have photosphere_cell_density
 Zbase_0.0014_initial_mass_26.4098_initial_z_1.4200e-03_grid_index_5.data           9       11701
     guess =          194
  my_guess =          194
    ntrack =         1134
      21     117     193     301     321     920    1134       0       0
  track, number of p, s eeps =            0           7         700
   6277.9927750097913
   5287405.0672792234
   7457780.3353313934
   7469035.5533669619
   7481078.8974012667
   7967779.7210960779
   7973760.0214983337
     main =           32
     head =           28
     xtra =            1
 Zbase_0.0014_initial_mass_9.7294_initial_z_1.4200e-03_grid_index_2.data   26.409758771088889            11701
 number of columns:          131
 do not have surface_mu
 do not have photosphere_cell_density
 Zbase_0.0014_initial_mass_9.7294_initial_z_1.4200e-03_grid_index_2.data           9       11701
     guess =          187
  my_guess =          187
    ntrack =         1199
      15     111     186     286     301     892    1199       0       0
  track, number of p, s eeps =            0           7         700
   24396.344533808904
   21042522.104845978
   28037631.964223422
   28079495.980469674
   28136942.251048498
   29667168.542051919
   29700034.195994429
     main =           32
     head =           28
     xtra =            1
 Zbase_0.0014_initial_mass_13.5721_initial_z_1.4200e-03_grid_index_3.data   9.7294385594764741            11701
 number of columns:          131
 do not have surface_mu
 do not have photosphere_cell_density
 Zbase_0.0014_initial_mass_13.5721_initial_z_1.4200e-03_grid_index_3.data           9       11701
     guess =          196
  my_guess =          196
    ntrack =         1179
      17     112     195     312     327     912    1179       0       0
  track, number of p, s eeps =            0           7         700
   15610.060101129055
   12218224.667538654
   16588094.368652388
   16612520.250515623
   16641397.545344574
   17585086.263796750
   17601144.656836938
     main =           32
     head =           28
     xtra =            1
 Zbase_0.0014_initial_mass_71.6871_initial_z_1.4200e-03_grid_index_8.data   13.572087956491831            11701
 number of columns:          131
 do not have surface_mu
 do not have photosphere_cell_density
 Zbase_0.0014_initial_mass_71.6871_initial_z_1.4200e-03_grid_index_8.data           9       11701
     guess =          219
  my_guess =          219
    ntrack =         1017
      28     126     218     254     262     847    1017       0       0
  track, number of p, s eeps =            0           7         700
   1882.7797692549086
   2433136.2664018041
   3657144.1286053685
   3662905.7394964132
   3666937.2754223552
   3968981.8990034591
   3972461.2129875328
     main =           32
     head =           28
     xtra =            1
 Zbase_0.0014_initial_mass_18.9324_initial_z_1.4200e-03_grid_index_4.data   71.687115078083323            11701
 number of columns:          131
 do not have surface_mu
 do not have photosphere_cell_density
 Zbase_0.0014_initial_mass_18.9324_initial_z_1.4200e-03_grid_index_4.data           9       11701
     guess =          190
  my_guess =          190
    ntrack =         1125
      19     115     189     295     311     907    1125       0       0
  track, number of p, s eeps =            0           7         700
   9921.7595238775411
   7739637.6514137154
   10685722.442352418
   10700524.445156630
   10718291.466290537
   11364471.722192684
   11373601.929193445
     main =           32
     head =           28
     xtra =            1
 Zbase_0.0014_initial_mass_36.8403_initial_z_1.4200e-03_grid_index_6.data   18.932394689168561            11701
 number of columns:          131
 do not have surface_mu
 do not have photosphere_cell_density
 Zbase_0.0014_initial_mass_36.8403_initial_z_1.4200e-03_grid_index_6.data           9       11701
     guess =          193
  my_guess =          193
    ntrack =          986
      23     119     192     222     229     854     986       0       0
  track, number of p, s eeps =            0           7         700
   3960.2690882564220
   3851575.8069463656
   5582710.4292462571
   5588591.1389014870
   5589612.3684672052
   5991126.2522320682
   5995772.7040485023
     main =           32
     head =           28
     xtra =            1
 Zbase_0.0014_initial_mass_5.0000_initial_z_1.4200e-03_grid_index_0.data   36.840313846957606            11701
 number of columns:          131
 do not have surface_mu
 do not have photosphere_cell_density
 Zbase_0.0014_initial_mass_5.0000_initial_z_1.4200e-03_grid_index_0.data           9       11701
     guess =          181
  my_guess =          181
    ntrack =         3913
      13     108     180     269     290     888    1020    3681    3913
  track, number of p, s eeps =            0           9         900
   86753.360233281302
   64319463.355284028
   86185376.573872104
   86633375.415914938
   87099149.826188803
   96055736.197538793
   96465309.995612055
   96499955.970155716
   96512030.582908586
     main =           32
     head =           28
     xtra =            1
 Zbase_0.0014_initial_mass_51.3904_initial_z_1.4200e-03_grid_index_7.data   4.9999999804196547            11701
 number of columns:          131
 do not have surface_mu
 do not have photosphere_cell_density
 Zbase_0.0014_initial_mass_51.3904_initial_z_1.4200e-03_grid_index_7.data           9       11701
     guess =          212
  my_guess =          212
    ntrack =          985
      26     123     211     231     306     912     985       0       0
  track, number of p, s eeps =            0           7         700
   2996.8596073236631
   3010166.5713262074
   4416981.4144611228
   4418486.3517615385
   4425592.2093049819
   4768141.7818553476
   4772090.7663751869
     main =           32
     head =           28
     xtra =            1
 Zbase_0.0014_initial_mass_100.0000_initial_z_1.4200e-03_grid_index_9.data   51.390425259010733            11701
 number of columns:          131
 do not have surface_mu
 do not have photosphere_cell_density
 Zbase_0.0014_initial_mass_100.0000_initial_z_1.4200e-03_grid_index_9.data           9       11701
     guess =          218
  my_guess =          218
    ntrack =          975
       1     113     217     219     234     806     975       0       0
  track, number of p, s eeps =            0           7         700
   100.00000000000000
   2056224.0174175713
   3136810.0982837169
   3138943.4469665275
   3145922.3057053299
   3420158.4876993480
   3423291.9848860670
     main =           32
     head =           28
     xtra =            1
 Zbase_0.0014_initial_mass_6.9748_initial_z_1.4200e-03_grid_index_1.data   99.999899139008136            11701
 number of columns:          131
 do not have surface_mu
 do not have photosphere_cell_density
 Zbase_0.0014_initial_mass_6.9748_initial_z_1.4200e-03_grid_index_1.data           9       11701
     guess =          186
  my_guess =          186
    ntrack =         1209
      14     109     185     286     302     893    1209       0       0
  track, number of p, s eeps =            0           7         700
   46075.447975750540
   37892525.232744850
   50239784.193855718
   50340442.508530043
   50473179.666073054
   53361156.397665329
   53451365.900661089

Great! Now that we have the EEPs files we can create the PSyGrid object and compute the processed quantities with the following code.

[15]:
# NOTE: to load slurm_magic commands you need to first install them with pip install git+https://github.com/NERSC/slurm-magic.git
%load_ext slurm_magic
[17]:
!pwd
/srv/beegfs/scratch/shares/astro/posydon/simone/documentation/running_mesa/processing_single_hms

Creating the PSyGrid Object and Computing the Processed Quantities

[25]:
%%writefile ./script.py
import os
import sys
from shutil import copyfile
from posydon.grids.psygrid import PSyGrid
from posydon.grids.post_processing import post_process_grid, add_post_processed_quantities

if __name__ == "__main__":

    i = int(sys.argv[1])
    print('Job array index:',i)
    names = ['single_hms_1e-01_Zsun']
    name = names[i]
    inpath = "../%s/"%name
    eep_path = "./eeps/eeps_%s/"%name
    outpath = "./"
    grid_name = "%s.h5"%name

    grid = PSyGrid(verbose=False)
    grid.create(inpath, outpath+grid_name, binary=False, overwrite=True, compression="gzip9", max_number_of_runs=None, eep=eep_path,
               **{'star1_history_saved_columns' : ['star_mdot','conv_mx1_top_r', 'conv_mx1_bot_r','mass_conv_reg_fortides',
                                                   'thickness_conv_reg_fortides', 'radius_conv_reg_fortides', 'surface_he3',
                                                   #'photosphere_cell_density', 'surface_mu'
                                                  ]})
    grid.close()
    print('Done creating grid!')

    path = outpath
    grid_name_processed = 'processed_'+grid_name
    # copy file, it will be overwritten when we add columns
    if os.path.exists(path+grid_name_processed):
        print('Post processed grid file alredy exist, removing it...')
        os.remove(path+grid_name_processed)
    copyfile(path+grid_name, path+grid_name_processed)

    grid = PSyGrid()
    grid.load(path+grid_name_processed)
    MESA_dirs_EXTRA_COLUMNS, EXTRA_COLUMNS = post_process_grid(grid, index=None, star_2_CO=False, single_star=True, verbose=False)
    add_post_processed_quantities(grid, MESA_dirs_EXTRA_COLUMNS, EXTRA_COLUMNS, verbose=False)
    grid.close()
    del MESA_dirs_EXTRA_COLUMNS
    del EXTRA_COLUMNS
    print('Done appending columns!')
Overwriting ./script.py

Run the job array, in this case we only have one grid, so the array will go from index 0 to 0.

[26]:
%%sbatch
#!/bin/bash
#SBATCH --account=meynet
#SBATCH --partition=private-astro-cpu
#SBATCH -N 1
#SBATCH --array=0-0
#SBATCH --cpus-per-task 1
#SBATCH --ntasks-per-node 1
#SBATCH --time=06:00:00
#SBATCH --job-name="psygrid_\${SLURM_ARRAY_TASK_ID}"
#SBATCH --output=./log.out
#SBATCH --mail-type=ALL
#SBATCH --mail-user=simone.bavera@unige.ch
#SBATCH --mem-per-cpu=8G

srun python ./script.py $SLURM_ARRAY_TASK_ID
[26]:
'Submitted batch job 28474201\n'
[28]:
!squeue -u bavera -j 28474201
             JOBID PARTITION     NAME     USER ST       TIME  NODES NODELIST(REASON)
        28474201_0 private-a psygrid_   bavera  R       0:04      1 cpu147

Once the job is done we can check that the grid has been created and that the data are contained in the PSyGrid object:

Exploring the PSyGrid obejct

[32]:
from posydon.grids.psygrid import PSyGrid

grid = PSyGrid('./processed_single_hms_1e-01_Zsun.h5')
grid.load()
[35]:
grid.initial_values
#grid.final_values
[35]:
array([( 6277.99277501,  26.4097595 , 0., 0., 0., 0., 0., 0., 0.74661422, 0.25194858, 4.37299425e-06, 0.00052925, 0.00041712, 0.74748, 0.25107328, 0.00025117, 7.35752498e-05, 0.00060884, -71.17175117, 0.01046428, 0., 0., 0., 4.95159897, -23.39844565,  1.49499256, 4.95175071, 4.63860306, 4.93996484, 0.71603514, 7.64091423, 0.80568409, 6.59702886e+56, 0., -99.,  0.        ,  0.        , 0.        , 0.        ,  0.00000000e+00,  0.e+00,  0.e+00, -2.76560315e+50, 0.00000000e+00, 0.        , 0.        , 1.83454693, 1.83454693, 1.83454693, 0., 0., 1.83454693, -0.47392652, -2.74056706e-08, 1.82720354, 0.00768976, 2.67220936e-05, 0.74748, 0.2511, 0.00142),
       (24396.34453381,   9.72943859, 0., 0., 0., 0., 0., 0., 0.74674423, 0.25181197, 3.20475486e-06, 0.00048611, 0.00046799, 0.74748, 0.25107328, 0.00025117, 7.35752498e-05, 0.00060884, -77.4560927 , 0.01688819, 0., 0., 0., 3.775321  , -26.64516867,  0.31740152, 3.77547228, 4.47302913, 3.75932537, 0.45686326, 7.56813577, 1.21103236, 6.61911701e+55, 0., -99.,  9.72943487,  9.72943487, 2.86147412, 2.85865442, -1.00000000e+99, -1.e+99, -1.e+99, -8.16891431e+49, 3.24145284e-10, 0.0028197 , 2.86006427, 1.5298747 , 1.5298747 , 1.5298747 , 0., 0., 1.5298747 , -0.76841313, -1.26697530e-10, 0.76372292, 0.00403775, 2.67220936e-05, 0.74748, 0.2511, 0.00142),
       (15610.06010113,  13.57208808, 0., 0., 0., 0., 0., 0., 0.74663148, 0.25192828, 3.64972826e-06, 0.00050979, 0.00044032, 0.74748, 0.25107328, 0.00025117, 7.35752498e-05, 0.00060884, -75.14930055, 0.01414088, 0., 0., 0., 4.19391627, -25.44798894,  0.73873336, 4.19406851, 4.53347181, 4.18011152, 0.54637099, 7.59450858, 1.05877441, 1.45734769e+56, 0., -99., 13.57206965, 13.57206965, 3.51730941, 3.51503286, -1.00000000e+99, -1.e+99, -1.e+99, -1.23079422e+50, 2.49233206e-10, 0.00227656, 3.51617113, 1.60828807, 1.60828807, 1.60828807, 0., 0., 1.60828807, -0.65191396, -1.04325683e-09, 1.02329832, 0.00507219, 2.67220936e-05, 0.74748, 0.2511, 0.00142),
       ( 1882.77976925,  71.68711644, 0., 0., 0., 0., 0., 0., 0.74667952, 0.25188536, 5.20460986e-06, 0.00054179, 0.00040168, 0.74748, 0.25107328, 0.00025117, 7.35752498e-05, 0.00060884, -66.78075539, 0.00747133, 0., 0., 0., 5.86040847, -21.18461477,  2.39959949, 5.86055875, 4.74585427, 5.85082109, 0.95696085, 7.69323666, 0.52375113, 5.60217239e+57, 0., -99., 71.68602562, 71.68602562, 9.0565095 , 9.05126109,  3.41948936e+06, -1.e+99, -1.e+99, -8.77155713e+50, 3.17655845e-07, 0.04622897, 8.98425941, 2.44823508, 2.44823508, 2.44823508, 0., 0., 2.44823508, -0.23839679, -5.65977861e-07, 4.11840915, 0.01332546, 2.67220936e-05, 0.74748, 0.2511, 0.00142),
       ( 9921.75952388,  18.93239505, 0., 0., 0., 0., 0., 0., 0.74658466, 0.25197744, 4.05224469e-06, 0.00052508, 0.00042232, 0.74748, 0.25107328, 0.00025117, 7.35752498e-05, 0.00060884, -73.05771606, 0.01205748, 0., 0., 0., 4.58707384, -24.37010752,  1.13188125, 4.58722608, 4.5888982 , 4.57463157, 0.63277821, 7.61874639, 0.92380579, 3.13684410e+56, 0., -99.,  0.        ,  0.        , 0.        , 0.        ,  0.00000000e+00,  0.e+00,  0.e+00, -1.84962365e+50, 0.00000000e+00, 0.        , 0.        , 1.70719514, 1.70719514, 1.70719514, 0., 0., 1.70719514, -0.56236179, -6.20912789e-09, 1.37085165, 0.00628566, 2.67220936e-05, 0.74748, 0.2511, 0.00142),
       ( 3960.26908826,  36.84031499, 0., 0., 0., 0., 0., 0., 0.74664292, 0.25192042, 4.66416978e-06, 0.00053234, 0.0004132 , 0.74748, 0.25107328, 0.00025117, 7.35752498e-05, 0.00060884, -69.51212551, 0.00923022, 0., 0., 0., 5.28402131, -22.55235342,  1.82580547, 5.28417249, 4.68138886, 5.27328834, 0.79712528, 7.66064093, 0.70138647, 1.36277262e+57, 0., -99.,  0.        ,  0.        , 0.        , 0.        ,  0.00000000e+00,  0.e+00,  0.e+00, -4.10055250e+50, 0.00000000e+00, 0.        , 0.        , 1.99792468, 1.99792468, 1.99792468, 0., 0., 1.99792468, -0.38865155, -9.20733750e-08, 2.41769015, 0.00930852, 2.67220936e-05, 0.74748, 0.2511, 0.00142),
       (86753.36023328,   5.        , 0., 0., 0., 0., 0., 0., 0.7466874 , 0.25186564, 2.50626676e-06, 0.00046705, 0.0004907 , 0.74748, 0.25107328, 0.00025117, 7.35752498e-05, 0.00060884, -82.96464122, 0.02522663, 0., 0., 0., 2.86412353, -29.64322718, -0.62787222, 2.8642634 , 4.33588796, 2.84606574, 0.27451579, 7.50579968, 1.54682129, 1.31885098e+55, 0., -99.,  4.99999777,  4.99999777, 1.87849103, 1.8762103 , -1.00000000e+99, -1.e+99, -1.e+99, -3.56658133e+49, 2.90680305e-10, 0.00228073, 1.87735066, 1.40732829, 1.40732829, 1.40732829, 0., 0., 1.40732829, -1.18564104, -2.00383522e-11, 0.43011231, 0.00249988, 2.67220936e-05, 0.74748, 0.2511, 0.00142),
       ( 2996.85960732,  51.39042664, 0., 0., 0., 0., 0., 0., 0.74665424, 0.25191017, 4.95851149e-06, 0.00053913, 0.00040505, 0.74748, 0.25107328, 0.00025117, 7.35752498e-05, 0.00060884, -68.06323402, 0.00825675, 0., 0., 0., 5.58586557, -21.82537327,  2.12654   , 5.58601637, 4.71695579, 5.57516733, 0.87693093, 7.67784561, 0.60779877, 2.77775974e+57, 0., -99.,  0.        ,  0.        , 0.        , 0.        ,  0.00000000e+00,  0.e+00,  0.e+00, -6.02443780e+50, 1.62812825e-07, 0.02388221, 7.46957392, 2.20229762, 2.20229762, 2.20229762, 0., 0., 2.20229762, -0.30888975, -2.47247483e-07, 3.17362128, 0.01117727, 2.67220936e-05, 0.74748, 0.2511, 0.00142),
       (  100.        , 100.        , 0., 0., 0., 0., 0., 0., 0.74673088, 0.25183447, 6.38102280e-06, 0.00054251, 0.00039929, 0.74748, 0.25107328, 0.00025117, 7.35752498e-05, 0.00060884, -60.8579449 , 0.00682707, 0., 0., 0., 7.08396649, -17.84621136,  3.61347829, 7.08411345, 4.80210852, 6.11186526, 0.97497443, 7.76754605, 0.62921669, 8.45792890e+57, 0., -99., 99.99989914, 99.99989914, 9.44005298, 9.43531656,  1.08267993e+06, -1.e+99, -1.e+99, -1.45410256e+51, 3.49167598e-09, 0.00473642, 9.43768477, 2.75824057, 2.75824057, 2.75824057, 0., 0., 2.75824057, -0.15968088, -1.00860992e-06, 4.20260728, 0.01373076, 2.67220936e-05, 0.74748, 0.2511, 0.00142),
       (46075.44797575,   6.97475397, 0., 0., 0., 0., 0., 0., 0.74672054, 0.25183431, 2.85789437e-06, 0.00047798, 0.00047774, 0.74748, 0.25107328, 0.00025117, 7.35752498e-05, 0.00060884, -80.07947648, 0.02050378, 0., 0., 0., 3.32814369, -28.06079619, -0.13793693, 3.32829216, 4.40681953, 3.31272289, 0.36598123, 7.53818226, 1.37391117, 2.97021072e+55, 0., -99.,  6.97475328,  6.97475328, 2.32013167, 2.31753894, -1.00000000e+99, -1.e+99, -1.e+99, -5.40027262e+49, 3.14431346e-10, 0.00259273, 2.3188353 , 1.46566002, 1.46566002, 1.46566002, 0., 0., 1.46566002, -0.96075345, -1.04179328e-11, 0.57282062, 0.00318963, 2.67220936e-05, 0.74748, 0.2511, 0.00142)],
      dtype=[('S1_star_age', '<f8'), ('S1_star_mass', '<f8'), ('S1_he_core_mass', '<f8'), ('S1_c_core_mass', '<f8'), ('S1_o_core_mass', '<f8'), ('S1_he_core_radius', '<f8'), ('S1_c_core_radius', '<f8'), ('S1_o_core_radius', '<f8'), ('S1_center_h1', '<f8'), ('S1_center_he4', '<f8'), ('S1_center_c12', '<f8'), ('S1_center_n14', '<f8'), ('S1_center_o16', '<f8'), ('S1_surface_h1', '<f8'), ('S1_surface_he4', '<f8'), ('S1_surface_c12', '<f8'), ('S1_surface_n14', '<f8'), ('S1_surface_o16', '<f8'), ('S1_c12_c12', '<f8'), ('S1_center_gamma', '<f8'), ('S1_avg_c_in_c_core', '<f8'), ('S1_surf_avg_omega', '<f8'), ('S1_surf_avg_omega_div_omega_crit', '<f8'), ('S1_log_LH', '<f8'), ('S1_log_LHe', '<f8'), ('S1_log_LZ', '<f8'), ('S1_log_Lnuc', '<f8'), ('S1_log_Teff', '<f8'), ('S1_log_L', '<f8'), ('S1_log_R', '<f8'), ('S1_log_center_T', '<f8'), ('S1_log_center_Rho', '<f8'), ('S1_total_moment_of_inertia', '<f8'), ('S1_spin_parameter', '<f8'), ('S1_log_total_angular_momentum', '<f8'), ('S1_conv_env_top_mass', '<f8'), ('S1_conv_env_bot_mass', '<f8'), ('S1_conv_env_top_radius', '<f8'), ('S1_conv_env_bot_radius', '<f8'), ('S1_conv_env_turnover_time_g', '<f8'), ('S1_conv_env_turnover_time_l_b', '<f8'), ('S1_conv_env_turnover_time_l_t', '<f8'), ('S1_envelope_binding_energy', '<f8'), ('S1_mass_conv_reg_fortides', '<f8'), ('S1_thickness_conv_reg_fortides', '<f8'), ('S1_radius_conv_reg_fortides', '<f8'), ('S1_lambda_CE_1cent', '<f8'), ('S1_lambda_CE_10cent', '<f8'), ('S1_lambda_CE_30cent', '<f8'), ('S1_co_core_mass', '<f8'), ('S1_co_core_radius', '<f8'), ('S1_lambda_CE_pure_He_star_10cent', '<f8'), ('S1_log_L_div_Ledd', '<f8'), ('S1_star_mdot', '<f8'), ('S1_conv_mx1_top_r', '<f8'), ('S1_conv_mx1_bot_r', '<f8'), ('S1_surface_he3', '<f8'), ('X', '<f8'), ('Y', '<f8'), ('Z', '<f8')])
[40]:
#grid[0].history1.dtype.names
grid[0].history1['star_mass'][:10]
[40]:
array([26.4095753 , 26.40956901, 26.40956272, 26.40955643, 26.40955013,
       26.40954384, 26.40953697, 26.40952945, 26.40952193, 26.40951441])

Congratulations! You created a PSyGrid object from the single star models. Explor it and check out the visualization tutorial on how to display the data and easly plot an HR diagram!