Skip to content

Commit 793f050

Browse files
fixed evaluationType docstrings
1 parent af7d01e commit 793f050

File tree

7 files changed

+36
-39
lines changed

7 files changed

+36
-39
lines changed

smodels/experiment/datasetObj.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,10 +358,10 @@ def getUpperLimitFor(self, sms=None, evaluationType=False, txnames=None,
358358
:param sms: SMS object (only for UL-type results)
359359
:param mass: Mass array (only for UL-type results)
360360
:param alpha: Can be used to change the C.L. value. The default value is 0.05
361-
(= 95% C.L.) (only for efficiency-map results)
361+
(= 95% C.L.) (only for efficiency-map results)
362362
:param deltas_rel: relative uncertainty in signal (float). Default value is 20%.
363-
:param expected: Compute evaluationType limit, i.e. Nobserved = NexpectedBG
364-
(only for efficiency-map results)
363+
:param evaluationType: one of: observed, apriori, aposteriori
364+
(only for efficiency-map results)
365365
:param compute: If True, the upper limit will be computed
366366
from expected and observed number of events.
367367
If False, the value listed in the database will be used
@@ -419,9 +419,9 @@ def getSRUpperLimit(self,evaluationType : NllEvalType = observed ):
419419
Returns the 95% upper limit on the signal*efficiency for a given dataset (signal region).
420420
Only to be used for efficiency map type results.
421421
422-
:param expected: If True, return the evaluationType limit ( i.e. Nobserved = NexpectedBG )
422+
:param evaluationType: one of: observed, apriori, aposteriori
423423
424-
:return: upper limit value
424+
:returns: upper limit value
425425
"""
426426

427427
if not self.getType() == 'efficiencyMap':

smodels/experiment/expResultObj.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,9 @@ def getUpperLimitFor(self, dataID=None, alpha=0.05, evaluationType=False,
258258
259259
:param dataID: dataset ID (string) (only for efficiency-map type results)
260260
:param alpha: Can be used to change the C.L. value. The default value is 0.05
261-
(= 95% C.L.) (only for efficiency-map results)
262-
:param expected: Compute evaluationType limit, i.e. Nobserved = NexpectedBG
263-
(only for efficiency-map results)
261+
(= 95% C.L.) (only for efficiency-map results)
262+
:param evaluationType: Compute <evaluationType> limit, e.g. Nobserved = NexpectedBG
263+
for a priori (only for efficiency-map results)
264264
:param txname: TxName object or txname string (only for UL-type results)
265265
:param sms: SMS object
266266
:param mass: Mass array

smodels/experiment/txnameObj.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ def getULFor(self, sms, evaluationType : NllEvalType = observed, mass=None):
820820
821821
822822
:param sms: SMS object or mass array (with units)
823-
:param expected: look in self.txnameDataExp, not self.txnameData
823+
:param evaluationType: if apriori, look in self.txnameDataExp, not self.txnameData
824824
"""
825825

826826
if not self.dataType == 'upperLimit':

smodels/matching/theoryPrediction.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def getUpperLimit(self, evaluationType : NllEvalType = observed ) -> UnitXSec:
201201
For combined results, returns the upper limit on the
202202
total sigma*eff (for all signal regions/datasets).
203203
204-
:param expected: return evaluationType Upper Limit, instead of observed.
204+
:param evaluationType: one of: observed, apriori, aposteriori
205205
:return: upper limit (Unum object)
206206
"""
207207
if self.dataType() == "efficiencyMap":
@@ -360,7 +360,7 @@ def computeStatistics(self, evaluationType : NllEvalType = observed ):
360360
Compute the likelihoods, and upper limit for this theory prediction.
361361
The resulting values are stored as the likelihood, lmax, and lsm
362362
attributes.
363-
:param expected: computed evaluationType quantities, not observed
363+
:param evaluationType: one of: observed, apriori, aposteriori
364364
"""
365365
# Compute likelihoods and related parameters:
366366
llhdDict = self.statsComputer.get_five_values(
@@ -533,7 +533,7 @@ def getLlhds(self,muvals,evaluationType : bool = False,
533533
534534
:param muvals: List with values for the signal strenth for which
535535
the likelihoods must be evaluated.
536-
:param expected: If True returns the evaluationType likelihood values.
536+
:param evaluationType: returns the observed/priori expected/posteriori expected likelihood values.
537537
:param normalize: If True normalizes the likelihood by its integral
538538
over muvals.
539539
"""
@@ -897,7 +897,7 @@ def _getBestResult(dataSetResults):
897897
raise SModelSError(txt)
898898
pred = predList[0]
899899
xsec = pred.xsection
900-
expectedR = (xsec/dataset.getSRUpperLimit(evaluationType=True)).asNumber()
900+
expectedR = (xsec/dataset.getSRUpperLimit(evaluationType=apriori)).asNumber()
901901
if expectedR > bestExpectedR or (expectedR == bestExpectedR and xsec > bestXsec):
902902
bestExpectedR = expectedR
903903
bestPred = pred

smodels/statistics/analysesCombinations.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def nll(
5252
just a proxy method to ease transition of codes that depend on SModelS.
5353
5454
:param mu: signal strength
55-
:param expected: one of: observed, apriori, aposteriori
55+
:param evaluationType: one of: observed, apriori, aposteriori
5656
:param asimov: if not None, compute llhd for asimov data with mu=asimov
5757
"""
5858
return self.likelihood ( mu, evaluationType, return_nll=True, asimov=asimov )
@@ -69,7 +69,7 @@ def likelihood(
6969
Compute the likelihood at a given mu
7070
7171
:param mu: signal strength
72-
:param expected: one of: observed, apriori, aposteriori
72+
:param evaluationType: one of: observed, apriori, aposteriori
7373
:param return_nll: if True, return negative log likelihood, else likelihood
7474
:param asimov: if not None, compute llhd for asimov data with mu=asimov
7575
"""
@@ -107,7 +107,7 @@ def lmax(
107107
"""find muhat and lmax.
108108
109109
:param allowNegativeSignals: if true, then also allow for negative values
110-
:param expected: one of: observed, apriori, aposteriori
110+
:param evaluationType: one of: observed, apriori, aposteriori
111111
:param return_nll: if true, return negative log max likelihood instead of lmax
112112
:returns: mu_hat, i.e. the maximum likelihood estimate of mu, if extended \
113113
output is requested, it returns a dictionary with mu_hat, \
@@ -229,7 +229,7 @@ def getUpperLimitOnMu(self, evaluationType : NllEvalType=observed, allowNegative
229229
"""get upper limit on signal strength multiplier, i.e. value for mu for \
230230
which CLs = 0.95
231231
232-
:param expected: one of: observed, apriori, aposteriori
232+
:param evaluationType: one of: observed, apriori, aposteriori
233233
:returns: upper limit on signal strength multiplier mu
234234
"""
235235
mu_hat, sigma_mu, clsRoot = self.getCLsRootFunc(evaluationType=evaluationType,
@@ -247,7 +247,7 @@ def getUpperLimitOnSigmaTimesEff(self, evaluationType : NllEvalType=observed, al
247247
for each signal region/dataset), by using
248248
the q_mu test statistic from the CCGV paper (arXiv:1007.1727).
249249
250-
:param expected: one of: observed, apriori, aposteriori
250+
:param evaluationType: one of: observed, apriori, aposteriori
251251
:returns: upper limit on fiducial cross section
252252
"""
253253
ul = self.getUpperLimitOnMu(evaluationType=evaluationType,
@@ -266,7 +266,7 @@ def getCLsRootFunc(self, evaluationType : NllEvalType=observed,
266266
Obtain the function "CLs-alpha[0.05]" whose root defines the upper limit,
267267
plus mu_hat and sigma_mu
268268
269-
:param expected: one of: observed, apriori, aposteriori
269+
:param evaluationType: one of: observed, apriori, aposteriori
270270
"""
271271
fmh = self.lmax(evaluationType=evaluationType, allowNegativeSignals=allowNegativeSignals)
272272
mu_hat, sigma_mu, _ = fmh["muhat"], fmh["sigma_mu"], fmh["lmax"]
@@ -301,7 +301,7 @@ def CLs( self, mu : float = 1., evaluationType : NllEvalType=observed,
301301
Compute the exclusion confidence level of the model
302302
303303
:param mu: compute for the parameter of interest mu
304-
:param expected: one of: observed, apriori, aposteriori
304+
:param evaluationType: one of: observed, apriori, aposteriori
305305
:param return_type: (Text) can be "CLs-alpha", "1-CLs", "CLs" \
306306
CLs-alpha: returns CLs - 0.05 \
307307
alpha-CLs: returns 0.05 - CLs \
@@ -322,7 +322,7 @@ def getLlhds(self,muvals,evaluationType : NllEvalType=observed,
322322
323323
:param muvals: List with values for the signal strenth for which the likelihoods must
324324
be evaluated.
325-
:param expected: one of: observed, apriori, aposteriori
325+
:param evaluationType: one of: observed, apriori, aposteriori
326326
:param normalize: If True normalizes the likelihood by its integral over muvals.
327327
"""
328328

smodels/statistics/pyhfInterface.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ def __init__(self, data, cl=0.95, lumi=None ):
378378
:ivar nWS: number of workspaces = number of json files
379379
:ivar patches: list of patches to be applied to the inputJsons as python dictionary instances
380380
:ivar workspaces: list of workspaces resulting from the patched inputJsons
381-
:ivar workspaces_expected: list of patched workspaces with observation yields replaced by the evaluationType ones
381+
:ivar workspaces_expected: list of patched workspaces with observation yields replaced by the expected eones
382382
:ivar cl: created from cl
383383
:ivar scale: scale that is applied to the signal predictions, dynamically changes throughout the upper limit calculation
384384
:ivar alreadyBeenThere: boolean flag that identifies when nsignals accidentally passes twice at two identical values
@@ -685,7 +685,7 @@ def likelihood( self, mu : float = 1.0,
685685
:param workspace_index: supply index of workspace to use. If None, \
686686
choose index of best combo
687687
:param return_nll: if true, return nll, not llhd
688-
:param expected: one of: observed, apriori, aposteriori
688+
:param evaluationType: one of: observed, apriori, aposteriori
689689
"""
690690
logger.debug("Calling likelihood")
691691
if type(workspace_index) == float:
@@ -856,7 +856,7 @@ def lmax( self, workspace_index=None, return_nll=False, evaluationType : NllEval
856856
:param return_nll: if true, return nll, not llhd
857857
:param workspace_index: supply index of workspace to use. If None, \
858858
choose index of best combo
859-
:param expected: one of: observed, apriori, aposteriori
859+
:param evaluationType: one of: observed, apriori, aposteriori
860860
:param allowNegativeSignals: if False, then negative nsigs are replaced \
861861
with 0.
862862
"""
@@ -957,7 +957,7 @@ def updateWorkspace(self, workspace_index=None, evaluationType : NllEvalType=obs
957957
Small method used to return the appropriate workspace
958958
959959
:param workspace_index: the index of the workspace to retrieve from the corresponding list
960-
:param expected: if False, retuns the unmodified (but patched) workspace. Used for computing observed or aposteriori evaluationType limits.
960+
:param evaluationType: if False, retuns the unmodified (but patched) workspace. Used for computing observed or aposteriori evaluationType limits.
961961
if True, retuns the modified (and patched) workspace, where obs = sum(bkg). Used for computing apriori evaluationType limit.
962962
"""
963963
if self.nWS == 1:
@@ -980,7 +980,7 @@ def getUpperLimitOnSigmaTimesEff(self, evaluationType : NllEvalType=observed, wo
980980
- if workspace_index is specified, self.workspace[workspace_index]
981981
(useful for computation of the best upper limit)
982982
983-
:param expected: - if set to apriori: uses evaluationType SM backgrounds as signals
983+
:param evaluationType: - if set to apriori: uses evaluationType SM backgrounds as signals
984984
- else: uses 'self.nsignals'
985985
:param workspace_index: - if different from 'None': index of the workspace to use
986986
for upper limit
@@ -1033,7 +1033,7 @@ def CLs( self, mu : float, evaluationType : NllEvalType,
10331033
_absolute_ mu
10341034
10351035
:param mu: compute for the parameter of interest mu
1036-
:param expected: if observed, compute observed, apriori: compute a priori expected
1036+
:param evaluationType: if observed, compute observed, apriori: compute a priori expected
10371037
:param return_type: (Text) can be one of:
10381038
"CLs-alpha", "1-CLs", "CLs" "alpha-CLs"
10391039
CLs-alpha: returns CLs - 0.05
@@ -1050,7 +1050,7 @@ def _CLs( self, mu_rel : float, evaluationType : NllEvalType,
10501050
This is our internal method to compute CLs.
10511051
10521052
:param mu_rel: compute for the parameter of interest mu_rel
1053-
:param expected: one of: observed, apriori, aposteriori
1053+
:param evaluationType: one of: observed, apriori, aposteriori
10541054
:param return_type: (Text) can be one of:
10551055
"CLs-alpha", "1-CLs", "CLs" "alpha-CLs"
10561056
CLs-alpha: returns CLs - 0.05
@@ -1136,7 +1136,7 @@ def getUpperLimitOnMu(self, evaluationType : NllEvalType=observed, workspace_ind
11361136
- if workspace_index is specified, self.workspace[workspace_index]
11371137
(useful for computation of the best upper limit)
11381138
1139-
:param expected: - if set to apriori: uses evaluationType SM backgrounds as signals
1139+
:param evaluationType: - if set to apriori: uses evaluationType SM backgrounds as signals
11401140
- else: uses 'self.nsignals'
11411141
:param workspace_index: - if different from 'None': index of the workspace to use
11421142
for upper limit

smodels/statistics/simplifiedLikelihoods.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ def llhdOfTheta(self, theta, nll = True ):
555555
self.mu. notice, by default it returns nll
556556
557557
:param theta: nuisance parameters
558-
:params nll: if True, compute negative log likelihood
558+
:param nll: if True, compute negative log likelihood
559559
"""
560560
model = self.model
561561
# theta = array ( thetaA )
@@ -995,8 +995,8 @@ def getUpperLimitOnSigmaTimesEff(
995995
for each signal region/dataset), by using
996996
the q_mu test statistic from the CCGV paper (arXiv:1007.1727).
997997
998-
:params expected: one of: observed, apriori, aposteriori
999-
:params trylasttime: if True, then dont try extra
998+
:param evaluationType: one of: observed, apriori, aposteriori
999+
:param trylasttime: if True, then dont try extra
10001000
:returns: upper limit on fiducial cross section
10011001
"""
10021002
model = self.likelihoodComputer.model
@@ -1021,8 +1021,7 @@ def getCLsRootFunc(
10211021
plus mu_hat and sigma_mu
10221022
10231023
:param model: statistical model
1024-
:param expected: false: compute observed, true: compute a priori evaluationType, \
1025-
"posteriori": compute a posteriori expected
1024+
:param evaluationType: one of: observed, apriori, aposteriori
10261025
:param trylasttime: if True, then dont try extra
10271026
:return: mu_hat, sigma_mu, CLs-alpha
10281027
"""
@@ -1086,8 +1085,8 @@ def getUpperLimitOnMu(
10861085
for each signal regio/dataset), by using
10871086
the q_mu test statistic from the CCGV paper (arXiv:1007.1727).
10881087
1089-
:params expected: one of: observed, apriori, aposteriori
1090-
:params trylasttime: if True, then dont try extra
1088+
:param evaluationType: one of: observed, apriori, aposteriori
1089+
:param trylasttime: if True, then dont try extra
10911090
:returns: upper limit on the signal strength multiplier mu
10921091
"""
10931092
mu_hat, sigma_mu, clsRoot = self.getCLsRootFunc(
@@ -1114,9 +1113,7 @@ def CLs(
11141113
Compute the exclusion confidence level of the model (1-CLs).
11151114
11161115
:param model: statistical model
1117-
:param expected: if false, compute observed,
1118-
true: compute a priori evaluationType, "posteriori":
1119-
compute a posteriori expected
1116+
:param evaluationType: one of: observed, apriori, aposteriori
11201117
:param trylasttime: if True, then dont try extra
11211118
:param return_type: (Text) can be "CLs-alpha", "1-CLs", "CLs"
11221119
CLs-alpha: returns CLs - 0.05 (alpha)

0 commit comments

Comments
 (0)