breidablik.analysis.read ======================== .. py:module:: breidablik.analysis.read Attributes ---------- .. autoapisummary:: breidablik.analysis.read._base_path Functions --------- .. autoapisummary:: breidablik.analysis.read._name_add breidablik.analysis.read._get_dimension_path breidablik.analysis.read._closest_temp breidablik.analysis.read._get_model_path breidablik.analysis.read.read breidablik.analysis.read.get_wavelengths breidablik.analysis.read.read_all_abund breidablik.analysis.read.read_all breidablik.analysis.read.split breidablik.analysis.read.kfolds Module Contents --------------- .. py:data:: _base_path .. py:function:: _name_add(name) Add '+' to the front of positive values. Also keeps the '-' in front of negative values. .. py:function:: _get_dimension_path(D='3D', a=1.5, v=1, data_path=_base_path.parent / 'Balder') Gets the path to the specified dimension. .. py:function:: _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). .. py:function:: _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. .. py:function:: 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. :param eff_t: 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. :type eff_t: Real :param surf_g: The surface gravity of the stellar model. :type surf_g: Real :param met: The metallicity of the stellar model. :type met: Real :param abund: The lithium abundance of the stellar model. :type abund: Real :param D: The dimension of the model. Accepted values are either '1D' or '3D'. :type D: str, optional :param a: 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. :type a: Real or str, optional :param v: 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. :type v: Real or str, optional :param data_path: The folder that the data is stored in. By default, this path points to ``Balder`` in ``breidablik``. :type data_path: str, optional :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. :rtype: dict .. py:function:: get_wavelengths(data_path=None) Returns the wavelengths for the flux data. :param data_path: The folder that the data is stored in. By default, this path points to ``Balder`` in ``breidablik``. :type data_path: str, optional :returns: **wl** -- The wavelengths for the flux data in nm. :rtype: 1darray .. py:function:: 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. :param eff_t: 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. :type eff_t: Real :param surf_g: The surface gravity of the stellar model. :type surf_g: Real :param met: The metallicity of the stellar model. :type met: Real :param D: The dimension of the model. Accepted values are either '1D' or '3D'. :type D: str, optional :param a: 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. :type a: Real or str, optional :param v: 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. :type v: Real or str, optional :param data_path: The folder that the data is stored in. By default, this path points to ``Balder`` in ``breidablik``. :type data_path: str, optional :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). :rtype: dict of dict .. py:function:: read_all(D='3D', a=1.5, v=1, data_path=None) Read in all the data for some dimension. :param D: The dimension of the model. Accepted values are either '1D' or '3D'. :type D: str, optional :param a: 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. :type a: Real or str, optional :param v: 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. :type v: Real or str, optional :param data_path: The folder that the data is stored in. By default, this path points to ``Balder`` in ``breidablik``. :type data_path: str, optional :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'). :rtype: dict .. py:function:: split(data, split, seed=None) Split up the data into a test and training set. :param data: 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. :type data: dict :param split: Specifies the ratio of test data to all data. No split is done if None. :type split: float, optional :param seed: Seed used to generate random numbers. Set for reproducibility of results. :type seed: int, optional :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. :rtype: dict .. py:function:: kfolds(data, k=10, seed=None) Split the data up into k-folds. :param data: 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. :type data: dict :param k: Specifies the number of folds generated. If the data doesn't divide fully along the folds, then a best split is done. :type k: int, optional :param seed: Seed used to generate random numbers. Set for reproducibility of results. :type seed: int, optional :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. :rtype: dict