Blinding

[1]:
import pandas as pd
import seaborn as sns

from freeforestml import Variable, Process, Cut, hist, McStack, DataStack, Stack, \
                    RangeBlindingStrategy
from freeforestml import toydata, example_style
example_style()
Matplotlib is building the font cache; this may take a moment.
2023-08-02 16:27:36.277847: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 AVX512F FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-08-02 16:27:36.414126: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory
2023-08-02 16:27:36.414155: I tensorflow/compiler/xla/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2023-08-02 16:27:37.236623: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory
2023-08-02 16:27:37.236783: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory
2023-08-02 16:27:37.236797: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
[2]:
df = toydata.get()
Cannot find cached data. Recreating toy data. This might take some time...

Setup

Setup processes:

[3]:
p_ztt = Process(r"$Z\rightarrow\tau\tau$", range=(0, 0))
p_sig = Process(r"Signal", range=(1, 1))

p_asimov = Process(r"Asimov", selection=lambda d: d.fpid >= 0)

Setup up stacks:

[4]:
colors = ["windows blue", "amber", "greyish", "faded green", "dusty purple"]
s_mc = McStack(p_ztt, p_sig, palette=sns.xkcd_palette(colors))
s_data = DataStack(p_asimov)

Define the blinding strategy for a variables:

[5]:
b_higgs_m = RangeBlindingStrategy(99, 150)

The the blinding strategy to the variable definition.

[6]:
v_higgs_m = Variable(r"$m^H$", "higgs_m", "GeV", blinding=b_higgs_m)

Plotting

Stacks passed to blind argument will be blinded according to blind strategy of variable v_higgs_m.

Blind data stack

[7]:
hist(df, v_higgs_m, 20, [s_mc, s_data], range=(0, 200),
     weight="weight",  ratio_label="Data / SM", blind=[s_data], diff=True)
None
_images/Blinding_15_0.png

Blind MC stack

[8]:
hist(df, v_higgs_m, 20, [s_mc, s_data], range=(0, 200),
     weight="weight",  ratio_label="Data / SM", blind=[s_mc])
None
_images/Blinding_17_0.png

Blind both stacks

blind argument can be a single stack or a list of stacks.

[9]:
hist(df, v_higgs_m, 20, [s_mc, s_data], range=(0, 200),
     weight="weight",  ratio_label="Data / SM", blind=[s_mc, s_data])
None
_images/Blinding_19_0.png
[ ]: