Scanner

Scanner

class clusterking.scan.Scanner[source]

Bases: object

__init__()[source]
spoints

Points in parameter space that are sampled.

set_dfunction(func: Callable, binning: collections.abc.Sized = None, normalize=False, **kwargs)[source]

Set the function that generates the distributions that are later clustered (e.g. a differential cross section).

Parameters:
  • func – A function that takes the point in parameter space as the first argument. It should either return a float (if the binning option is specified), or a np.array elsewise.
  • binning – If this parameter is not set (None), we will use the function as is. If it is set to an array-like object, we will integrate the function over the bins specified by this parameter.
  • normalize – If a binning is specified, normalize the resulting distribution
  • **kwargs – All other keyword arguments are passed to the function.
Returns:

None

Warning

The function func has to be a globally defined function, else you will probably run into the error Can't pickle local object ... that is issued by the python multiprocessing module.

run(data: clusterking.data.data.Data, no_workers=None) → None[source]

Calculate all sample points in parallel and saves the result in self.df.

Parameters:
  • data – Data object.
  • no_workers – Number of worker nodes/cores. Default: Total number of cores.

WilsonScanner

class clusterking.scan.WilsonScanner[source]

Bases: clusterking.scan.scanner.Scanner

Scans the NP parameter space in a grid and also in the kinematic variable.

Usage example:

import flavio
import functools
import numpy as np
import clusterking as ck

# Initialize Scanner object
s = ck.scan.WilsonScanner()

# Sample 4 points for each of the 5 Wilson coefficients
s.set_spoints_equidist(
    {
        "CVL_bctaunutau": (-1, 1, 4),
        "CSL_bctaunutau": (-1, 1, 4),
        "CT_bctaunutau": (-1, 1, 4)
    },
    scale=5,
    eft='WET',
    basis='flavio'
)

# Set function and binning
s.set_dfunction(
    functools.partial(flavio.np_prediction, "dBR/dq2(B+->Dtaunu)"),
    binning=np.linspace(3.15, 11.66, 10),
    normalize=True
)

# Initialize a Data objects to write to
d = ck.Data()

# Start running with maximally 3 cores and write the results to Data
s.run(d)
__init__()[source]
set_spoints_grid(values, scale, eft, basis) → None[source]

Set a grid of points in wilson space.

Parameters:
  • values

    A dictionary of the following form:

    {
        <wilson coeff name>: [
            value1,
            value2,
            ...
        ]
    }
    
  • scale – Wilson coeff input scale in GeV
  • eft – Wilson coeff input eft
  • basis – Wilson coeff input basis
set_spoints_equidist(ranges, scale, eft, basis) → None[source]

Set a list of ‘equidistant’ points in wilson space.

Parameters:
  • ranges

    A dictionary of the following form:

    {
        <wilson coeff name>: (
            <Minimum of wilson coeff>,
            <Maximum of wilson coeff>,
            <Number of bins between min and max>,
        )
    }
    
  • scale – <Wilson coeff input scale in GeV>,
  • eft – <Wilson coeff input eft>,
  • basis – <Wilson coeff input basis>
Returns:

None