forked from scikit-hep/probfit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
decorator.py
47 lines (32 loc) · 946 Bytes
/
decorator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#decorators
#@normalized_function(xmin,xmax)
#def function_i_have_no_idea_how_to_normalize(x,y,z)
# return complicated_function(x,y,z)
#
from .functor import Normalized, Extended
class normalized:
"""
Normalized decorator
**Arguments**
- **bound** normalized bound
- **nint** option number of integral pieces. Default 1000.
.. seealso::
:class:`probfit.functor.Normalized`
"""
def __init__(self, bound, nint=1000):
self.bound = bound
self.nint = nint
def __call__(self, f):
return Normalized(f, self.bound, self.nint)
class extended:
"""
Extended decorator
**Arguments**
- **extname** extended parameter name. Default 'N'
.. seealso::
:class:`probfit.functor.Extended`
"""
def __init__(self, extname='N'):
self.extname = extname
def __call__(self, f):
return Extended(f, extname=self.extname)