Model parameter index for components of non-scalar parameters
See original GitHub issueSummary
With the addition of model.config.par_names, there is a well-defined name for components of non-scalar parameters available within pyhf. It would be useful if model.config.par_slice would support parameter indexing to access components of non-scalar parameters. At the moment it will return the slice of all components, and return a KeyError when using it with the name of a component.
This can be worked around (example utility in cabinetry: model_utils._parameter_index), but it would be convenient to support this in the pyhf API.
related:
Additional Information
Example usage for a model with multiple bins for a channel and staterror modifier
model: pyhf.pdf.Model
model.config.par_names() # ['mu', 'staterror_SR[0]', 'staterror_SR[1]', 'staterror_SR[2]', 'staterror_SR[3]']
model.config.par_slice("staterror_SR") # returns e.g. slice(1, 5, None)
model.config.par_slice("staterror_SR[0]") # KeyError: 'staterror_SR[0]'
Code of Conduct
- I agree to follow the Code of Conduct
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Enter new value for parameter - Simulink - MathWorks
When the value of the selected variable or block parameter is nonscalar, use the text box at the bottom of the Connection table...
Read more >SIT Set Model Parameters VI - NI - National Instruments
Simulation Data In specifies unique information about the model DLL. param index specifies the index number of a scalar or nonscalar parameter.
Read more >Modeling Language GNU MathProg
A dummy index is an auxiliary model object, which acts like an individual variable. Values assigned to dummy indices are components of n-tuples...
Read more >5 Parameters + Variables · Mimi.jl
For the latter case, model parameters can be unshared, such that they can only connect to one component/parameter pair and must be accessed...
Read more >jagsUI: A Wrapper Around 'rjags' to Streamline 'JAGS' Analyses
Parameter names must match parameters included in the model. Calling non-scalar parameters without subsetting (e.g. alpha) will plot all ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I think arguably, if you want to support that, we could have experimental query language support plugged in, so that the
par_slicecan delegate to the query language functionality…As far as I remember, yes #994 allows for this too. I opened this issue because I think it makes sense to have it in the
model.config.par_sliceAPI directly instead of just in thepyhf.experimentalAPI. I would say thatnot working could almost be viewed as a bug, since
par_namesis perfectly happy to provide that name.