Skip to content

Commit

Permalink
fix signatire
Browse files Browse the repository at this point in the history
  • Loading branch information
VanyaBelyaev committed Dec 7, 2023
1 parent f373e72 commit 03c7149
Showing 1 changed file with 14 additions and 68 deletions.
82 changes: 14 additions & 68 deletions ostap/stats/gof.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,77 +210,23 @@ def normalize2 ( datasets , weight = () , first = True ) :
return tuple ( result )



# =============================================================================
if (3,0) <= sys.version_info :
# =========================================================================
## Get the "normalized" input datasets
# All floating felds are calculated as
# \f[ x = \frac{x - \left\langle x \right\rangle}{\sigma} \f]
# where \f$ \left\langle x \right\rangle\f$ is mena value
# and \f$ \sigma \f$ is a standard deviation.
#
# @code
# ds = ... # data set as structured array
# dsn = normalize ( ds )
# @endcode
#
# - If several datasets are specified, all floating names must be the same
# and the mean and sigma are either taken either from the first dataset,
# if <code>first=True</code> or as combined through all datasets otherwise
#
# @code
# ds1 = ... # data set as structured array
# ds2 = ... # data set as structured array
# ds3 = ... # data set as structured array
# ds1n, ds2n, ds3n = normalize ( ds1 , ds2 , ds3 , first = True )
# @endcode
#
# - If <code>weight</code> is specified, this floating column is considered
# as the weight
#
# @code
# ds = ... # data set as structured array with weight
# dsn = normalize ( ds , weight = 'weight' )
# @endcode
#
# @code
# ds1 = ... # data set as structured array without weight
# ds2 = ... # data set as structured array with weight
# ds1n , ds2n = normalize ( ds1 , ds2 , weight = ( None , 'weight' ) )
# @endcode
#
# @attention Only the floating point columns are transformed!
# @attention Input datasets are expected to be numpy structured arrays
#
# @code
# ds = ... # data set as structured array
# dsn = normalize ( ds )
# @endcode
def normalize ( ds , *others , weight = () , first = True ) :
""" Get the `normalized' input datasets
All floating felds are calculated as
x = (x - <x>)/sigma
- <x> is a mean value
- is a standard deviation.
- If several datasets are specified, all floating names must be the same
and the mean and sigma are either taken either from the first dataset,
if `first=True` or as combined through all datasets, otherwise
- If `weight` is specified, this floating column is concidered
as the weight
- attention Only the floating point columns are transformed!
- attention Input datasets are expected to be numpy structured arrays
"""

result = normalize2 ( ( ds , *others ) , weight = weight , first = first )
code3 = """
def normalize ( ds , *others , weight = () , first = True ) :
result = normalize2 ( ( ds , *others ) , weight = weight , first = first )
return result [ 0 ] if not others else resut
"""
exec ( code3 )
else :
code2 = """
def normalize ( ds , others = () , weight = () , first = True ) :
result = normalize2 ( ( ds , *others ) , weight = weight , first = first )
return result [ 0 ] if not others else resut
"""
exec ( code2 )
normalize.__doc__ = normalize2.__doc__

return result [ 0 ] if not others else resut

# =============================================================================
if '__main__' == __name__ :

Expand Down

0 comments on commit 03c7149

Please sign in to comment.