impy-project / chromo

Hadronic Interaction Model interface in PYthon
Other
31 stars 7 forks source link

Remove pyyaml dependency #38

Closed HDembinski closed 2 years ago

HDembinski commented 2 years ago

In Python, it is perfectly fine to write configuration files in Python. There no need to introduce a dependency to pyyaml.

I suggest to replace impy_config.yaml

# Impy configuration file

# Level of verbosity
debug_level: 1

# Location for cache file for particledata.tables objects
pdata_cachefile : 'impy_pdata_cache.cch'

epos:
    output_frame : [ 'laboratory', 'center-of-mass' ]
    sqs_min_GeV  : 5.
    has_boosts   : True
    has_hepevt   : True
    int_support  : [ 'hh', 'hA', 'AA', 'gg', 'gh', 'gA']
    datdir       : iamdata/epos/
    debug_level  : 0
    projectiles  : {
        'LHC' : [ 2212, 2112, 321, -321, 211, -211, 130, -2212, -2112,
                  3112, -3112, 3222, -3222, 3322, -3322, 3312, -3312,
                  3122, -3122, 22]
    }

with impy_config.py

# Impy configuration file

# Level of verbosity
debug_level = 1

# Location for cache file for particledata.tables objects
pdata_cachefile = 'impy_pdata_cache.cch'

epos = {
    'output_frame' : [ 'laboratory', 'center-of-mass' ],
    'sqs_min_GeV'  : 5.,
    'has_boosts'   : True,
    'has_hepevt'   : True,
    'int_support'  : [ 'hh', 'hA', 'AA', 'gg', 'gh', 'gA'],
    'datdir'       : 'iamdata/epos/',
    ...
    }

A lot of this config should be read-only, so it shouldn't be in a config file, it should be part of the wrapper class.

afedynitch commented 2 years ago

It is ok to go with the python file since there is really no use for the yaml. Closing this since it's already in #39 .