Skip to content

Commit

Permalink
Small changes in experimentalFeatures
Browse files Browse the repository at this point in the history
  • Loading branch information
andlessa committed Dec 2, 2024
1 parent fe48f61 commit 783204a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
20 changes: 13 additions & 7 deletions smodels/matching/modelTester.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ def testPoint(inputFile, outputDir, parser, database):
useBest = False
except (NoSectionError, NoOptionError):
pass
setExperimentalFeatures( parser )

if parser.has_section ( "experimentalFeatures" ):
featuresDict = dict(parser.items("experimentalFeatures"))
setExperimentalFeatures( featuresDict )

allPredictions = theoryPredictionsFor(database, smstoplist,
useBestDataset=useBest,
Expand Down Expand Up @@ -526,7 +529,11 @@ def getParameters(parameterFile):
if ret == []:
logger.error("No such file or directory: '%s'" % parameterFile)
sys.exit()
setExperimentalFeatures(parser)

if parser.has_section ( "experimentalFeatures" ):
featuresDict = dict(parser.items("experimentalFeatures"))
setExperimentalFeatures(featuresDict)

try:
runtime.modelFile = parser.get("particles", "model")
except:
Expand All @@ -540,15 +547,14 @@ def getParameters(parameterFile):
return parser


def setExperimentalFeatures(parser):
def setExperimentalFeatures(featuresDict):
""" set the experimental features flats, if experimentalFeatures:* = True """
if not parser.has_section ( "experimentalFeatures" ):
return
for feature in dict(parser.items("experimentalFeatures")).keys():

for feature in featuresDict.keys():
if not feature in runtime._experimental:
logger.warning ( f"'{feature}' is not a known experimental feature. will ignore." )
continue
flag = parser.getboolean ( "experimentalFeatures", feature )
flag = bool(featuresDict[feature])
runtime._experimental[feature]=flag

def getAllInputFiles(inFile):
Expand Down
2 changes: 1 addition & 1 deletion smodels/statistics/pyhfInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ def likelihood( self, mu=1.0, workspace_index=None, return_nll=False,
compute a priori expected, if "posteriori" compute posteriori \
expected
"""
if True and workspace_index in self.data.cached_likelihoods[expected] and \
if workspace_index in self.data.cached_likelihoods[expected] and \
mu in self.data.cached_likelihoods[expected][workspace_index]:
return self.data.cached_likelihoods[expected][workspace_index][mu]

Expand Down

0 comments on commit 783204a

Please sign in to comment.