How to use the pyhf.parameters.paramset function in pyhf

To help you get started, we’ve selected a few pyhf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scikit-hep / pyhf / tests / test_combined_modifiers.py View on Github external
def test_lumi(backend):
    mc = MockConfig(
        par_map={
            'lumi': {
                'paramset': paramset(n_parameters=1, inits=[0], bounds=[[-5, 5]]),
                'slice': slice(0, 1),
            }
        },
        par_order=['lumi'],
        samples=['signal', 'background'],
    )

    mega_mods = {
        'lumi/lumi': {
            'signal': {
                'type': 'lumi',
                'name': 'lumi',
                'data': {'mask': [True, True, True]},
            },
            'background': {
                'type': 'lumi',
github scikit-hep / pyhf / tests / test_combined_modifiers.py View on Github external
def test_stat(backend):
    mc = MockConfig(
        par_map={
            'staterror_chan1': {
                'paramset': paramset(n_parameters=1, inits=[1], bounds=[[0, 10]]),
                'slice': slice(0, 1),
            },
            'staterror_chan2': {
                'paramset': paramset(
                    n_parameters=2, inits=[1, 1], bounds=[[0, 10], [0, 10]]
                ),
                'slice': slice(1, 3),
            },
        },
        channels=['chan1', 'chan2'],
        channel_nbins={'chan1': 1, 'chan2': 2},
        par_order=['staterror_chan1', 'staterror_chan2'],
        samples=['signal', 'background'],
    )

    mega_mods = {
        'staterror/staterror_chan1': {
            'signal': {
                'type': 'staterror',
                'name': 'staterror_chan1',
github scikit-hep / pyhf / tests / test_combined_modifiers.py View on Github external
def test_normfactor(backend):
    mc = MockConfig(
        par_map={
            'mu1': {
                'paramset': paramset(n_parameters=1, inits=[0], bounds=[[0, 10]]),
                'slice': slice(0, 1),
            },
            'mu2': {
                'paramset': paramset(n_parameters=1, inits=[0], bounds=[[0, 10]]),
                'slice': slice(1, 2),
            },
        },
        par_order=['mu1', 'mu2'],
        samples=['signal', 'background'],
    )

    mega_mods = {
        'normfactor/mu1': {
            'signal': {
                'type': 'normfactor',
                'name': 'mu1',
                'data': {'mask': [True, False, False]},
            },
            'background': {
                'type': 'normfactor',
github scikit-hep / pyhf / tests / test_combined_modifiers.py View on Github external
def test_shapesys(backend):
    mc = MockConfig(
        par_map={
            'dummy1': {
                'paramset': paramset(n_parameters=1, inits=[0], bounds=[[0, 10]]),
                'slice': slice(0, 1),
            },
            'shapesys1': {
                'paramset': paramset(n_parameters=1, inits=[0], bounds=[[0, 10]]),
                'slice': slice(1, 2),
            },
            'shapesys2': {
                'paramset': paramset(
                    n_parameters=2, inits=[0, 0], bounds=[[0, 10], [0, 10]]
                ),
                'slice': slice(2, 4),
            },
            'dummy2': {
                'paramset': paramset(n_parameters=1, inits=[0], bounds=[[0, 10]]),
                'slice': slice(4, 5),
            },
        },
        channels=['chan1', 'chan2'],
        channel_nbins={'chan1': 1, 'chan2': 2},
        par_order=['dummy1', 'shapesys1', 'shapesys2', 'dummy2'],
        samples=['signal', 'background'],
    )

    mega_mods = {
github scikit-hep / pyhf / tests / test_combined_modifiers.py View on Github external
def test_normsys(backend):
    mc = MockConfig(
        par_map={
            'hello': {
                'paramset': paramset(n_parameters=1, inits=[0], bounds=[[-5, 5]]),
                'slice': slice(0, 1),
            },
            'world': {
                'paramset': paramset(n_parameters=1, inits=[0], bounds=[[-5, 5]]),
                'slice': slice(1, 2),
            },
        },
        par_order=['hello', 'world'],
        samples=['signal', 'background'],
    )

    mega_mods = {
        'normsys/hello': {
            'signal': {
                'type': 'normsys',
                'name': 'hello',
                'data': {
                    'hi': [1.1] * 3,
                    'lo': [0.9] * 3,
                    'nom_data': [1, 1, 1],
github scikit-hep / pyhf / tests / test_combined_modifiers.py View on Github external
def test_shapefactor(backend):
    mc = MockConfig(
        par_map={
            'shapefac1': {
                'paramset': paramset(n_parameters=1, inits=[0], bounds=[[0, 10]]),
                'slice': slice(0, 1),
            },
            'shapefac2': {
                'paramset': paramset(
                    n_parameters=2, inits=[0, 0], bounds=[[0, 10], [0, 10]]
                ),
                'slice': slice(1, 3),
            },
        },
        par_order=['shapefac1', 'shapefac2'],
        samples=['signal', 'background'],
        channels=['chan_one', 'chan_two'],
        channel_nbins={'chan_one': 1, 'chan_two': 2},
    )

    mega_mods = {
        'shapefactor/shapefac1': {
            'signal': {
                'type': 'shapefactor',
                'name': 'shapefac1',
github scikit-hep / pyhf / tests / test_combined_modifiers.py View on Github external
def test_histosys(backend):
    mc = MockConfig(
        par_map={
            'hello': {
                'paramset': paramset(n_parameters=1, inits=[0], bounds=[[-5, 5]]),
                'slice': slice(0, 1),
            },
            'world': {
                'paramset': paramset(n_parameters=1, inits=[0], bounds=[[-5, 5]]),
                'slice': slice(1, 2),
            },
        },
        par_order=['hello', 'world'],
        samples=['signal', 'background'],
    )

    mega_mods = {
        'histosys/hello': {
            'signal': {
                'type': 'histosys',
                'name': 'hello',
                'data': {
                    'hi_data': [11, 12, 13],
                    'lo_data': [9, 8, 7],
                    'nom_data': [10, 10, 10],