refactor shapesys
See original GitHub issueSummary
with the custom_mod stuff we can quite cleanly refactor shapesys (and remove its finalize)
def required_parset(sample_data, modifier_data):
# count the number of bins with nonzero, positive yields
valid_bins = [
(sample_bin > 0 and modifier_bin > 0)
for sample_bin, modifier_bin in zip(modifier_data, sample_data)
]
factors = [
(nom_yield / unc) ** 2
for is_valid, nom_yield, unc in zip(valid_bins, sample_data, modifier_data)
if is_valid
]
n_parameters = sum(valid_bins)
return {
"paramset_type": "constrained_by_poisson",
"n_parameters": n_parameters,
"is_shared": False,
"is_scalar": False,
"inits": (1.0,) * n_parameters,
"bounds": ((1e-10, 10.0),) * n_parameters,
"fixed": False,
"auxdata": tuple(factors),
"factors": tuple(factors),
}
Additional Information
No response
Code of Conduct
- I agree to follow the Code of Conduct
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Refactor modifier classes and add docstrings #1641 - GitHub
PR #1625 added the modifier builder and combine classes, but they might be good candidates for a refactor that allows for a base...
Read more >RooStats::HistFactory::ShapeSys Class Reference - ROOT
Public Member Functions. ShapeSys (). Constraint::Type · GetConstraintType (). TH1 *, GetErrorHist (). std::string, GetHistoName ().
Read more >histosys — pyhf 0.5.3 documentation - Read the Docs
histosys; normfactor · normsys · shapefactor · shapesys · staterror ... refactor-validationtest · refactor-remove-numpy-from-jax-backend ...
Read more >Number of steps for refactoring by shapes | Download Table
In Refactoring by shapes it is possible to see that some numbers between brackets are lower than the correspondent steps numbers of Refactoring...
Read more >pyhf | Read the Docs
... refactor-improve-error-message-for-sys-number-mismatch ... docs-copybutton-regex · docs-clarify-warning-shapesys-staterror · docs-clarifyfitparams ...
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

yes this works
yes, this is a very quick / straight-forward PR