hexrd icon indicating copy to clipboard operation
hexrd copied to clipboard

organize and document config default values

Open donald-e-boyce opened this issue 2 years ago • 1 comments

The default values for the config file variables need to be documented. There are some modules with default values defined explicitly in the module, e.g. in material.py

   from .config import Config

   DMIN_DFLT = 0.5    # angstrom
   TTHW_DFLT = 0.25   # degrees

But most default values are hardcoded using the config get() method, as in fitgrains.py:

    @property
    def do_fit(self):
        return self._cfg.get('fit_grains:do_fit', True)

It would be useful to have a standard location where the default config values are located. That would make it easier to be consistent with the GUI as well.

I am thinking of adding a separate defaults module to the config package.

donald-e-boyce avatar May 09 '23 18:05 donald-e-boyce

This sounds good to me, Don. And actually, a lot of config in HEXRDGUI is stored in dicts. We put the default values for our config in a yaml file like this one.

After loading saved settings, we recursively set default values if any keys are missing.

You might be able to do a yaml file for the defaults here as well.

psavery avatar May 11 '23 14:05 psavery