We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This issue has been migrated from https://cdcvs.fnal.gov/redmine/issues/24091 (FNAL account required) Originally created by @ikatza on 2020-02-26 10:22:45
python/fhiclmodule.cc defines a python module to be able to open a fcll file and put the contents on a python dict.
python/fhiclmodule.cc
Accessing parameters can become cumbersome:
pset['parameter_table']['parameter_value']
A less cumbersome and more familiar way would be to do:
pset.parameter_table.parameter_value
In Python this is easily achieved by defining __getattr__() function.
__getattr__()
What I've done is:
On my python script define:
class dotDict(dict): def __getattr__(self,val): return self[val]
then feed this class with the python dict:
fcl_params = fhicl.make_pset('file_with_parameters.fcl') pset = dotDict(fcl_params) par = pset.parameter_table.parameter_value
Unfortunately I don't understand how to construct this code on the C++ implementation of this module.
Would this be something you would like to add to the module?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
This issue has been migrated from https://cdcvs.fnal.gov/redmine/issues/24091 (FNAL account required)
Originally created by @ikatza on 2020-02-26 10:22:45
python/fhiclmodule.cc
defines a python module to be able to open a fcll file and put the contents on a python dict.Accessing parameters can become cumbersome:
A less cumbersome and more familiar way would be to do:
In Python this is easily achieved by defining
__getattr__()
function.What I've done is:
On my python script define:
then feed this class with the python dict:
Unfortunately I don't understand how to construct this code on the C++ implementation of this module.
Would this be something you would like to add to the module?
The text was updated successfully, but these errors were encountered: