The notebook is available here: https://github.com/starkit/starkit/tree/master/docs/io/reading_bosz.ipynb
Preparing a raw BOSZ Grid installation¶
This is needed for making custom StarKit grids - not suitable for most users.
You first need to navigate to the Phoenix folder that contains the grid (‘bosz’)
[1]:
cd ~/data/skgrid/bosz/
/scigarfs/home/wkerzend/data/skgrid/bosz
[2]:
from starkit.gridkit.io.phoenix import PhoenixProcessGrid
from starkit.gridkit.io.bosz.process import BOSZProcessGrid
from starkit.gridkit.io.bosz.base import make_raw_index, make_grid_info, cache_bosz_grid
from starkit.gridkit import load_grid
import pandas as pd
from astropy import units as u
from astropy.io import fits
import numpy as np
import uuid
[3]:
#make_grid_info('bosz_grid_info.h5')
[4]:
#cache_bosz_grid()
[5]:
meta = pd.read_hdf('bosz_grid_info.h5', 'meta')
raw_index = pd.read_hdf('bosz_grid_info.h5', 'index')
wavelength = pd.read_hdf('bosz_grid_info.h5', 'wavelength')[0].values * u.Unit(meta['wavelength_unit'])
[43]:
for col in raw_index.columns[:-1]:
raw_index[col] = raw_index[col].astype(np.float64)
raw_index.logg *= 0.1
[47]:
index_filter = (raw_index.teff.between(4000, 7000) &
raw_index.logg.between(-1, 5) &
raw_index.mh.between(-2.5, 0.5) &
(raw_index.alpha == 0.0))
new_index = raw_index.loc[index_filter]
[54]:
bgrid = BOSZProcessGrid(new_index, wavelength, meta,
wavelength_start=2000*u.angstrom,
wavelength_stop=25000*u.angstrom, R=20000.0)
[55]:
bgrid.to_hdf('rcw86_fs1_bosz_grid.h5')
100% (10530 of 10530) |###################| Elapsed Time: 0:07:47 Time: 0:07:47
done
/lustre/home/wkerzend/miniconda3/envs/starkit/lib/python2.7/site-packages/pandas/core/generic.py:1299: PerformanceWarning:
your performance may suffer as PyTables will pickle object types that it cannot
map directly to c-types [inferred_type->mixed-integer,key->values] [items->None]
return pytables.to_hdf(path_or_buf, key, self, **kwargs)
[8]:
raw_index.drop('filename', axis=1)
[8]:
teff | logg | mh | alpha | |
---|---|---|---|---|
0 | 2300 | 0 | 0.5 | 0 |
1 | 2300 | 0.5 | 0.5 | 0 |
2 | 2300 | 1 | 0.5 | 0 |
3 | 2300 | 1.5 | 0.5 | 0 |
4 | 2300 | 2 | 0.5 | 0 |
5 | 2300 | 2.5 | 0.5 | 0 |
6 | 2300 | 3 | 0.5 | 0 |
7 | 2300 | 3.5 | 0.5 | 0 |
8 | 2300 | 4 | 0.5 | 0 |
9 | 2300 | 4.5 | 0.5 | 0 |
10 | 2300 | 5 | 0.5 | 0 |
11 | 2300 | 5.5 | 0.5 | 0 |
12 | 2300 | 6 | 0.5 | 0 |
13 | 2400 | -0.5 | 0.5 | 0 |
14 | 2400 | 0 | 0.5 | 0 |
15 | 2400 | 0.5 | 0.5 | 0 |
16 | 2400 | 1 | 0.5 | 0 |
17 | 2400 | 1.5 | 0.5 | 0 |
18 | 2400 | 2 | 0.5 | 0 |
19 | 2400 | 2.5 | 0.5 | 0 |
20 | 2400 | 3 | 0.5 | 0 |
21 | 2400 | 3.5 | 0.5 | 0 |
22 | 2400 | 4 | 0.5 | 0 |
23 | 2400 | 4.5 | 0.5 | 0 |
24 | 2400 | 5 | 0.5 | 0 |
25 | 2400 | 5.5 | 0.5 | 0 |
26 | 2400 | 6 | 0.5 | 0 |
27 | 2500 | -0.5 | 0.5 | 0 |
28 | 2500 | 0 | 0.5 | 0 |
29 | 2500 | 0.5 | 0.5 | 0 |
... | ... | ... | ... | ... |
47338 | 14000 | 2 | -4 | -0.4 |
47339 | 14000 | 2.5 | -4 | -0.4 |
47340 | 14000 | 3 | -4 | -0.4 |
47341 | 14000 | 3.5 | -4 | -0.4 |
47342 | 14000 | 4 | -4 | -0.4 |
47343 | 14000 | 4.5 | -4 | -0.4 |
47344 | 14000 | 5 | -4 | -0.4 |
47345 | 14000 | 5.5 | -4 | -0.4 |
47346 | 14000 | 6 | -4 | -0.4 |
47347 | 14000 | 6.5 | -4 | -0.4 |
47348 | 14500 | 2 | -4 | -0.4 |
47349 | 14500 | 2.5 | -4 | -0.4 |
47350 | 14500 | 3 | -4 | -0.4 |
47351 | 14500 | 3.5 | -4 | -0.4 |
47352 | 14500 | 4 | -4 | -0.4 |
47353 | 14500 | 4.5 | -4 | -0.4 |
47354 | 14500 | 5 | -4 | -0.4 |
47355 | 14500 | 5.5 | -4 | -0.4 |
47356 | 14500 | 6 | -4 | -0.4 |
47357 | 14500 | 6.5 | -4 | -0.4 |
47358 | 15000 | 2 | -4 | -0.4 |
47359 | 15000 | 2.5 | -4 | -0.4 |
47360 | 15000 | 3 | -4 | -0.4 |
47361 | 15000 | 3.5 | -4 | -0.4 |
47362 | 15000 | 4 | -4 | -0.4 |
47363 | 15000 | 4.5 | -4 | -0.4 |
47364 | 15000 | 5 | -4 | -0.4 |
47365 | 15000 | 5.5 | -4 | -0.4 |
47366 | 15000 | 6 | -4 | -0.4 |
47367 | 15000 | 6.5 | -4 | -0.4 |
47368 rows × 4 columns
[13]:
flux = fits.getdata('PHOENIX-ACES-AGSS-COND-2011/Z+0.5/lte02300-0.00+0.5.PHOENIX-ACES-AGSS-COND-2011-HiRes.fits')