Skip to content

Commit

Permalink
split up line in Example.py into three
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangWaltenberger committed Oct 30, 2024
1 parent 164b6e1 commit 8626fb1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
4 changes: 3 additions & 1 deletion Example.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
import os

from smodels.statistics.pyhfInterface import setBackend
setBackend("pytorch") # set to one of: numpy (default), pytorch, tensorflow, jax. WARNING: if backend specified is not found, we fall back to numpy!
# set pyhf backend to one of: numpy (default), pytorch, tensorflow, jax.
# WARNING: if backend specified is not found, we fall back to numpy!
setBackend("pytorch")

def main(inputFile='./inputFiles/slha/lightEWinos.slha', sigmacut=0.05*fb,
database = 'official'):
Expand Down
38 changes: 19 additions & 19 deletions docs/manual/source/RunningSModelS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -402,44 +402,44 @@ Below we go step-by-step through this example code:
* *Define the pyhfbackend to use*. Specify which `pyhfbackend <statistics.html#statistics.pyhfInterface.setBackend>`_ to use. One of: numpy, pytorch, tensorflow, jax.

.. literalinclude:: /examples/Example.py
:lines: 27-28
:lines: 27-30

* *Set the path to the database URL*. Specify which :ref:`database <databaseStruct>` to use. It can be the path
to the smodels-database folder, the path to a :ref:`pickle file <databasePickle>` or (starting with v1.1.3) a URL path.

.. literalinclude:: /examples/Example.py
:lines: 36-37
:lines: 38-39


* *Load the BSM particles*. By default SModelS assumes the MSSM particle content. For using SModelS
with a different particle content, the user must define the new particle content and set modelFile
to the path of the model file (see **particles:model** in :ref:`Parameter File <parameterFile>`).

.. literalinclude:: /examples/Example.py
:lines: 39-41
:lines: 41-43

* *Load the model and set the path to the input file*. Load BSM and SM particle content; specify the location of the input file (must be an SLHA or LHE file, see :ref:`Basic Input <BasicInput>`) and update particles in the model.

.. literalinclude:: /examples/Example.py
:lines: 43,46,48-49
:lines: 45,48,50-51

* *Set main options for* |decomposition|.
Specify the values of :ref:`sigmacut <minweight>` and :ref:`minmassgap <massComp>`:

.. literalinclude:: /examples/Example.py
:lines: 52-53
:lines: 54-55

* |Decompose| *model* using the
`decomposer.decompose <decomposition.html#decomposition.decomposer.decompose>`_ method. The **doCompress** and **doInvisible** options turn the |mass compression| and |invisible compression| on/off.

.. literalinclude:: /examples/Example.py
:lines: 57-59
:lines: 59-61

* *Access basic information* from decomposition, using the
`dictionary of SMS <decomposition.html#decomposition.topologyDict.TopologyDict>`_ (the dictionary has as keys the :ref:`canonical name <canonicalName>` for the topology and as values the list of |SMS topologies| for the corresponding canonical name):

.. literalinclude:: /examples/Example.py
:lines: 62-66
:lines: 64-68

*output:*

Expand All @@ -449,7 +449,7 @@ Below we go step-by-step through this example code:
* *Print information about the SMS topologies* from the decomposition:

.. literalinclude:: /examples/Example.py
:lines: 69-75
:lines: 71-77

*output:*

Expand All @@ -461,7 +461,7 @@ Below we go step-by-step through this example code:
Here, all results are used:

.. literalinclude:: /examples/Example.py
:lines: 79
:lines: 81

Alternatively, the `getExpResults <experiment.html#experiment.databaseObj.Database.getExpResults>`_ method
can take as arguments specific results to be loaded and used.
Expand All @@ -470,7 +470,7 @@ can take as arguments specific results to be loaded and used.
Below we show how to count the number of |ULrs| and |EMrs| loaded:

.. literalinclude:: /examples/Example.py
:lines: 85-92
:lines: 87-94

*output:*

Expand All @@ -483,13 +483,13 @@ can take as arguments specific results to be loaded and used.
`theory prediction objects <matching.html#matching.theoryPrediction.TheoryPrediction>`_:

.. literalinclude:: /examples/Example.py
:lines: 97
:lines: 99

* *Print the results*. For each |expres|, loop over the corresponding |theory predictions|
and print the relevant information:

.. literalinclude:: /examples/Example.py
:lines: 98-107
:lines: 100-109

*output:*

Expand All @@ -500,7 +500,7 @@ can take as arguments specific results to be loaded and used.
be compared to the |theory prediction| to decide whether a model is excluded or not:

.. literalinclude:: /examples/Example.py
:lines: 110
:lines: 112

*output:*

Expand All @@ -513,7 +513,7 @@ can take as arguments specific results to be loaded and used.
Determine the most constraining result:

.. literalinclude:: /examples/Example.py
:lines: 113-119
:lines: 115-121

*output:*

Expand All @@ -524,7 +524,7 @@ can take as arguments specific results to be loaded and used.
determine if the model has been excluded or not by the selected |express|:

.. literalinclude:: /examples/Example.py
:lines: 120-129
:lines: 122-131


*output:*
Expand All @@ -535,17 +535,17 @@ can take as arguments specific results to be loaded and used.
* *Select analyses*. Using the theory predictions, select a (user-defined) subset of analyses to be combined:

.. literalinclude:: /examples/Example.py
:lines: 134-142
:lines: 136-144

* *Combine analyses*. Using the selected analyses, combine them under the assumption they are fully uncorrelated:

.. literalinclude:: /examples/Example.py
:lines: 149
:lines: 151

* *Print the combination*. Print the *r*-values and likelihoods for the combination:

.. literalinclude:: /examples/Example.py
:lines: 154-157
:lines: 156-159

*output:*

Expand All @@ -556,7 +556,7 @@ can take as arguments specific results to be loaded and used.
the :ref:`missing topologies <topCoverage>` and print some basic information:

.. literalinclude:: /examples/Example.py
:lines: 162-168
:lines: 164-170


*output:*
Expand Down
4 changes: 3 additions & 1 deletion docs/manual/source/examples/Example.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
import os

from smodels.statistics.pyhfInterface import setBackend
setBackend("pytorch") # set to one of: numpy (default), pytorch, tensorflow, jax. WARNING: if backend specified is not found, we fall back to numpy!
# set pyhf backend to one of: numpy (default), pytorch, tensorflow, jax.
# WARNING: if backend specified is not found, we fall back to numpy!
setBackend("pytorch")

def main(inputFile='./inputFiles/slha/lightEWinos.slha', sigmacut=0.05*fb,
database = 'official'):
Expand Down

0 comments on commit 8626fb1

Please sign in to comment.