From cb1f7c16b2728654764d4f6e8c9070a5c4795c9b Mon Sep 17 00:00:00 2001 From: Vanya Belyaev <ivan.belyaev@cern.ch> Date: Fri, 29 Mar 2024 09:00:50 +0100 Subject: [PATCH] furtehr fix --- ostap/stats/moment.py | 132 +-------------------------------- source/include/Ostap/Moments.h | 24 ------ 2 files changed, 3 insertions(+), 153 deletions(-) diff --git a/ostap/stats/moment.py b/ostap/stats/moment.py index 4f1b2cb6..9eb44dc8 100644 --- a/ostap/stats/moment.py +++ b/ostap/stats/moment.py @@ -196,7 +196,6 @@ def _om_u5th ( obj ) : # v = m.moment() # @endcode if ( 6 , 22 ) <= root_info : -## if ( 6 , 31 ) <= root_info : ## def _om_cm2 ( obj , order ) : assert isinstance ( order , integer_types ) and order <= obj.order ,\ @@ -204,45 +203,14 @@ def _om_cm2 ( obj , order ) : if 2 <= order and obj.empty() : return neg_infinity return obj.moment_[order]() ## -elif ( 6 , 22 ) <= root_info : - ## - def _om_cm2 ( obj , order ) : - assert isinstance ( order , integer_types ) and order <= obj.order ,\ - 'central_moment: invalid order %s/%d' % ( order , obj.order ) - if 2 <= order and obj.empty() : return neg_infinity - T = Ostap.Math.Moments._central_moment_2 [ order , obj.order ] - return T ( obj ) - ## -elif ( 6 , 20 ) <= root_info : +else : ## def _om_cm2 ( obj , order ) : assert isinstance ( order , integer_types ) and order <= obj.order ,\ 'central_moment: invalid order %s/%d' % ( order , obj.order ) if 2 <= order and obj.empty() : return neg_infinity return obj.moment ( order ) - ## T = Ostap.Math.Moments._central_moment_2 [ order , obj.order ] - ## M = Ostap.Math.Moments() - ## return T ( M , obj ) - ## -elif ( 6 , 18 ) <= root_info : - ## - def _om_cm2 ( obj , order ) : - assert isinstance ( order , integer_types ) and order <= obj.order ,\ - 'central_moment: invalid order %s/%d' % ( order , obj.order ) - if 2 <= order and obj.empty() : return neg_infinity - T = Ostap.Math.Moments._central_moment_2 ( order , obj.order ) - M = Ostap.Math.Moments() - return T ( M , obj ) - ## -else : - ## - def _om_cm2 ( obj , order ) : - assert isinstance ( order , integer_types ) and order <= obj.order ,\ - 'central_moment: invalid order %s/%d' % ( order , obj.order ) - if 2 <= order and obj.empty() : return neg_infinity - T = Ostap.Math.Moments._central_moment_2 ( order , obj.order ) - return T ( obj ) - + _om_cm2.__doc__ = \ """Get a central moment fro the moment-counter >>> m = ... @@ -250,38 +218,6 @@ def _om_cm2 ( obj , order ) : >>> v = m.cmoment ( 3 ) ## ditto """ - - -## def _om_cm2 ( obj , order ) : -## """Get a central moment fro the moment-counter -## >>> m = ... -## >>> v = m.central_moment ( 3 ) ## ditto -## >>> v = m.cmoment ( 3 ) ## ditto -## """ -## assert isinstance ( order , integer_types ) and 2<= order , 'Invalid order %s'% order -## assert order <= obj.order , 'central_moment: invalid order cmbiarions %s/%s' % ( order , obj.order ) - -## if order * 2 <= obj.order : -## ## - -## if root_info < ( 6 , 18 ) : ## well, actually 6.14 -## T = Ostap.Math.Moments._central_moment_2 ( order , obj.order ) -## return T ( obj ) -## elif root_info < ( 6 , 20 ) : -## T = Ostap.Math.Moments._central_moment_2 ( order , obj.order ) -## M = Ostap.Math.Moments() -## return T ( M , obj ) -## elif root_info < ( 6 , 22 ) : -## T = Ostap.Math.Moments._central_moment_2 [ order , obj.order ] -## M = Ostap.Math.Moments() -## return T ( M , obj ) - -## T = Ostap.Math.Moments._central_moment_2 [ order , obj.order ] -## return T ( obj ) - -## return obj.moment ( order ) - - # ============================================================================= ## get central moment # @code @@ -290,7 +226,6 @@ def _om_cm2 ( obj , order ) : # v = m.moment() # @endcode if ( 6 , 22 ) <= root_info : -## if ( 6 , 31 ) <= root_info : ## def _om_cm3 ( obj , order ) : assert isinstance ( order , integer_types ) and order <= obj.order ,\ @@ -299,48 +234,13 @@ def _om_cm3 ( obj , order ) : ## return obj.moment_[order]() ## -elif ( 6 , 22 ) <= root_info : - ## - def _om_cm3 ( obj , order ) : - assert isinstance ( order , integer_types ) and order <= obj.order ,\ - 'central_moment: invalid order %s/%d' % ( order , obj.order ) - if 2 <= order and not obj.ok () : return neg_infinity - ## - T = Ostap.Math.Moments._central_moment_3 [ order , obj.order ] - return T ( obj ) - ## -elif ( 6 , 20 ) <= root_info : +else : ## def _om_cm3 ( obj , order ) : assert isinstance ( order , integer_types ) and order <= obj.order ,\ 'central_moment: invalid order %s/%d' % ( order , obj.order ) if 2 <= order and not obj.ok () : return neg_infinity return obj.moment ( order ) - ## - ## T = Ostap.Math.Moments._central_moment_3 [ order , obj.order ] - ## M = Ostap.Math.Moments () - ## return T ( M , obj ) - ## -elif ( 6 , 18 ) <= root_info : - ## - def _om_cm3 ( obj , order ) : - assert isinstance ( order , integer_types ) and order <= obj.order ,\ - 'central_moment: invalid order %s/%d' % ( order , obj.order ) - if 2 <= order and not obj.ok () : return neg_infinity - ## - T = Ostap.Math.Moments._central_moment_3 ( order , obj.order ) - M = Ostap.Math.Moments () - return T ( M , obj ) -else: - ## - def _om_cm3 ( obj , order ) : - assert isinstance ( order , integer_types ) and order <= obj.order ,\ - 'central_moment: invalid order %s/%d' % ( order , obj.order ) - if 2 <= order and not obj.ok () : return neg_infinity - ## - T = Ostap.Math.Moments._central_moment_3 ( order , obj.order ) - return T ( obj ) - _om_cm3.__doc__ = \ """ Get a central moment fro the moment-counter @@ -350,32 +250,6 @@ def _om_cm3 ( obj , order ) : """ -## def _om_cm3 ( obj , order ) : -## """Get a central moment fro the moment-counter -## >>> m = ... -## >>> v = m.central_moment ( 3 ) ## ditto -## >>> v = m.cmoment ( 3 ) ## ditto -## """ -## assert isinstance ( order , integer_types ) and 2<= order , 'Invalid order %s'% order -## assert order <= obj.order , 'central_moment: invalid order cmbiarions %s/%s' % ( order , obj.order ) - -## if order * 2 <= obj.order : -## ## -## if root_info < ( 6 , 18 ) : ## well, actaully 6.14 -## T = Ostap.Math.Moments._central_moment_3 ( order , obj.order ) -## return T ( obj ) -## elif root_info < ( 6 , 20 ) : ## well, actaully 6.14 -## T = Ostap.Math.Moments._central_moment_3 ( order , obj.order ) -## M = Ostap.Math.Moments () -## return T ( M , obj ) -## elif root_info < ( 6 , 22 ) : -## T = Ostap.Math.Moments._central_moment_3 [ order , obj.order ] -## M = Ostap.Math.Moments () -## return T ( M , obj ) - - -## return obj.moment ( order ) - # ============================================================================= ## get a RMS # @code diff --git a/source/include/Ostap/Moments.h b/source/include/Ostap/Moments.h index 66f45a20..24ab6c3c 100644 --- a/source/include/Ostap/Moments.h +++ b/source/include/Ostap/Moments.h @@ -1416,18 +1416,6 @@ namespace Ostap return VE ( muo , cov2 ) ; } // ====================================================================== - /** get the central moment of order \f$ N \f$ with - * the estimate of the uncertainty (with \f$O(n^{-2})\f$~precision - * - the error estimate is possible only when \f$ 2N \le K \f$! - * @aparam m counter - * @return moment with uncertainty for non-empty counter - * <code>s_INVALID_MOMENT</code> for empty counters - */ - template <unsigned short N, unsigned short K, - typename std::enable_if<(1<N)&&(2*N<=K),int>::type = 0 > - static inline VE _central_moment_2 ( const Moment_<K>& m ) - { return central_moment<N> ( m ) ; } - // ====================================================================== /** get the standartized moment of order 1 */ template <unsigned short N, unsigned short K, @@ -1559,18 +1547,6 @@ namespace Ostap return VE ( muo , cov2 ) ; } // ====================================================================== - /** get the central moment of order \f$ N \f$ with - * the estimate of the uncertainty (with \f$O(n^{-2})\f$~precision - * - the error estimaet is possible only when \f$ 2N \le K \f$! - * @aparam m counter - * @return moment with uncertainty for non-empty counter - * <code>s_INVALID_MOMENT</code> for empty counters - */ - template <unsigned short N, unsigned short K, - typename std::enable_if<(1<N)&&(2*N<=K),int>::type = 0 > - static inline VE _central_moment_3 ( const WMoment_<K>& m ) - { return central_moment<N> ( m ) ; } - // ====================================================================== /** get the standartized moment of order 1 */ template <unsigned short N, unsigned short K,