Skip to content

Commit

Permalink
1. fix newly introduced typo in drawing for simulltaneous pdf. Thank…
Browse files Browse the repository at this point in the history
…s to Dima Pereima for reporitng a problem!
  • Loading branch information
VanyaBelyaev committed Aug 25, 2022
1 parent 78da8b5 commit 0b95fde
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ include(CTest)
set(OSTAP_VERSION_MAJOR 1)
set(OSTAP_VERSION_MINOR 9)
set(OSTAP_VERSION_PATCH 2)
set(OSTAP_VERSION_TWEAK 3)
set(OSTAP_VERSION_TWEAK 4)

set(OSTAP_VERSION ${OSTAP_VERSION_MAJOR}.${OSTAP_VERSION_MINOR}.${OSTAP_VERSION_PATCH}.${OSTAP_VERSION_TWEAK})

Expand Down
4 changes: 4 additions & 0 deletions ReleaseNotes/release_notes.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# v1.9.2.4

## New features:

## Backward incompatible:

## Bug fixes:

1. fix newly introduced typo in drawing for simulltaneous pdf. Thanks to Dima Pereima for reporitng a problem!

# v1.9.2.2

## New features:
Expand Down
9 changes: 9 additions & 0 deletions ReleaseNotes/v1.9.2.4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# v1.9.2.4

## New features:

## Backward incompatible:

## Bug fixes:

1. fix newly introduced typo in drawing for simulltaneous pdf. Thanks to Dima Pereima for reporitng a problem!
11 changes: 6 additions & 5 deletions ostap/fitting/simfit.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,8 +590,6 @@ def __init__ ( self ,
'Invalid type for "sample":' % ( sample , type ( sample ) )

name = name if name else self.generate_name ( 'simfit' , '' , sample.GetName() )



## propagate the name
self.name = name
Expand Down Expand Up @@ -837,6 +835,7 @@ def draw ( self ,
>>> pdf.fitTo ( dataset )
>>> pf.draw ( 'signal' , dataset , nbins = 100 )
"""

dvar = None
if isinstance ( category , ( tuple , list ) ) and 2 == len ( category ) :
category , dvar = category
Expand Down Expand Up @@ -913,7 +912,7 @@ def draw ( self ,
return None

elif isinstance ( draw_pdf , PDF2 ) :

if 2 == dvar or dvar in ( 'y' , 'Y' , '2' , draw_pdf.yvar.name ) :
return draw_pdf.draw2 ( dataset = dataset ,
nbins = nbins ,
Expand All @@ -928,12 +927,14 @@ def draw ( self ,
self.error("Unknown 'dvar' for 2D-draw pdf! %s" % dvar )
return None

elif isinstance ( draw_pdf , PDF3 ) :

elif isinstance ( draw_pdf , PDF1 ) :
return draw_pdf.draw ( dataset = dataset ,
nbins = nbins ,
silent = silent ,
args = args , **kwargs )

self.error ("draw: inconsistent combination of draw_pdf '%s' and dvar '%s'" % (
type ( draw_pdf ) , dvar ) )

# =========================================================================
## create NLL
Expand Down
18 changes: 9 additions & 9 deletions ostap/fitting/tests/test_fitting_simfit1.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,16 @@ def test_simfit1 () :
model2.S = NS2
model2.B = NB2

with use_canvas ( 'test_simfit1' ) :
with use_canvas ( 'test_simfit1: fit dataset1' ) :
# =========================================================================
## fit 1
with wait ( 1 ) :
r1 , f1 = model1.fitTo ( dataset1 , draw = True , nbins = 50 , silent = True )
title = 'Results of fit to dataset1'
logger.info ( '%s\n%s' % ( title , r1.table ( title = title , prefix = '# ' ) ) )


with use_canvas ( 'test_simfit1: fit dataset2' ) :
## fit 2
with wait ( 1 ) :
r2 , f2 = model2.fitTo ( dataset2 , draw = True , nbins = 50 , silent = True )
Expand Down Expand Up @@ -150,11 +152,10 @@ def test_simfit1 () :
title = 'Results of simultaneous fit'
logger.info ( '%s\n%s' % ( title , r.table ( title = title , prefix = '# ' ) ) )

with use_canvas ( 'test_simfit1' ) :
with wait ( 1 ) :
fA = model_sim.draw ( 'A' , dataset , nbins = 50 )
with wait ( 1 ) :
fB = model_sim.draw ( 'B' , dataset , nbins = 50 )
with wait ( 2 ) , use_canvas ( 'test_simfit1: fit both datasets & draw A' ) :
fA = model_sim.draw ( 'A' , dataset , nbins = 50 )
with wait ( 2 ) , use_canvas ( 'test_simfit1: fit both datasets & draw B' ) :
fB = model_sim.draw ( 'B' , dataset , nbins = 50 )

models.add ( model1 )
models.add ( model2 )
Expand Down Expand Up @@ -196,13 +197,12 @@ def test_db() :
if '__main__' == __name__ :



with timing( "simfit-1" , logger ) :
test_simfit1 ()
test_simfit1 ()

## check finally that everything is serializeable:
with timing ('Save to DB:' , logger ) :
test_db ()
test_db ()

# =============================================================================
## The END
Expand Down

0 comments on commit 0b95fde

Please sign in to comment.