pyhf icon indicating copy to clipboard operation
pyhf copied to clipboard

Make `model.config.par_names()` a property?

Open alexander-held opened this issue 3 years ago • 1 comments

Summary

Currently model.config.par_names() takes no arguments and returns a list of parameter names. The behavior slightly differs from model.config.channels and model.config.samples, which are properties. For consistency, it may be useful to turn par_names into a property as well.

Additional Information

model.config.par_names() used to take an argument to set formatting, which required it to be a function. Since that has been dropped in the meantime, this opens up the possibility of using @property.

I don't know whether both par_names and par_names() can be supported simultaneously, which would allow to not break existing workflows with par_names(), but it may be better to only have a single API regardless.

Code of Conduct

  • [X] I agree to follow the Code of Conduct

alexander-held avatar Nov 15 '21 15:11 alexander-held

Similarly to this, suggested_init, suggested_bounds and suggested_fixed currently take no arguments either. One other consideration is that maybe some of these parts of the API are meant to eventually support kwargs, in which case switching to a property would not be useful.

alexander-held avatar Nov 15 '21 16:11 alexander-held

Similarly to this, suggested_init, suggested_bounds and suggested_fixed currently take no arguments either. One other consideration is that maybe some of these parts of the API are meant to eventually support kwargs, in which case switching to a property would not be useful.

I like this idea, but would table it until v0.8.0. So I've moved this to Issue #2028.

matthewfeickert avatar Sep 23 '22 20:09 matthewfeickert