HEXRD / hexrd

A cross-platform, open-source library for the analysis of X-ray diffraction data.
Other
56 stars 25 forks source link

Add config option to specify tThWidth attribute #16

Closed joelvbernier closed 3 years ago

joelvbernier commented 4 years ago

I'd like to add a hook in the materials block of the hedm config to specify (override) the planeData.tThWidth attribute on the specified object. Default value in the config should be null, which would do nothing (i.e. just use what is specified in the saved material file).

donald-e-boyce commented 4 years ago

I've fixed this in the instrument-package branch and pushed it up to my fork.

In the process, I discovered what appears to be a bug in the config.init() method when opening a file with multiple yaml documents. Instead of merging each new document with the previous merged document, it seems to merge the each new document with the original. Here is the code snippet. The merge should be with res[-1] , not with res[0].

   with open_file(file_name) as f:
        res = []
        for cfg in yaml.load_all(f, Loader=yaml.SafeLoader):
            try:
                # take the previous config section and update with values
                # from the current one
                res.append(utils.merge_dicts(res[0], cfg))
            except IndexError:
                # this is the first config section
                res.append(cfg)
joelvbernier commented 3 years ago

closed by PR #148 .