-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmethod_new_with_parameters.py
58 lines (47 loc) · 2.24 KB
/
method_new_with_parameters.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
48
49
50
51
52
53
54
55
56
57
58
""" A template file to add new method in the benchmark.
Remark: Make sure that this file starts with "method_".
"""
""" First section ----------------------------------------------------------------------
| Import here all the modules you need.
| Remark: Make sure that neither of those modules starts with "method_".
"""
from mcsm_benchs.benchmark_utils import MethodTemplate # Import the template!
""" Second section ---------------------------------------------------------------------
| Put here all the functions that your method uses.
|
| def a_function_of_my_method(signal,params):
| ...
"""
""" Third section ----------------------------------------------------------------------
| Create here a new class that will encapsulate your method.
| This class should inherit the abstract class MethodTemplate.
| You must then implement the class function:
def method(self, signal, params)
| which should receive the signals and any parameters that you desire to pass to your
| method.
"""
class NewMethod(MethodTemplate):
def __init__(self):
self.id = 'a_new_method'
self.task = 'denoising' # Should be either 'denoising' or 'detection'
def method(self, signal, *args, **kwargs): # Implement this method.
...
def get_parameters(self): # Use it to parametrize your method.
""" This function should return a list/tuple of positional arguments and keyword
arguments for your method. The positional arguments must be indicated in a tuple
or a list, whereas the keyword arguments must be indicated using a dictionary.
If your method uses either just positional (resp. keyword) arguments, leave an
empty tuple (resp. dictionary).
"""
# # Example 1. Pass a method a combination of positional/keyword args:
# return (((5, 6),{'a':True,'b':False}),
# ((2, 1),{'a':False,'b':True}),
# )
# # Example 2. Use only positional args:
# return (((5, 6),{}),
# ((2, 1),{}),
# )
# # Example 3. Use only keyword args:
# return (((),{'a':True,'b':False}),
# ((),{'a':False,'b':True}),
# )