shapefactor_combined

class pyhf.modifiers.shapefactor.shapefactor_combined(modifiers, pdfconfig, builder_data, batch_size=None)[source]

Bases: object

__init__(modifiers, pdfconfig, builder_data, batch_size=None)[source]
Parameters:
  • modifiers (list of tuple) – List of tuples of form (modifier, modifier_type).

  • pdfconfig (_ModelConfig) – Configuration for the model.

  • builder_data (dict) – Map of keys 'modifier_type/modifier' to the channels and bins they are applied to.

  • batch_size (int) – The number of rows in the resulting tensor. If None defaults to 1.

Imagine a situation where we have 2 channels (SR, CR), 3 samples (sig1, bkg1, bkg2), and 2 shapefactor modifiers (coupled_shapefactor, uncoupled_shapefactor). Let’s say this is the set-up:

SR(nbins=2)
  sig1 -> subscribes to normfactor
  bkg1 -> subscribes to coupled_shapefactor
CR(nbins=3)
  bkg2 -> subscribes to coupled_shapefactor, uncoupled_shapefactor

The coupled_shapefactor needs to have 3 nuisance parameters to account for the CR, with 2 of them shared in the SR. The uncoupled_shapefactor just has 3 nuisance parameters.

self._parindices will look like

[0, 1, 2, 3, 4, 5, 6]

self._shapefactor_indices will look like

[0, 1, 2, 3, 4, 5, 6]
[[1,2,3],[4,5,6]]
 ^^^^^^^         = coupled_shapefactor
         ^^^^^^^ = uncoupled_shapefactor

with the 0th par-index corresponding to the normfactor. Because the SR channel has 2 bins, and the CR channel has 3 bins (with SR before CR), global_concatenated_bin_indices looks like

[0, 1, 0, 1, 2]
^^^^^            = SR channel

      ^^^^^^^^^  = CR channel

So now we need to gather the corresponding shapefactor indices according to global_concatenated_bin_indices. Therefore self._shapefactor_indices now looks like

[[1, 2, 1, 2, 3], [4, 5, 4, 5, 6]]

and at that point can be used to compute the effect of shapefactor.

Attributes

name = 'shapefactor'
op_code = 'multiplication'

Methods

_precompute()[source]
apply(pars)[source]
Returns:

Shape (n_modifiers, n_global_samples, n_alphas, n_global_bin)

Return type:

modification tensor