diff --git a/python/PyMaCh3Example.ipynb b/python/PyMaCh3Example.ipynb index 7162d93..f4a48d2 100644 --- a/python/PyMaCh3Example.ipynb +++ b/python/PyMaCh3Example.ipynb @@ -14,20 +14,10 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "413d0743", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "['BinnedSplinesTutorial', 'SamplesTutorial']\n", - "MaCh3_ROOT env var: /home/ewan/software/MaCh3/MaCh3-core-python/build\n", - "Initializing SampleHandlerTutorial bindings... \n" - ] - } - ], + "outputs": [], "source": [ "import os\n", "\n", @@ -56,95 +46,7 @@ "execution_count": null, "id": "4db4aded", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[2026-03-02 15:01:24.555] [info] [ParameterHandlerBase.cpp:30] Constructing instance of ParameterHandler using\n", - "[2026-03-02 15:01:24.555] [info] [ParameterHandlerBase.cpp:34] ../TutorialConfigs/CovObjs/SystematicModel.yaml\n", - "[2026-03-02 15:01:24.555] [info] [ParameterHandlerBase.cpp:36] as an input\n", - "[2026-03-02 15:01:24.555] [info] [ParameterHandlerBase.cpp:39] Principal component analysis but given the threshold for the principal components to be less than 0, or greater than (or equal to) 1. This will not work\n", - "[2026-03-02 15:01:24.555] [info] [ParameterHandlerBase.cpp:40] Please specify a number between 0 and 1\n", - "[2026-03-02 15:01:24.555] [info] [ParameterHandlerBase.cpp:41] You specified: \n", - "[2026-03-02 15:01:24.555] [info] [ParameterHandlerBase.cpp:42] Am instead calling the usual non-PCA constructor...\n", - "[2026-03-02 15:01:24.689] [info] [ParameterTunes.cpp:50] Found 2 tunes:\n", - "[2026-03-02 15:01:24.689] [info] [ParameterTunes.cpp:52] Tune 0 Generated\n", - "[2026-03-02 15:01:24.689] [info] [ParameterTunes.cpp:52] Tune 1 PostND\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerBase.cpp:371] Created covariance matrix from files: \n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerBase.cpp:373] ../TutorialConfigs/CovObjs/SystematicModel.yaml \n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerBase.cpp:375] ----------------\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerBase.cpp:376] Found 10 systematics parameters in total\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerBase.cpp:377] ----------------\n", - "[2026-03-02 15:01:24.689] [warning] [ParameterHandlerGeneric.cpp:281] Spline knot capping enabled with bounds [0.5, 2]. For reliable fits, consider modifying the input generation instead.\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:454] #################################################\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:455] Printing ParameterHandlerGeneric:\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:478] ============================================================================================================================================================\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:479] # | Name | Prior | Error | Lower | Upper | StepScale | SampleNames | Type \n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:480] ------------------------------------------------------------------------------------------------------------------------------------------------------------\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:490] 0 | Norm_Param_0 | 1 | +/- 0.11 | 0 | 999 | 0.2 | Tutorial_*, ND2137 | Norm \n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:490] 1 | Norm_Param_1 | 1 | +/- 0.18 | 0 | 999 | 0.2 | Tutorial_*, ND2137 | Norm \n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:490] 2 | Norm_Param_2 | 1 | +/- 0.40 | 0 | 9999 | 0.2 | Tutorial_*, ND2137 | Norm \n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:490] 3 | BinnedSplineParam1 | 1 | +/- 1.00 | 0 | 2 | 0.2 | Tutorial_*, ND2137 | Spline \n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:490] 4 | BinnedSplineParam2 | 1 | +/- 1.00 | 0 | 2 | 0.2 | Tutorial_*, ND2137 | Spline \n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:490] 5 | BinnedSplineParam3 | 1 | +/- 1.00 | 0 | 2 | 0.2 | Tutorial_*, ND2137 | Spline \n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:490] 6 | BinnedSplineParam4 | 1 | +/- 1.00 | 0 | 2 | 0.2 | Tutorial_*, ND2137 | Spline \n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:490] 7 | BinnedSplineParam5 | 1 | +/- 1.00 | 0 | 2 | 0.2 | Tutorial_*, ND2137 | Spline \n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:490] 8 | EResLep | 0 | +/- 0.01 | -1 | 1 | 0.2 | Tutorial_* | Functional\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:490] 9 | EResTot | 0 | +/- 0.01 | -1 | 1 | 0.2 | Tutorial_* | Functional\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:492] ============================================================================================================================================================\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:499] Normalisation parameters: 3\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:505] ┌────┬──────────┬────────────────────────────────────────┬────────────────────┬────────────────────┬────────────────────┐\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:506] │# │Global # │Name │Int. mode │Target │pdg │\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:507] ├────┼──────────┼────────────────────────────────────────┼────────────────────┼───���────────────────┼────────────────────┤\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:532] │0 │0 │Norm_Param_0 │1 │12 16 │all │\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:532] │1 │1 │Norm_Param_1 │1 │12 16 │all │\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:532] │2 │2 │Norm_Param_2 │1 │12 16 │all │\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:536] └────┴──────────┴────────────────────────────────────────┴────────────────────┴────────────────────┴────────────────────┘\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:539] Normalisation parameters KinematicCuts information\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:540] ┌────┬──────────┬────────────────────────────────────────┬────────────────────┬────────────────────────────────────────┐\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:541] │# │Global # │Name │KinematicCut │Value │\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:542] ├────┼──────────┼────────────────────────────────────────┼────────────────────┼────────────────────────────────────────┤\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:557] │0 │0 │Norm_Param_0 │TrueQ2 │0.25 0.50 │\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:557] │1 │1 │Norm_Param_1 │TrueQ2 │0.50 1.00 │\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:557] │2 │2 │Norm_Param_2 │TrueQ2 │1.00 9999999.90 │\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:562] ��────┴──────────┴────────────────────────────────────────┴────────────────────┴────────────────────────────────────────┘\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:571] Spline parameters: 5\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:573] =====================================================================================================================================================================\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:574] # | Name | Spline Name | Spline Interpolation | Low Knot Bound | Up Knot Bound | \n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:575] ---------------------------------------------------------------------------------------------------------------------------------------------------------------------\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:580] 0 | BinnedSplineParam1 | mysyst1 | TSpline3 | 0.5 | 2 | \n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:580] 1 | BinnedSplineParam2 | mysyst2 | Linear | -9999 | 9999 | \n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:580] 2 | BinnedSplineParam3 | mysyst3 | Monotonic | -9999 | 9999 | \n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:580] 3 | BinnedSplineParam4 | mysyst4 | Akima | -9999 | 9999 | \n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:580] 4 | BinnedSplineParam5 | mysyst5 | Linear | -9999 | 9999 | \n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:587] =====================================================================================================================================================================\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:593] Functional parameters: 2\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:595] ┌────┬──────────┬────────────────────────────────────────┐\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:596] │# │Global # │Name │\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:597] ├────┼──────────┼────────────────────────────────────────┤\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:601] │0 │8 │EResLep │\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:601] │1 │9 │EResTot │\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:603] └────┴──────────┴────────────────────────────────────────┘\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:609] Oscillation parameters: 0\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:633] Printing parameter groups\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:636] Found 10: Xsec params\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:469] Finished\n", - "[2026-03-02 15:01:24.689] [info] [ParameterHandlerGeneric.cpp:470] #################################################\n" - ] - }, - { - "ename": "", - "evalue": "", - "output_type": "error", - "traceback": [ - "\u001b[1;31mThe Kernel crashed while executing code in the current cell or a previous cell. \n", - "\u001b[1;31mPlease review the code in the cell(s) to identify a possible cause of the failure. \n", - "\u001b[1;31mClick here for more info. \n", - "\u001b[1;31mView Jupyter log for further details." - ] - } - ], + "outputs": [], "source": [ "# Create a parameter handler object from the SystematicModel.yaml file\n", "parameter_handler = m3.parameters.ParameterHandlerGeneric([\"../TutorialConfigs/CovObjs/SystematicModel.yaml\"])" @@ -163,15 +65,7 @@ "execution_count": null, "id": "b73be13a", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Number of parameters: 10\n" - ] - } - ], + "outputs": [], "source": [ "# Check how many parameters there are in the parameter handler\n", "num_parameters = parameter_handler.get_n_pars()\n", @@ -241,296 +135,7 @@ "execution_count": null, "id": "43c76314", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Help on module pyMaCh3_tutorial._pyMaCh3.samples in pyMaCh3_tutorial._pyMaCh3:\n", - "\n", - "NAME\n", - " pyMaCh3_tutorial._pyMaCh3.samples - This is a Python binding of MaCh3s C++ based samples library.\n", - "\n", - "CLASSES\n", - " pybind11_builtins.pybind11_object(builtins.object)\n", - " SampleHandlerBase\n", - " SampleHandlerFD\n", - " SampleHandlerTutorial(SampleHandlerFD, SampleHandlerBase)\n", - " TestStatistic\n", - " \n", - " class SampleHandlerBase(pybind11_builtins.pybind11_object)\n", - " | Method resolution order:\n", - " | SampleHandlerBase\n", - " | pybind11_builtins.pybind11_object\n", - " | builtins.object\n", - " | \n", - " | Methods defined here:\n", - " | \n", - " | __init__(...)\n", - " | __init__(self: pyMaCh3_tutorial._pyMaCh3.samples.SampleHandlerBase) -> None\n", - " | \n", - " | get_bin_LLH(...)\n", - " | get_bin_LLH(self: pyMaCh3_tutorial._pyMaCh3.samples.SampleHandlerBase, data: float, mc: float, w2: float) -> float\n", - " | \n", - " | Get the LLH for a bin by comparing the data and MC. The result depends on having previously set the test statistic using :py:meth:`pyMaCh3.samples.SampleHandlerBase.set_test_stat` \n", - " | :param data: The data content of the bin. \n", - " | :param mc: The mc content of the bin \n", - " | :param w2: The Sum(w_{i}^2) (sum of weights squared) in the bin, which is sigma^2_{MC stats}\n", - " | \n", - " | get_likelihood(...)\n", - " | get_likelihood(self: pyMaCh3_tutorial._pyMaCh3.samples.SampleHandlerBase) -> float\n", - " | \n", - " | Get the sample likelihood at the current point in your model space. You will need to override this.\n", - " | \n", - " | reweight(...)\n", - " | reweight(self: pyMaCh3_tutorial._pyMaCh3.samples.SampleHandlerBase) -> None\n", - " | \n", - " | reweight the MC events in this sample. You will need to override this.\n", - " | \n", - " | set_test_stat(...)\n", - " | set_test_stat(self: pyMaCh3_tutorial._pyMaCh3.samples.SampleHandlerBase, test_stat: pyMaCh3_tutorial._pyMaCh3.samples.TestStatistic) -> None\n", - " | \n", - " | Set the test statistic that should be used when calculating likelihoods. \n", - " | :param test_stat: The new test statistic to use\n", - " | \n", - " | ----------------------------------------------------------------------\n", - " | Static methods inherited from pybind11_builtins.pybind11_object:\n", - " | \n", - " | __new__(*args, **kwargs) from pybind11_builtins.pybind11_type\n", - " | Create and return a new object. See help(type) for accurate signature.\n", - " \n", - " class SampleHandlerFD(SampleHandlerBase)\n", - " | Method resolution order:\n", - " | SampleHandlerFD\n", - " | SampleHandlerBase\n", - " | pybind11_builtins.pybind11_object\n", - " | builtins.object\n", - " | \n", - " | Methods defined here:\n", - " | \n", - " | __init__(...)\n", - " | __init__(self: pyMaCh3_tutorial._pyMaCh3.samples.SampleHandlerFD, mc_version: str, xsec_cov: ParameterHandlerGeneric) -> None\n", - " | \n", - " | This should never be called directly as SampleHandlerFD is an abstract base class. \n", - " | However when creating a derived class, in the __init__() method, you should call the parent constructor i.e. this one by doing:: \n", - " | \n", - " | super(, self).__init__(*args)\n", - " | \n", - " | get_data_hist(...)\n", - " | get_data_hist(self: pyMaCh3_tutorial._pyMaCh3.samples.SampleHandlerFD, Dimension: int) -> tuple\n", - " | \n", - " | Get Data histogram as numpy arrays.\n", - " | For 1D: Returns (contents, edges)\n", - " | For 2D: Returns (contents, edgesX, edgesY)\n", - " | where contents is shape (nbinsY, nbinsX) for 2D\n", - " | \n", - " | get_mc_hist(...)\n", - " | get_mc_hist(self: pyMaCh3_tutorial._pyMaCh3.samples.SampleHandlerFD, sample: int) -> tuple\n", - " | \n", - " | Get MC histogram as numpy arrays.\n", - " | For 1D: Returns (contents, edges)\n", - " | For 2D: Returns (contents, edgesX, edgesY)\n", - " | where contents is shape (nbinsY, nbinsX) for 2D\n", - " | \n", - " | get_w2_hist(...)\n", - " | get_w2_hist(self: pyMaCh3_tutorial._pyMaCh3.samples.SampleHandlerFD, Dimension: int) -> tuple\n", - " | \n", - " | Get W2 histogram as numpy arrays.\n", - " | For 1D: Returns (contents, edges)\n", - " | For 2D: Returns (contents, edgesX, edgesY)\n", - " | where contents is shape (nbinsY, nbinsX) for 2D\n", - " | \n", - " | ----------------------------------------------------------------------\n", - " | Methods inherited from SampleHandlerBase:\n", - " | \n", - " | get_bin_LLH(...)\n", - " | get_bin_LLH(self: pyMaCh3_tutorial._pyMaCh3.samples.SampleHandlerBase, data: float, mc: float, w2: float) -> float\n", - " | \n", - " | Get the LLH for a bin by comparing the data and MC. The result depends on having previously set the test statistic using :py:meth:`pyMaCh3.samples.SampleHandlerBase.set_test_stat` \n", - " | :param data: The data content of the bin. \n", - " | :param mc: The mc content of the bin \n", - " | :param w2: The Sum(w_{i}^2) (sum of weights squared) in the bin, which is sigma^2_{MC stats}\n", - " | \n", - " | get_likelihood(...)\n", - " | get_likelihood(self: pyMaCh3_tutorial._pyMaCh3.samples.SampleHandlerBase) -> float\n", - " | \n", - " | Get the sample likelihood at the current point in your model space. You will need to override this.\n", - " | \n", - " | reweight(...)\n", - " | reweight(self: pyMaCh3_tutorial._pyMaCh3.samples.SampleHandlerBase) -> None\n", - " | \n", - " | reweight the MC events in this sample. You will need to override this.\n", - " | \n", - " | set_test_stat(...)\n", - " | set_test_stat(self: pyMaCh3_tutorial._pyMaCh3.samples.SampleHandlerBase, test_stat: pyMaCh3_tutorial._pyMaCh3.samples.TestStatistic) -> None\n", - " | \n", - " | Set the test statistic that should be used when calculating likelihoods. \n", - " | :param test_stat: The new test statistic to use\n", - " | \n", - " | ----------------------------------------------------------------------\n", - " | Static methods inherited from pybind11_builtins.pybind11_object:\n", - " | \n", - " | __new__(*args, **kwargs) from pybind11_builtins.pybind11_type\n", - " | Create and return a new object. See help(type) for accurate signature.\n", - " \n", - " class SampleHandlerTutorial(SampleHandlerFD, SampleHandlerBase)\n", - " | Method resolution order:\n", - " | SampleHandlerTutorial\n", - " | SampleHandlerFD\n", - " | SampleHandlerBase\n", - " | pybind11_builtins.pybind11_object\n", - " | builtins.object\n", - " | \n", - " | Methods defined here:\n", - " | \n", - " | __init__(...)\n", - " | __init__(*args, **kwargs)\n", - " | Overloaded function.\n", - " | \n", - " | 1. __init__(self: pyMaCh3_tutorial._pyMaCh3.samples.SampleHandlerTutorial, mc_version: str, xsec_cov: ParameterHandlerGeneric) -> None\n", - " | \n", - " | Create SampleHandlerTutorial without oscillation handler\n", - " | \n", - " | 2. __init__(self: pyMaCh3_tutorial._pyMaCh3.samples.SampleHandlerTutorial, mc_version: str, xsec_cov: ParameterHandlerGeneric, osc_cov: OscillationHandler = None) -> None\n", - " | \n", - " | Create SampleHandlerTutorial with oscillation handler\n", - " | \n", - " | ----------------------------------------------------------------------\n", - " | Methods inherited from SampleHandlerFD:\n", - " | \n", - " | get_data_hist(...)\n", - " | get_data_hist(self: pyMaCh3_tutorial._pyMaCh3.samples.SampleHandlerFD, Dimension: int) -> tuple\n", - " | \n", - " | Get Data histogram as numpy arrays.\n", - " | For 1D: Returns (contents, edges)\n", - " | For 2D: Returns (contents, edgesX, edgesY)\n", - " | where contents is shape (nbinsY, nbinsX) for 2D\n", - " | \n", - " | get_mc_hist(...)\n", - " | get_mc_hist(self: pyMaCh3_tutorial._pyMaCh3.samples.SampleHandlerFD, sample: int) -> tuple\n", - " | \n", - " | Get MC histogram as numpy arrays.\n", - " | For 1D: Returns (contents, edges)\n", - " | For 2D: Returns (contents, edgesX, edgesY)\n", - " | where contents is shape (nbinsY, nbinsX) for 2D\n", - " | \n", - " | get_w2_hist(...)\n", - " | get_w2_hist(self: pyMaCh3_tutorial._pyMaCh3.samples.SampleHandlerFD, Dimension: int) -> tuple\n", - " | \n", - " | Get W2 histogram as numpy arrays.\n", - " | For 1D: Returns (contents, edges)\n", - " | For 2D: Returns (contents, edgesX, edgesY)\n", - " | where contents is shape (nbinsY, nbinsX) for 2D\n", - " | \n", - " | ----------------------------------------------------------------------\n", - " | Methods inherited from SampleHandlerBase:\n", - " | \n", - " | get_bin_LLH(...)\n", - " | get_bin_LLH(self: pyMaCh3_tutorial._pyMaCh3.samples.SampleHandlerBase, data: float, mc: float, w2: float) -> float\n", - " | \n", - " | Get the LLH for a bin by comparing the data and MC. The result depends on having previously set the test statistic using :py:meth:`pyMaCh3.samples.SampleHandlerBase.set_test_stat` \n", - " | :param data: The data content of the bin. \n", - " | :param mc: The mc content of the bin \n", - " | :param w2: The Sum(w_{i}^2) (sum of weights squared) in the bin, which is sigma^2_{MC stats}\n", - " | \n", - " | get_likelihood(...)\n", - " | get_likelihood(self: pyMaCh3_tutorial._pyMaCh3.samples.SampleHandlerBase) -> float\n", - " | \n", - " | Get the sample likelihood at the current point in your model space. You will need to override this.\n", - " | \n", - " | reweight(...)\n", - " | reweight(self: pyMaCh3_tutorial._pyMaCh3.samples.SampleHandlerBase) -> None\n", - " | \n", - " | reweight the MC events in this sample. You will need to override this.\n", - " | \n", - " | set_test_stat(...)\n", - " | set_test_stat(self: pyMaCh3_tutorial._pyMaCh3.samples.SampleHandlerBase, test_stat: pyMaCh3_tutorial._pyMaCh3.samples.TestStatistic) -> None\n", - " | \n", - " | Set the test statistic that should be used when calculating likelihoods. \n", - " | :param test_stat: The new test statistic to use\n", - " | \n", - " | ----------------------------------------------------------------------\n", - " | Static methods inherited from pybind11_builtins.pybind11_object:\n", - " | \n", - " | __new__(*args, **kwargs) from pybind11_builtins.pybind11_type\n", - " | Create and return a new object. See help(type) for accurate signature.\n", - " \n", - " class TestStatistic(pybind11_builtins.pybind11_object)\n", - " | Method resolution order:\n", - " | TestStatistic\n", - " | pybind11_builtins.pybind11_object\n", - " | builtins.object\n", - " | \n", - " | Methods defined here:\n", - " | \n", - " | __eq__(...)\n", - " | __eq__(self: object, other: object) -> bool\n", - " | \n", - " | __getstate__(...)\n", - " | __getstate__(self: object) -> int\n", - " | \n", - " | __hash__(...)\n", - " | __hash__(self: object) -> int\n", - " | \n", - " | __index__(...)\n", - " | __index__(self: pyMaCh3_tutorial._pyMaCh3.samples.TestStatistic) -> int\n", - " | \n", - " | __init__(...)\n", - " | __init__(self: pyMaCh3_tutorial._pyMaCh3.samples.TestStatistic, value: int) -> None\n", - " | \n", - " | __int__(...)\n", - " | __int__(self: pyMaCh3_tutorial._pyMaCh3.samples.TestStatistic) -> int\n", - " | \n", - " | __ne__(...)\n", - " | __ne__(self: object, other: object) -> bool\n", - " | \n", - " | __repr__(...)\n", - " | __repr__(self: object) -> str\n", - " | \n", - " | __setstate__(...)\n", - " | __setstate__(self: pyMaCh3_tutorial._pyMaCh3.samples.TestStatistic, state: int) -> None\n", - " | \n", - " | __str__(...)\n", - " | __str__(self: object) -> str\n", - " | \n", - " | ----------------------------------------------------------------------\n", - " | Readonly properties defined here:\n", - " | \n", - " | __members__\n", - " | \n", - " | name\n", - " | name(self: object) -> str\n", - " | \n", - " | value\n", - " | \n", - " | ----------------------------------------------------------------------\n", - " | Data and other attributes defined here:\n", - " | \n", - " | Barlow_Beeston = \n", - " | \n", - " | Dembinski_Abdelmottele = \n", - " | \n", - " | Ice_Cube = \n", - " | \n", - " | N_Test_Statistics = \n", - " | \n", - " | Pearson = \n", - " | \n", - " | Poisson = \n", - " | \n", - " | ----------------------------------------------------------------------\n", - " | Static methods inherited from pybind11_builtins.pybind11_object:\n", - " | \n", - " | __new__(*args, **kwargs) from pybind11_builtins.pybind11_type\n", - " | Create and return a new object. See help(type) for accurate signature.\n", - "\n", - "FILE\n", - " (built-in)\n", - "\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "#help(m3.samples)\n", "\n", @@ -550,19 +155,7 @@ "execution_count": null, "id": "b3335d2e", "metadata": {}, - "outputs": [ - { - "ename": "NameError", - "evalue": "name 'sample_handler' is not defined", - "output_type": "error", - "traceback": [ - "\u001b[31m---------------------------------------------------------------------------\u001b[39m", - "\u001b[31mNameError\u001b[39m Traceback (most recent call last)", - "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[6]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m \u001b[43msample_handler\u001b[49m.reweight()\n\u001b[32m 2\u001b[39m mc_prediction, bin_edges = sample_handler.get_mc_hist(\u001b[32m1\u001b[39m)\n\u001b[32m 4\u001b[39m \u001b[38;5;66;03m# count the number of non-zero entries in the MC prediction\u001b[39;00m\n", - "\u001b[31mNameError\u001b[39m: name 'sample_handler' is not defined" - ] - } - ], + "outputs": [], "source": [ "sample_handler.reweight()\n", "mc_prediction, bin_edges = sample_handler.get_mc_hist(1)\n",