pyhs3.distributions.histfactory.modifiers.HasConstraint¶
- class pyhs3.distributions.histfactory.modifiers.HasConstraint[source]¶
Base class for modifiers that can have constraint terms.
- __init__()¶
Methods
constraint_distribution(context, sample_data)The constraint distribution and the context it evaluates in.
log_constraint(context, sample_data)Create constraint term for this modifier (log space).
make_constraint(context, sample_data)Create constraint term for this modifier (probability space).
unconstrained_parameters(sample_data)Parameters that scale a positive yield but get no constraint term.
Attributes
- abstractmethod HasConstraint.constraint_distribution(context, sample_data)[source]¶
The constraint distribution and the context it evaluates in.
The distribution’s
xis the constraint’s global observable (auxiliary data), a constant of its own: of shape()for a single-parameter modifier and(B',)for a per-bin one,B'the number of constrained bins. Each call builds a new distribution and constant.Noneif the modifier constrains no parameter.- Parameters:
context (
Context)sample_data (
SampleData)
- Return type:
- HasConstraint.log_constraint(context, sample_data)[source]¶
Create constraint term for this modifier (log space).
Log-space counterpart of
make_constraint(): evaluates the same constraint distribution(s) via their analyticlog_likelihoodinstead of takingpt.logof the probability-space result, so the constraint stays finite where the probability-space value would underflow to 0.0.- Parameters:
context (
Context)sample_data (
SampleData)
- Return type:
- HasConstraint.make_constraint(context, sample_data)[source]¶
Create constraint term for this modifier (probability space).
- Parameters:
context (
Context)sample_data (
SampleData)
- Return type:
- HasConstraint.unconstrained_parameters(sample_data)[source]¶
Parameters that scale a positive yield but get no constraint term.
A per-bin parameter whose bin has a positive yield and zero uncertainty is left out of the constraint; pyhf and ROOT fix it at its nominal value, so it must be
const. Modifiers with one constrained parameter have none.- Parameters:
sample_data (
SampleData)- Return type:
- HasConstraint.constraint¶