Skip to content

Commit

Permalink
remove priints
Browse files Browse the repository at this point in the history
  • Loading branch information
VanyaBelyaev committed Jan 14, 2025
1 parent 4c99cc4 commit 45fdf3e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
8 changes: 2 additions & 6 deletions ostap/fitting/fithelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2254,22 +2254,18 @@ def gen_sample ( self , nEvents , sample = True ) :
>>> n = pdf.gen_sample ( VE ( 10 , 3 ) ) ## get gaussian stuff
"""

print ( 'gen-sample/0' , nEvents, sample )
if isinstance ( nEvents , integer_types ) and 0 < nEvents and not sample :
print ( 'gen-sample/1' , nEvents, sample )
return nEvents
elif isinstance ( nEvents , num_types ) and 0 < nEvents :
print ( 'gen-sample/2' , nEvents, sample )
nn = -1
while nn <= 0 : nn = poisson ( float ( nEvents ) )
return nn
elif isinstance ( nEvents , VE ) and 0 < nEvents.cov2 () and 0 < nEvents.value() + 3 * nEvents.error () :
print ( 'gen-sample/3' , nEvents, sample )
elif isinstance ( nEvents , VE ) and 0 < nEvents.cov2 () :
nn = -1
while nn <= 0 :
mu = ve_gauss ( nEvents )
if 0 < mu : nn = poisson ( mu )
return max ( 1 , int ( nn ) )
return nn

raise TypeError ( "Can't generate positive number from %s/%s" % ( nEvents , typename ( nEvents ) ) )

Expand Down
4 changes: 0 additions & 4 deletions ostap/fitting/pdfbasic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1961,14 +1961,10 @@ def generate ( self ,
>>> data = model.generate ( 100000 , varset , sample = True )
"""

print ( 'GENERATE/0:' , nEvents )

## sample number of events in dataset ?
nEvents = self.gen_sample ( nEvents , sample )
assert 0 <= nEvents , 'Invalid number of Events %s' % nEvents

print ( 'GENERATE/1:' , nEvents )

args = args + ( ROOT.RooFit.Name ( dsID() ) , ROOT.RooFit.NumEvents ( nEvents ) )

if silent : args = args + ( ROOT.RooFit.Verbose ( False ) , )
Expand Down
6 changes: 3 additions & 3 deletions ostap/utils/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
if 2 < python_version.major : LONG = int
else : LONG = long
# =============================================================================
try :
try : # =======================================================================
# =========================================================================
import psutil
# =========================================================================
Expand All @@ -57,12 +57,12 @@ def memory_usage ( *args ):
mem += p.memory_info()[0] / float( 2 ** 20 )
return mem
# =========================================================================
except ImportError :
except ImportError : # ========================================================
# =========================================================================
psutil = None
# =========================================================================
## report current memory usage (in MB)
# @attention it is ps-based version, slow... :-(
# @attention it is ps-based version, it can be slow... :-(
# @code
# print memory_usage()
# @endcode
Expand Down

0 comments on commit 45fdf3e

Please sign in to comment.