Skip to content

Config Package

Donald Boyce edited this page Jun 9, 2020 · 1 revision

The config package is a YAML-based input reader that delivers high level objects. Input is a YAML file with (possibly) multiple documents. When the file is read, a running list of documents is kept, and each new input document is used to update the previous document.

Package Functions

  • config.open(file_name=None): returns a list of input documents (YAML documents);
  • config.save(config_list, file_name): saves a list of documents in a YAML file

Modules and Subpackages

config.py

  • class Config: baseclass for all config classes
    • __init__(self,doc): this class is initialized with a yaml document from the input file
    • get(self, key, default=null)): key is colon-separated string referring to nested items in the input YAML file; you can also return a default value in case key is not found
    • set(self, key, val): set the value associated with key to a value
    • dump(self, filename): write a new YAML file for this section
    • dirty: (property [r]) boolean indicating that an input value has been changed, so that the state of the config instance no longer reflects the input file

root.py

  • class RootConfig: top-level class for hexrd;
    • analysis_name: (property [rw]) name of for this analysis
    • working_dir: (property [rw]) current working directory
    • analysis_dir: (property[r]) directory for this analysis (working_dir + analysis_name)
    • multiprocessing: (property [rw]) number of CPUs to use
    • instrument: (property [r]) the instrument
    • image_series: (property [r]) the image_series
    • find_orientations: the options for find_orientations
    • fit_grains: the options to fit_grains