[GSAS-II] Proposal for new configuration variable 'suppress_info'

Ivo Alxneit ivo.alxneit at psi.ch
Mon Jun 10 09:11:37 CDT 2019


Dear all,

attached a patch (applies to svn version 4020) that introduces the
configuration variable 'suppress_info'. Setting it to 'True' will
suppress all output of informational nature as e.g. emitted by
readers/writers (file loaded/saved) or by many of the functions in G2sc
(histograms loaded, HAP parameters copied, ...). I found this quite
useful in scriptable to prevent my output from becoming hidden in lots
of (uninteresting) information. Default is 'False', i.e. the default
behavior of GSASII does not change with this patch. 'suppress_info' can
either be set in the GUI (Preferences) or from a script as e.g.


# initialize 'suppress_info': Default 'False' but set it to 'True'
GSASIIpath.SetConfigValue({'suppress_info' : [False, True]})

# do some things

if foo:
    # temporarily enable output of info
    GSASIIpath.SetConfigValue({'suppress_info' : [False, False]})

    # do stuff

    # disable output of info again
    GSASIIpath.SetConfigValue({'suppress_info' : [False, True]})

# continue, output of info is disabled again


I am not sure whether I caught all the places that emit info but I would
check the full sources, if the patch gets applied.

BTW: GetConfigValue(key,default=None) only reports locally changed
values (stored in config.py). For keys not present it returns 'False'
(unless 'default' is specified). Thus, for keys kept at their non-False
default (specified in config_example.py) the function returns the wrong
value unless the individual default value is specified in the call. This
looks fragile to me. If a default value is changed in future, both,
config_examples.py (used for Preferences in the GUI) and in addition all
calling sites have to reflect this change consistently. Would it make
sense at start-up to first parse config_examples.py (maybe change its
name to something more descriptive) and then update locally changed keys
from config.py?

gruss
-- 
Dr. Ivo Alxneit
Catalysis for Energy Group
Bioenergy and Catalysis Laboratory        phone: +41 56 310 4092
Paul Scherrer Institute                     fax: +41 56 310 2688
CH-5232 Villigen                      gnupg key: 0x515E30C7
Switzerland
https://www.psi.ch/ceg/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: suppress_info.patch
Type: text/x-patch
Size: 11983 bytes
Desc: not available
URL: <http://mailman.aps.anl.gov/pipermail/gsas-ii/attachments/20190610/898e1b56/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.aps.anl.gov/pipermail/gsas-ii/attachments/20190610/898e1b56/attachment.sig>


More information about the GSAS-II mailing list