-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
046b4af
commit eccf9ef
Showing
3 changed files
with
54 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -752,9 +752,9 @@ def _h1_brational_ ( h1 , | |
refit = refit ) | ||
|
||
try : | ||
from ostap.math.param import fourier_sum, cosine_sum | ||
|
||
|
||
# ============================================================================= | ||
from ostap.math.param import fourier_sum | ||
# ============================================================================= | ||
## make a histogram representation in terms of Fourier serie | ||
# @code | ||
|
@@ -780,33 +780,7 @@ def _h1_fourier_sum_ ( h1 , N , fejer = False , **kwargs ) : | |
xmax = min ( kwargs.get( 'xmax' , h1.xmax() ) , h1.xmax () ) | ||
## | ||
return fourier_sum ( h1 , N , xmin , xmax , fejer ) | ||
|
||
# ============================================================================= | ||
## make a histogram representation in terms of cosine Fourier serie | ||
# @code | ||
# histo = ... | ||
# fsum = histo.cosine_sum ( 4 ) | ||
# print fsum | ||
# x = ... | ||
# print 'FUN(%s) = %s ' % ( x , fsum ( x ) ) | ||
# @endcode | ||
# @see Ostap::Math::CosineSum | ||
# @author Vanya Belyaev [email protected] | ||
# @date 2015-07-26 | ||
def _h1_cosine_sum_ ( h1 , N , fejer = False , **kwargs ) : | ||
"""Make a histogram representation in terms of cosine Fourier serie | ||
>>> histo = ... | ||
>>> fsum = histo.cosine_sum ( 4 ) | ||
>>> print fsum | ||
>>> x = ... | ||
>>> print 'FUN(%s) = %s ' % ( x , fsum ( x ) ) | ||
""" | ||
## | ||
xmin = max ( kwargs.get( 'xmin' , h1.xmin() ) , h1.xmin () ) | ||
xmax = min ( kwargs.get( 'xmax' , h1.xmax() ) , h1.xmax () ) | ||
## | ||
return cosine_sum ( h1 , N , xmin , xmax , fejer ) | ||
|
||
|
||
# ============================================================================= | ||
## represent 1D-histo as Fourier polynomial | ||
# @code | ||
|
@@ -869,7 +843,51 @@ def _h1_fourier_ ( h1 , | |
params = params , | ||
limits = limits , | ||
refit = refit ) | ||
|
||
|
||
for t in ( ROOT.TH1F , ROOT.TH1D ) : | ||
|
||
t.fourier_sum = _h1_fourier_sum_ | ||
t.fourier = _h1_fourier_ | ||
|
||
_new_methods_ .append ( _h1_fourier_sum_ ) | ||
_new_methods_ .append ( _h1_fourier_ ) | ||
|
||
except ImportError : | ||
pass | ||
|
||
|
||
# ================================================================================= | ||
try : | ||
|
||
# ============================================================================= | ||
from ostap.math.param import cosine_sum | ||
# ============================================================================= | ||
## make a histogram representation in terms of cosine Fourier serie | ||
# @code | ||
# histo = ... | ||
# fsum = histo.cosine_sum ( 4 ) | ||
# print fsum | ||
# x = ... | ||
# print 'FUN(%s) = %s ' % ( x , fsum ( x ) ) | ||
# @endcode | ||
# @see Ostap::Math::CosineSum | ||
# @author Vanya Belyaev [email protected] | ||
# @date 2015-07-26 | ||
def _h1_cosine_sum_ ( h1 , N , fejer = False , **kwargs ) : | ||
"""Make a histogram representation in terms of cosine Fourier serie | ||
>>> histo = ... | ||
>>> fsum = histo.cosine_sum ( 4 ) | ||
>>> print fsum | ||
>>> x = ... | ||
>>> print 'FUN(%s) = %s ' % ( x , fsum ( x ) ) | ||
""" | ||
## | ||
xmin = max ( kwargs.get( 'xmin' , h1.xmin() ) , h1.xmin () ) | ||
xmax = min ( kwargs.get( 'xmax' , h1.xmax() ) , h1.xmax () ) | ||
## | ||
return cosine_sum ( h1 , N , xmin , xmax , fejer ) | ||
|
||
# ============================================================================= | ||
## represent 1D-histo as cosine Fourier polynomial | ||
# @code | ||
|
@@ -933,16 +951,13 @@ def _h1_cosine_ ( h1 , | |
limits = limits , | ||
refit = refit ) | ||
|
||
|
||
for t in ( ROOT.TH1F , ROOT.TH1D ) : | ||
|
||
t.fourier_sum = _h1_fourier_sum_ | ||
|
||
t.cosine_sum = _h1_cosine_sum_ | ||
t.fourier = _h1_fourier_ | ||
t.cosine = _h1_cosine_ | ||
|
||
_new_methods_ .append ( _h1_fourier_sum_ ) | ||
_new_methods_ .append ( _h1_cosine_sum_ ) | ||
_new_methods_ .append ( _h1_fourier_ ) | ||
_new_methods_ .append ( _h1_cosine_ ) | ||
|
||
except ImportError : | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters