breidablik.analysis.read
Attributes
Functions
|
Add '+' to the front of positive values. Also keeps the '-' in front of negative values. |
|
Gets the path to the specified dimension. |
|
Finds the temperature closest to the input temperature given that the surface gravity and metallicity values match. The output will always be accurate to 2 decimal places (the output will match the names of the models). |
|
Returns path of model given the stellar parameters. Will return closest model with the closest temp that matches the input temp. surf_g and met have to be exact. |
|
Reads in the flux data for the specified dimension and stellar parameters. Will only work if loose grid is downloaded, use read_all instead. |
|
Returns the wavelengths for the flux data. |
|
Reads in the fluxes for all lithium abundances for a dimension and stellar model. Will only work if loose grid is downloaded, use read_all instead. |
|
Read in all the data for some dimension. |
|
Split up the data into a test and training set. |
|
Split the data up into k-folds. |
Module Contents
- breidablik.analysis.read._base_path
- breidablik.analysis.read._name_add(name)
Add ‘+’ to the front of positive values. Also keeps the ‘-’ in front of negative values.
- breidablik.analysis.read._get_dimension_path(D='3D', a=1.5, v=1, data_path=_base_path.parent / 'Balder')
Gets the path to the specified dimension.
- breidablik.analysis.read._closest_temp(temperature, surf_g, met, D='3D', a=1.5, v=1, data_path=_base_path.parent / 'Balder')
Finds the temperature closest to the input temperature given that the surface gravity and metallicity values match. The output will always be accurate to 2 decimal places (the output will match the names of the models).
- breidablik.analysis.read._get_model_path(eff_t, surf_g, met, D='3D', a=1.5, v=1, data_path=_base_path.parent / 'Balder')
Returns path of model given the stellar parameters. Will return closest model with the closest temp that matches the input temp. surf_g and met have to be exact.
- breidablik.analysis.read.read(eff_t, surf_g, met, abund, D='3D', a=1.5, v=1, data_path=None)
Reads in the flux data for the specified dimension and stellar parameters. Will only work if loose grid is downloaded, use read_all instead.
- Parameters:
eff_t (Real) – The temperature closest to the real temperature of the model. This input should to be less than 250 K away from the real temperature of the model. If the input temperature is more than 250 K from the real temperature, a warning will be raised, consult the warnings module to see how to change these warnings.
surf_g (Real) – The surface gravity of the stellar model.
met (Real) – The metallicity of the stellar model.
abund (Real) – The lithium abundance of the stellar model.
D (str, optional) – The dimension of the model. Accepted values are either ‘1D’ or ‘3D’.
a (Real or str, optional) – The mixing length parameter. Accepted values are 1, 1.5, or 2. The input can be expressed in any data type that can be converted into a floating point number.
v (Real or str, optional) – The microturbulence parameter. Accepted values are 0, 1, or 2. The input can be expressed in any data type that can be converted into a floating point number.
data_path (str, optional) – The folder that the data is stored in. By default, this path points to
Balderinbreidablik.
- Returns:
flux_data – The NLTE and LTE flux of the specified dimension and stellar model. ‘flux’ contains the NLTE flux, and ‘fluxl’ contains the LTE flux.
- Return type:
dict
- breidablik.analysis.read.get_wavelengths(data_path=None)
Returns the wavelengths for the flux data.
- Parameters:
data_path (str, optional) – The folder that the data is stored in. By default, this path points to
Balderinbreidablik.- Returns:
wl – The wavelengths for the flux data in nm.
- Return type:
1darray
- breidablik.analysis.read.read_all_abund(eff_t, surf_g, met, D='3D', a=1.5, v=1, data_path=None)
Reads in the fluxes for all lithium abundances for a dimension and stellar model. Will only work if loose grid is downloaded, use read_all instead.
- Parameters:
eff_t (Real) – The temperature closest to the real temperature of the model. This input should to be less than 250 K away from the real temperature of the model. If the input temperature is more than 250 K from the real temperature, a ValueError will be raised, consult the warnings module to see how to change these warnings.
surf_g (Real) – The surface gravity of the stellar model.
met (Real) – The metallicity of the stellar model.
D (str, optional) – The dimension of the model. Accepted values are either ‘1D’ or ‘3D’.
a (Real or str, optional) – The mixing length parameter. Accepted values are 1, 1.5, or 2. The input can be expressed in any data type that can be converted into a floating point number.
v (Real or str, optional) – The microturbulence parameter. Accepted values are 0, 1, or 2. The input can be expressed in any data type that can be converted into a floating point number.
data_path (str, optional) – The folder that the data is stored in. By default, this path points to
Balderinbreidablik.
- Returns:
data – The NLTE and LTE fluxes for all lithium abundances of a model. The outermost keys are the lithium abundances. The inner keys are ‘flux’ (retreives the NLTE flux) and ‘fluxl’ (retreives the LTE flux).
- Return type:
dict of dict
- breidablik.analysis.read.read_all(D='3D', a=1.5, v=1, data_path=None)
Read in all the data for some dimension.
- Parameters:
D (str, optional) – The dimension of the model. Accepted values are either ‘1D’ or ‘3D’.
a (Real or str, optional) – The mixing length parameter. Accepted values are 1, 1.5, or 2. The input can be expressed in any data type that can be converted into a floating point number.
v (Real or str, optional) – The microturbulence parameter. Accepted values are 0, 1, or 2. The input can be expressed in any data type that can be converted into a floating point number.
data_path (str, optional) – The folder that the data is stored in. By default, this path points to
Balderinbreidablik.
- Returns:
data – All the data stored in the specified dimension. The outermost keys are the stellar parameters for the models. The next keys are the lithium abundances. The innermost keys are ‘flux’ which retreives the NLTE flux or ‘fluxl’ which retreives the LTE flux. If split is used then the outermost keys are the split sets (either ‘train’ or ‘test’).
- Return type:
dict
- breidablik.analysis.read.split(data, split, seed=None)
Split up the data into a test and training set.
- Parameters:
data (dict) – The read in data. The outermost keys are the stellar parameters for the models. The next keys are the lithium abundances. The innermost keys are ‘flux’ which retreives the NLTE flux or ‘fluxl’ which retreives the LTE flux.
split (float, optional) – Specifies the ratio of test data to all data. No split is done if None.
seed (int, optional) – Seed used to generate random numbers. Set for reproducibility of results.
- Returns:
split_sets – The split data. Outermost keys are the split sets (either ‘train’ or ‘test’), the inner keys remain the same as the input data.
- Return type:
dict
- breidablik.analysis.read.kfolds(data, k=10, seed=None)
Split the data up into k-folds.
- Parameters:
data (dict) – The read in data. The outermost keys are the stellar parameters for the models. The next keys are the lithium abundances. The innermost keys are ‘flux’ which retreives the NLTE flux or ‘fluxl’ which retreives the LTE flux.
k (int, optional) – Specifies the number of folds generated. If the data doesn’t divide fully along the folds, then a best split is done.
seed (int, optional) – Seed used to generate random numbers. Set for reproducibility of results.
- Returns:
folds – The k-fold data. Outermost keys are the number of the sets (from 0 up to but not including k), the inner keys remain the same as the input data.
- Return type:
dict