Skip to content

Commit

Permalink
prepare v1.10.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
VanyaBelyaev committed Apr 9, 2024
1 parent 0f84143 commit 420f102
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .aux/test_with_lcg
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ CMTCONFIG=$2
source /cvmfs/sft.cern.ch/lcg/views/${LCG}/${CMTCONFIG}/setup.sh
source build/INSTALL/thisostap.sh
cd build
ctest -N && cmake .. -DCMAKE_INSTALL_PREFIX=./INSTALL/ && ctest -j8 -R '(mypdf|eff|morph|fill|linalg|blue)' --output-on-failure
ctest -N && cmake .. -DCMAKE_INSTALL_PREFIX=./INSTALL/ && ctest -j8 -R '(mypdf|eff|morph|fill|linalg|blue|sum|bern)' --output-on-failure

2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ include(CTest)
set(OSTAP_VERSION_MAJOR 1)
set(OSTAP_VERSION_MINOR 10)
set(OSTAP_VERSION_PATCH 1)
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
5 changes: 4 additions & 1 deletion ReleaseNotes/release_notes.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# v1.10.1.4

## New features

1. Add functions for the 1st, 2nd, 3rd and 4th unbiased cumulant estimators
1. add fucntions for cumulants up to order 10 + correct uncertainties for 3rd and 4th cumulants
1. add functions for cumulants up to order 10 + correct uncertainties for 3rd and 4th cumulants

## Backward incompatible

## Bug fixes

1. fix a bug with summation of two `RooPlot objects`

# v1.10.1.2

Expand Down
1 change: 0 additions & 1 deletion ostap/fitting/pdfbasic.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,6 @@ def draw ( self ,
if 0 < binw : self.info ( 'chi2/ndf: %.3f, binwidth: %s' % ( frame.chi2ndf , binw ) )
else : self.info ( 'chi2/ndf: %.3f' % frame.chi2ndf )


## a bit strange action but it helps to avoid decolorization/reset for the last created frame
frame = frame.copy ()
if not kwargs.get ( 'draw_axis_title' , False ) :
Expand Down
11 changes: 9 additions & 2 deletions ostap/fitting/roofit.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def _name ( obj ) :

if not title :
title = 'RooPlot %s' % plot.name
table = [ ( 'Index' , 'Type' , 'Option' , 'Line' , 'Marker' , 'Fill' , 'Name' ) ]
table = [ ( 'Index' , 'Type' , 'Option' , 'Binw' , 'Line' , 'Marker' , 'Fill' , 'Name' ) ]

names = set()
for index , obj in enumerate ( plot ) :
Expand All @@ -299,6 +299,10 @@ def _name ( obj ) :

row = [ '%2d' % index , _name ( obj ) , options ]

if not isinstance ( obj , ROOT.RooHist ) : row.append ( '' )
else : row.append ( '%g' % obj.getNominalBinWidth() )


## line attributes
if isinstance ( obj , ROOT.TAttLine ) :
row.append ( '%2d/%d/%d' % ( obj.GetLineStyle () ,
Expand All @@ -318,9 +322,13 @@ def _name ( obj ) :
row.append ( '%4d/%-3d' % ( obj.GetFillStyle () ,
obj.GetFillColor () ) )
else : row.append ('')


##
row.append ( name )



row = tuple ( row )

table.append ( row )
Expand All @@ -337,7 +345,6 @@ def _name ( obj ) :
## copy RooPlot object
def _rp_copy_ ( plot ) :
"""copy RooPlot object"""

return copy.deepcopy ( plot )

ROOT.RooPlot.copy = _rp_copy_
Expand Down
21 changes: 17 additions & 4 deletions ostap/fitting/rooreduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,8 +816,15 @@ def _rhist_factory_ ( klass , *args ) :
-see `ROOT.RooPlotable`
-see `ROOT.TGraphAsymmErrors`
"""
graph = GR.graph_asymerrors_factory ( klass , *args [:-1] )
rplotatts = args[-1]
rplotatts = args [ -1 ]
if 4 == len ( rplotatts ) :
binwidth = rplotatts [ -1 ]
rplotatts = rplotatts [ : -1 ]
fklass = lambda : klass ( binwidth )
else :
fklass = lambda : klass ()

graph = GR.graph_asymerrors_factory ( fklass , *args [:-1] )
graph.setYAxisLabel ( rplotatts [0 ] )
graph.setYAxisLimits ( *rplotatts [1:] )
##
Expand All @@ -833,8 +840,14 @@ def _rhist_reduce_ ( graph ) :
- see `ROOT.TGraphAsymmErrors`
"""
_ , content = GR.graph_asymerrors_reduce ( graph )
rplotatts = graph.getYAxisLabel (), graph.getYAxisMin (), graph.getYAxisMax ()
return _rhist_factory_ , content + ( rplotatts , )

rplotatts = graph.getYAxisLabel () , \
graph.getYAxisMin () , \
graph.getYAxisMax () , \
graph.getNominalBinWidth() ## new!

payload = content + ( rplotatts , )
return _rhist_factory_ , payload

ROOT.RooHist.__reduce__ = _rhist_reduce_

Expand Down
8 changes: 4 additions & 4 deletions ostap/histos/graph_reduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# =============================================================================
from ostap.core.meta_info import root_info
from ostap.math.reduce import root_factory
from ostap.core.ostap_types import num_types, integer_types
from ostap.core.ostap_types import num_types, integer_types, string_types
from ostap.plotting.draw_attributes import copy_graph_attributes
import ROOT, array, itertools
# =============================================================================
Expand Down Expand Up @@ -47,7 +47,7 @@ def graph_factory ( klass ,
"""
graph = klass ()
## TNamed
graph.SetName ( name )
graph.SetName ( name )
graph.SetTitle ( title )
## min/max
graph.SetMinimum ( minmax[0] )
Expand Down Expand Up @@ -75,8 +75,8 @@ def graph_reduce ( graph ) :
"""Reduce/serialize/pickle simple `ROOT.TGraph` object\
- see `ROOT.TGraph`
"""
xvalues = array.array ( 'd' , graph.GetX () )
yvalues = array.array ( 'd' , graph.GetY () )
xvalues = array.array ( 'd' , graph.GetX () )
yvalues = array.array ( 'd' , graph.GetY () )
return graph_factory , ( type ( graph ) ,
## TNamed
str ( graph.GetName () ) ,
Expand Down
28 changes: 22 additions & 6 deletions ostap/plotting/tests/test_plotting_sum.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
assert len ( f1 ) == len ( f2 ) and len ( f1 ) == len ( fsum ) , \
'Invalid dimentions/1!'

for a,b,c in zip ( f1 , f2 , fsum ) :

for a, b, c in zip ( f1 , f2 , fsum ) :

if not isinstance ( a , ROOT.RooHist ) : continue

Expand All @@ -74,14 +75,29 @@
v2x, v2y = b [ i ]
vsx, vsy = c [ i ]

## assert v1x.value == v2x.value and v2x.value == vsx.value, \
## 'Invalid x: %s %s %s ' % ( v1x , v2x , vsx )

assert v1x.value == v2x.value and v2x.value == vsx.value, \
'Invalid x: %s %s %s ' % ( v1x , v2x , vsx )

## assert v1y.value + v2y.value == vsy.value, \
## 'Invalid y: %s %s %s ' % ( v1y , v2y , vsy )

assert v1y.value + v2y.value == vsy.value, \
'Invalid y: %s %s %s ' % ( v1y , v2y , vsy )


## h1 = f1.getObject(0)
## h2 = f2.getObject(0)

## print ( 'nominal bin widths h1' , h1.getNominalBinWidth() )
## print ( 'nominal bin widths h2' , h1.getNominalBinWidth() )


## h1 = f1.getObject(2)
## h2 = f2.getObject(2)

## print ( 'nominal bin widths h1' , h1.getNominalBinWidth() )
## print ( 'nominal bin widths h2' , h1.getNominalBinWidth() )




# =============================================================================
if '__main__' == __name__ :
Expand Down

0 comments on commit 420f102

Please sign in to comment.