Skip to content

Commit

Permalink
unittests readded, so we can merge
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangWaltenberger committed Oct 24, 2024
1 parent 72f8da8 commit 8b27fd2
Show file tree
Hide file tree
Showing 2,017 changed files with 1,458,444 additions and 0 deletions.
25 changes: 25 additions & 0 deletions unittests/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
all: test

test:
./runCompleteTestSuite.py -v -n

test_norecipes:
./runCompleteTestSuite.py -v

reduced:
./runCompleteTestSuite.py -r -v

obs:
py.test -v

run_coverage:
coverage run runCompleteTestSuite.py

coverage:
coverage report --omit="/usr/lib/*,testFiles/scanExample/*,*/.local/*,unitTestOutput/*,test*py,test*py" -i
rm -rf htmlcov/
coverage html --omit="/usr/lib/*,testFiles/scanExample/*,*/.local/*,unitTestOutput/*,test*py,test*py" -i
cp htmlcov/* ../../smodels.github.io/coverage/

notebook:
ipython notebook
1 change: 1 addition & 0 deletions unittests/T1tttt_comb_default.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
smodelsOutputDefault = {'OutputStatus': {'sigmacut': 0.03, 'minmassgap': 5.0, 'maxcond': 0.2, 'ncpus': -6, 'file status': 1, 'decomposition status': 1, 'warnings': 'Input file ok', 'input file': 'testFiles/slha/T1tttt.slha', 'database version': 'unittest211', 'smodels version': '2.2.0'}, 'ExptRes': [{'maxcond': 0.0, 'theory prediction (fb)': 4.669625, 'upper limit (fb)': 0.081354, 'expected upper limit (fb)': 0.081354, 'TxNames': ['T1tttt'], 'Mass (GeV)': [[675.0, 200.0], [675.0, 200.0]], 'AnalysisID': 'CMS-SUS-16-050-agg', 'DataSetID': 'ar55', 'AnalysisSqrts (TeV)': 13.0, 'lumi (fb-1)': 35.9, 'dataType': 'efficiencyMap', 'r': 57.39884, 'r_expected': 57.39884, 'Width (GeV)': [['prompt', 'stable'], ['prompt', 'stable']], 'likelihood': 3.938979304647101e-74, 'l_max': 0.2513719, 'l_SM': 0.2513719}, {'maxcond': 0.0, 'theory prediction (fb)': 4309.035, 'upper limit (fb)': 141.1736, 'expected upper limit (fb)': None, 'TxNames': ['T1tttt'], 'Mass (GeV)': [[675.0, 200.0], [675.0, 200.0]], 'AnalysisID': 'CMS-PAS-SUS-15-002', 'DataSetID': None, 'AnalysisSqrts (TeV)': 13.0, 'lumi (fb-1)': 2.2, 'dataType': 'upperLimit', 'r': 30.52296, 'r_expected': None, 'Width (GeV)': [['prompt', 'stable'], ['prompt', 'stable']]}, {'maxcond': 0.0, 'theory prediction (fb)': 572.1689, 'upper limit (fb)': 62.581, 'expected upper limit (fb)': 92.717, 'TxNames': ['T1tttt'], 'Mass (GeV)': [[675.0, 200.0], [675.0, 200.0]], 'AnalysisID': 'CMS-PAS-SUS-12-026', 'DataSetID': None, 'AnalysisSqrts (TeV)': 8.0, 'lumi (fb-1)': 9.2, 'dataType': 'upperLimit', 'r': 9.142854, 'r_expected': 6.171133, 'Width (GeV)': [['prompt', 'stable'], ['prompt', 'stable']]}, {'maxcond': 0.0, 'theory prediction (fb)': 2.369623, 'upper limit (fb)': 0.4, 'expected upper limit (fb)': 0.433, 'TxNames': ['T1tttt'], 'Mass (GeV)': [[675.0, 200.0], [675.0, 200.0]], 'AnalysisID': 'ATLAS-CONF-2013-037', 'DataSetID': 'SRbC3', 'AnalysisSqrts (TeV)': 8.0, 'lumi (fb-1)': 20.7, 'dataType': 'efficiencyMap', 'r': 5.924058, 'r_expected': 5.472571, 'Width (GeV)': [['prompt', 'stable'], ['prompt', 'stable']], 'likelihood': 8.800609000000001e-17, 'l_max': 0.02067189, 'l_SM': 0.02067189}, {'maxcond': 0.0, 'theory prediction (fb)': 2.962771, 'upper limit (fb)': 0.5171654, 'expected upper limit (fb)': 0.3654986, 'TxNames': ['T1tttt'], 'Mass (GeV)': [[675.0, 200.0], [675.0, 200.0]], 'AnalysisID': 'CMS-SUS-13-012', 'DataSetID': '8NJetinf_1000HT1250_200MHTinf', 'AnalysisSqrts (TeV)': 8.0, 'lumi (fb-1)': 19.5, 'dataType': 'efficiencyMap', 'r': 5.728866, 'r_expected': 8.106107, 'Width (GeV)': [['prompt', 'stable'], ['prompt', 'stable']], 'likelihood': 1.949589e-18, 'l_max': 0.0265176, 'l_SM': 0.02060875}], 'CombinedRes': [{'AnalysisID': 'CMS-SUS-13-012,CMS-SUS-16-050-agg', 'r': 110.3102, 'r_expected': 116.688, 'likelihood': 7.679392482807625e-92, 'l_max': 0.008212736, 'l_SM': 0.005180459}], 'Total xsec for missing topologies (fb)': 0.0, 'missing topologies': [], 'Total xsec for missing topologies with displaced decays (fb)': 0.0, 'missing topologies with displaced decays': [], 'Total xsec for missing topologies with prompt decays (fb)': 0.0, 'missing topologies with prompt decays': [], 'Total xsec for topologies outside the grid (fb)': 0.0, 'topologies outside the grid': []}
51 changes: 51 additions & 0 deletions unittests/T6bbHH_pyhf_default.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
smodelsOutputDefault = {
'OutputStatus' : {
'sigmacut' : 0.03,
'minmassgap' : 5.0,
'maxcond' : 0.2,
'ncpus' : -1,
'model' : 'share.models.mssm',
'checkinput' : True,
'doinvisible' : True,
'docompress' : True,
'computestatistics' : False,
'testcoverage' : True,
'combinesrs' : True,
'file status' : 1,
'decomposition status' : 1,
'warnings' : 'Input file ok',
'input file' : './testFiles/slha/T6bbHH_pyhf.slha',
'database version' : 'unittest211',
'smodels version' : '2.2.0'
},
'ExptRes' : [
{
'maxcond' : 0.0,
'theory prediction (fb)' : 0.10091,
'upper limit (fb)' : 0.08247307,
'expected upper limit (fb)' : 0.1200876,
'TxNames' : ['T6bbHH'],
'Mass (GeV)' : [[1400.0, 1000.0, 60.0], [1400.0, 1000.0, 60.0]],
'AnalysisID' : 'ATLAS-SUSY-2018-31',
'DataSetID' : '(combined)',
'AnalysisSqrts (TeV)' : 13.0,
'lumi (fb-1)' : 139.0,
'dataType' : 'combined',
'r' : 1.223551,
'r_expected' : 0.8403036,
'Width (GeV)' : [[1.0, 1.0, 'stable'], [1.0, 1.0, 'stable']],
'nll' : 51.35556035013835,
'nll_min' : 48.38229103232457,
'nll_SM' : 48.38229103232457
}
],
'Total xsec for missing topologies (fb)' : 0.0,
'missing topologies' : [],
'Total xsec for missing topologies with displaced decays (fb)' : 0.0,
'missing topologies with displaced decays' : [],
'Total xsec for missing topologies with prompt decays (fb)' : 0.0,
'missing topologies with prompt decays' : [],
'Total xsec for topologies outside the grid (fb)' : 0.0,
'topologies outside the grid' : []
}

226 changes: 226 additions & 0 deletions unittests/TRV1_1800_300_300.slha
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@

######################################################################
## PARAM_CARD AUTOMATICALY GENERATED BY MG5 ####
######################################################################
###################################
## INFORMATION FOR CKMBLOCK
###################################
BLOCK CKMBLOCK #
1 2.277360e-01 # cabi
###################################
## INFORMATION FOR DMINPUTS
###################################
BLOCK DMINPUTS #
1 0.000000e+00 # gvxc
2 1.000000e+00 # gvxd
3 0.000000e+00 # gaxd
4 2.500000e-01 # gvd11
5 2.500000e-01 # gvu11
6 2.500000e-01 # gvd22
7 2.500000e-01 # gvu22
8 2.500000e-01 # gvd33
9 2.500000e-01 # gvu33
10 0.000000e+00 # gad11
11 0.000000e+00 # gau11
12 0.000000e+00 # gad22
13 0.000000e+00 # gau22
14 0.000000e+00 # gad33
15 0.000000e+00 # gau33
16 0.000000e+00 # gvh
###################################
## INFORMATION FOR MASS
###################################
BLOCK MASS #
6 1.720000e+02 # mt
15 1.777000e+00 # mta
23 9.118760e+01 # mz
25 1.250000e+02 # mh
51 1.000000e+00 # mxc
52 3.000000e+02 # mxd
55 1.800000e+03 # my1
5000001 1.000000e+01 # mxr
1 0.000000e+00 # d : 0.0
2 0.000000e+00 # u : 0.0
3 0.000000e+00 # s : 0.0
4 0.000000e+00 # c : 0.0
5 0.000000e+00 # b : 0.0
11 0.000000e+00 # e- : 0.0
12 0.000000e+00 # ve : 0.0
13 0.000000e+00 # mu- : 0.0
14 0.000000e+00 # vm : 0.0
16 0.000000e+00 # vt : 0.0
21 0.000000e+00 # g : 0.0
22 0.000000e+00 # a : 0.0
24 7.982436e+01 # w+ : cmath.sqrt(mz__exp__2/2. + cmath.sqrt(mz__exp__4/4. - (aew*cmath.pi*mz__exp__2)/(gf*sqrt__2)))
9000002 9.118760e+01 # ghz : mz
9000003 7.982436e+01 # ghwp : mw
9000004 7.982436e+01 # ghwm : mw
###################################
## INFORMATION FOR SMINPUTS
###################################
BLOCK SMINPUTS #
1 1.279000e+02 # aewm1
2 1.166370e-05 # gf
3 1.300000e-01 # as (note that parameter not used if you use a pdf set)
###################################
## INFORMATION FOR YUKAWA
###################################
BLOCK YUKAWA #
6 1.720000e+02 # ymt
15 1.777000e+00 # ymtau
###################################
## INFORMATION FOR QNUMBERS 9000001
###################################
BLOCK QNUMBERS 9000001 # gha
1 0 # 3 times electric charge
2 1 # number of spin states (2s+1)
3 1 # colour rep (1: singlet, 3: triplet, 8: octet)
4 1 # particle/antiparticle distinction (0=own anti)
###################################
## INFORMATION FOR QNUMBERS 9000002
###################################
BLOCK QNUMBERS 9000002 # ghz
1 0 # 3 times electric charge
2 1 # number of spin states (2s+1)
3 1 # colour rep (1: singlet, 3: triplet, 8: octet)
4 1 # particle/antiparticle distinction (0=own anti)
###################################
## INFORMATION FOR QNUMBERS 9000003
###################################
BLOCK QNUMBERS 9000003 # ghwp
1 3 # 3 times electric charge
2 1 # number of spin states (2s+1)
3 1 # colour rep (1: singlet, 3: triplet, 8: octet)
4 1 # particle/antiparticle distinction (0=own anti)
###################################
## INFORMATION FOR QNUMBERS 9000004
###################################
BLOCK QNUMBERS 9000004 # ghwm
1 -3 # 3 times electric charge
2 1 # number of spin states (2s+1)
3 1 # colour rep (1: singlet, 3: triplet, 8: octet)
4 1 # particle/antiparticle distinction (0=own anti)
###################################
## INFORMATION FOR QNUMBERS 82
###################################
BLOCK QNUMBERS 82 # ghg
1 0 # 3 times electric charge
2 1 # number of spin states (2s+1)
3 8 # colour rep (1: singlet, 3: triplet, 8: octet)
4 1 # particle/antiparticle distinction (0=own anti)
###################################
## INFORMATION FOR QNUMBERS 5000001
###################################
BLOCK QNUMBERS 5000001 # xr
1 0 # 3 times electric charge
2 1 # number of spin states (2s+1)
3 1 # colour rep (1: singlet, 3: triplet, 8: octet)
4 0 # particle/antiparticle distinction (0=own anti)
###################################
## INFORMATION FOR QNUMBERS 51
###################################
BLOCK QNUMBERS 51 # xc
1 0 # 3 times electric charge
2 1 # number of spin states (2s+1)
3 1 # colour rep (1: singlet, 3: triplet, 8: octet)
4 1 # particle/antiparticle distinction (0=own anti)
###################################
## INFORMATION FOR QNUMBERS 52
###################################
BLOCK QNUMBERS 52 # xd
1 0 # 3 times electric charge
2 2 # number of spin states (2s+1)
3 1 # colour rep (1: singlet, 3: triplet, 8: octet)
4 1 # particle/antiparticle distinction (0=own anti)
###################################
## INFORMATION FOR QNUMBERS 55
###################################
BLOCK QNUMBERS 55 # y1
1 0 # 3 times electric charge
2 3 # number of spin states (2s+1)
3 1 # colour rep (1: singlet, 3: triplet, 8: octet)
4 0 # particle/antiparticle distinction (0=own anti)
#
#*************************
# Decay widths *
#*************************
#
# PDG Width
DECAY 1 0.000000e+00
#
# PDG Width
DECAY 2 0.000000e+00
#
# PDG Width
DECAY 3 0.000000e+00
#
# PDG Width
DECAY 4 0.000000e+00
#
# PDG Width
DECAY 5 0.000000e+00
#
# PDG Width
DECAY 6 1.508336e+00
#
# PDG Width
DECAY 11 0.000000e+00
#
# PDG Width
DECAY 12 0.000000e+00
#
# PDG Width
DECAY 13 0.000000e+00
#
# PDG Width
DECAY 14 0.000000e+00
#
# PDG Width
DECAY 15 0.000000e+00
#
# PDG Width
DECAY 16 0.000000e+00
#
# PDG Width
DECAY 21 0.000000e+00
#
# PDG Width
DECAY 22 0.000000e+00
#
# PDG Width
DECAY 23 2.495200e+00
#
# PDG Width
DECAY 24 2.085000e+00
#
# PDG Width
DECAY 25 4.070000e-03
#
# PDG Width
DECAY 51 0.000000e+00
#
# PDG Width
DECAY 52 0.000000e+00
#
# PDG Width
DECAY 55 1.780000e+01
# BR NDA ID1 ID2 ...
0.700000e+00 2 52 -52
0.1500000e+00 2 1 -1
0.1500000e+00 2 2 -2
#
# PDG Width
DECAY 5000001 0.000000e+00
#
# PDG Width
DECAY 9000002 2.495200e+00
#
# PDG Width
DECAY 9000003 2.085000e+00
#
# PDG Width
DECAY 9000004 2.085000e+00


XSECTION 1.30E+04 2212 2212 1 55 # Nevts: 10000 xsec unit: pb
0 1 0 0 0 0 1.2967e+00 MadGraph
1 change: 1 addition & 0 deletions unittests/bad_default.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
smodelsOutputDefault = {'OutputStatus': {'minmassgap': 5.0, 'input file': '/home/walten/git/smodels/inputFiles/slha/I_dont_exist.slha', 'decomposition status': -2, 'warnings': 'Unknown input type: None', 'ncpus': -1, 'maxcond': 0.2, 'smodels version': '1.1.1', 'database version': 'unittest', 'sigmacut': 0.03, 'file status': -5}}
26 changes: 26 additions & 0 deletions unittests/buildPickles.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env python3

import glob, shutil, os

def rmOldPickles():
files = glob.glob ( "**/*.pcl", recursive=True )
files += glob.glob ( "**/.*.pcl", recursive=True )
for f in files:
if not "notebookTests" in f:
print ( f"[buildPickles] rm {f}" )
os.unlink ( f )

def buildDatabases():
from smodels.experiment.databaseObj import Database
versionfiles = glob.glob ( "*/version" )
for versionfile in versionfiles:
dbpath = versionfile.replace("/version","")
print ( dbpath )
try:
db = Database ( dbpath )
except Exception as e:
print ( f"error: {e}" )

if __name__ == "__main__":
rmOldPickles()
buildDatabases()
Loading

0 comments on commit 8b27fd2

Please sign in to comment.