Value with uncertainties¶
-
class
heppy.
Value
(nominal, uncorr_variations={}, corr_variations={}, attributes={})¶ A single value with uncertainties.
Parameters: - nominal (
float
) – nominal value - uncorr_variations (
dict
ofstr
andfloat
) – dictionary of variations that are uncorrelated between differentheppy.value
objects even when they have the same key - corr_variations (
dict
ofstr
andfloat
) – dictionary of variations that are fully correlated between differentheppy.value
objects when they have the same key, and uncorrelated otherwise - attributes (
dict
) – dictionary of completely arbitrary attributes that the user can provide/change/access. E.g. information about the data sample that produced the value
-
to_atlasiff
(attributes={}, up_suffix='__1up', down_suffix='__1down')¶ Returns string representation in ATLAS IFF format.
This is the XML format used by the fake-lepton background tool of the ATLAS Isolation and Fakes Forum.
Parameters: - attributes (
str
) – dictionary of attributes to put in the bin-tag - up_suffix – suffix in variation keys to designate an up variation
- down_suffix – suffix in variation keys to designate an down variation
Usage example:
>>> import heppy as hp >>> nominal = 12.3 >>> uncorr_variations = { 'stat__1up' : 12.4, 'stat__1down' : 12.1, } >>> corr_variations={ 'efficiency__1up' : 13.1, 'efficiency__1down' : 9.8, 'energy_scale__1up' : 10.5, } >>> v = hp.Value(nominal, uncorr_variations=uncorr_variations, corr_variations=corr_variations) >>> v.to_atlasiff(attributes={'pt' : '[20,inf]', '|eta|' : '[0.0,0.6]'}) '<bin pt="[20,inf]" |eta|="[0.0,0.6]"> 12.3 +0.1-0.2 (stat) -1.8+0.0 (energy_scale) +0.8-2.5 (efficiency) </bin>'
- attributes (
-
net_variations
(variations='all', subtract_nominal=False, relative=False)¶ Return upper and lower net height variation of the value.
@variations should be a sequence of considered variation names or the string ‘all’ @subtract_nominal: if True, return the differences with respect to the nominal heights @relative: if True, divide by the nominal heights
CAUTION: this method cannot yet deal with systematic uncertainties for which the up- and down-shift lie on the same side of the nominal. This is because the variations are fundamentally treated independently of each other, so there is no sense of the up- and down-shift being related to the same underlying uncertainty source.
- nominal (