Configuration¶
Configuration is preformed using a config.yaml
placed in the working directory you wish to run eniric
from.
It configures the path locations to the spectral libraries and allows for user defined spectral bands.
If a config.yaml
file does not exist then the default is used, located at eniric/config.yaml
.
You can copy the default configuration to a directory located at <path_to_dir>
using config.copy_file(<path_to_dir>)
For example, to copy it to the current directory from the command line use:
$ python -c "from eniric import config; config.copy_file('.')"
The configuration values can be changed in python and saved back to the config file. For example
from eniric import config
config.paths["precision"] = ["new", "path", "to", "precision"] # or "new/path/to/precision"
config.update()
will update precision path in the configuration file.
Note
The default config.yaml
file cannot be overwritten.
Eniric configuration¶
The default configuration file is shown below. The comments explain the keywords needed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | # Default YAML configuration script for Eniric.
# Paths to locations used by eniric, relative to config.yaml.
# Paths can either be strings of list of strings which will be passed
# to :py:func:`os.path.join` (This is for os independence)
paths:
phoenix_raw: ["..", "data", "phoenix-raw"] # Path to Phoenix-ACES spectra
btsettl_raw: ["..", "data", "btsettl-raw"] # Path to BT-Settl spectra
atmmodel: ["..", "data", "atmmodel"] # Path of atmosphere model directory
precision_results: ["..", "data", "precision"] # A place to put precision results
# Wavelength bands.
bands:
all: ["VIS", "GAP", "Z", "Y", "J", "H", "K", "CONT", "NIR", "TEST"] # "all" name available in scripts
# Already included wavelength bands (see `eniric.utilities.py`)
# "VIS": (0.38, 0.78),
# "GAP": (0.78, 0.83),
# "Z": (0.83, 0.93),
# "Y": (1.0, 1.1),
# "J": (1.17, 1.33),
# "H": (1.5, 1.75),
# "K": (2.07, 2.35),
# "CONT": (0.45, 1.05),
# "NIR": (0.83, 2.35)
# Add your custom band limits here and include in "all" list above.
# Limits must be contained in lists.
custom_bands:
TEST: [2.1, 2.2]
# Location of the joblib memory cache.
cache:
# location: None # Disables cache
location: [".joblib"]
# Properties of the atmospheric model used.
atmmodel:
# Base name of telluric model
base: "Average_TAPAS_2014"
# Necessary configuration keywords for Starfish can be included in this file.
name: "default"
|
Config Class¶
-
class
eniric._config.
Config
(path)[source]¶ Creates a persistent Config object from the give file.
This class is not meant to be instantiated by the User, but rather to be used via
eniric.config
.Parameters: path (str or path-like) – The filename for creating the Config. Must be YAML. -
copy_file
(directory=os.getcwd(), switch=True)[source]¶ Copies the master config file to the given directory.
Parameters: Example
eniric.config.copy_file()
-
change_file
(filename)[source]¶ Change the current configuration to use the given YAML file.
Parameters: filename (str or path-like) – The YAML file to switch to using for config. Example
eniric.config.change_file('new_config.yaml')
-
copy_file
(directory=None, switch=True)[source] Copies the master config file to the given directory.
Parameters: Example
eniric.config.copy_file()
-
pathdir
¶ Directory of the config file.
-