Skip to content

Commit e36eecc

Browse files
make it work with older spey versions also
1 parent d75b3b6 commit e36eecc

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

smodels/statistics/speyTools.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313

1414
from typing import Union, Text, Tuple, Dict, List
1515
from spey import ExpectationType, StatisticalModel, get_backend
16-
from spey.system.exceptions import AsimovTestStatZero
16+
import spey
17+
try:
18+
from spey.system.exceptions import AsimovTestStatZero
19+
except ImportError: # comes only with newer versions of spey
20+
AsimovTestStatZero = Exception # a dummy so we can still try
1721
from smodels.base.smodelsLogging import logger
1822
from smodels.base.physicsUnits import fb
1923
from smodels.experiment.datasetObj import DataSet
@@ -207,7 +211,10 @@ def getStatModelMultiBin(self,
207211
if hasattr ( ds.dataInfo, "thirdMoment" ):
208212
thirdmomenta.append ( ds.dataInfo.thirdMoment )
209213
if len(thirdmomenta)==0: # SLv1
210-
stat_wrapper = get_backend("default.correlated_background")
214+
try:
215+
stat_wrapper = get_backend("default.correlated_background")
216+
except spey.PluginError as e: ## older spey?
217+
stat_wrapper = get_backend("default_pdf.correlated_background")
211218
if _debug["writePoint"]:
212219
f=open ( "data.txt","wt" )
213220
f.write ( f"obsN={obsN}\n" )

0 commit comments

Comments
 (0)