Skip to content

Commit

Permalink
improve assigment of S,B,F,C-properties for 1D-fits
Browse files Browse the repository at this point in the history
  • Loading branch information
VanyaBelyaev committed Dec 17, 2018
1 parent be8d76c commit 999a761
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
13 changes: 8 additions & 5 deletions ostap/fitting/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2291,7 +2291,8 @@ def S ( self , value ) :
for s , v in zip ( ss , value ) :

vv = float ( v )
if not vv in ss : logger.warning("Value %s is outside the allowed region %s" % ( value , s.minmax() ) )
if s.minmax() and not vv in s :
logger.error ("Value %s is outside the allowed region %s" % ( vv , s.minmax() ) )
s.setVal ( vv )

@property
Expand Down Expand Up @@ -2328,7 +2329,8 @@ def B ( self , value ) :
for s , v in zip ( ss , value ) :

vv = float ( v )
if not vv in ss : logger.warning("Value %s is outside the allowed region %s" % ( value , s.minmax() ) )
if s.minmax() and not vv in s :
logger.error ("Value %s is outside the allowed region %s" % ( vv , s.minmax() ) )
s.setVal ( vv )

@property
Expand Down Expand Up @@ -2364,7 +2366,8 @@ def C ( self , value ) :
for s , v in zip ( ss , value ) :

vv = float ( v )
if not vv in ss : logger.warning("Value %s is outside the allowed region %s" % ( value , s.minmax() ) )
if s.minmax() and not vv in s :
logger.error("Value %s is outside the allowed region %s" % ( vv , s.minmax() ) )
s.setVal ( vv )

@property
Expand Down Expand Up @@ -2394,10 +2397,10 @@ def F ( self , value ) :
for s , v in zip ( ss , value ) :

vv = float ( v )
if not vv in ss : logger.warning("Value %s is outside the allowed region %s" % ( value , s.minmax() ) )
if s.minmax() and not vv in s :
logger.error ("Value %s is outside the allowed region %s" % ( vv , s.minmax() ) )
s.setVal ( vv )


@property
def yields ( self ) :
"""The list/tuple of the yields of all numeric components (empty for non-extended fit)"""
Expand Down
12 changes: 6 additions & 6 deletions ostap/fitting/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,13 +621,13 @@ def phis ( self , values ) :
elif isinstance ( values , ROOT.RooArgList ) : pass
else :
raise TypeError("Unknown type for ``values'' %s/%s" % ( values , type ( values ) ) )


for s , v in zip ( self.__phis , values ) :
vv = float ( v )
if s.minmax() and not vv in s :
logger.error ("Value %s is outside the allowed region %s" % ( vv , s.minmax() ) )
s.setVal ( vv )
nphi = len ( self.__phis )
iphi = 0
for v in values :
if iphi < nphi :
self.__phis[iphi].setVal ( float ( v ) )
iphi +=1

@property
def phi_list ( self ) :
Expand Down

0 comments on commit 999a761

Please sign in to comment.