-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathbase_step.py
More file actions
49 lines (40 loc) · 1.13 KB
/
base_step.py
File metadata and controls
49 lines (40 loc) · 1.13 KB
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
from abc import ABC, abstractmethod
from typing import List, Generic, TypeVar
# Generic type for underlying fnirs implementation (mne raw / cedalion recording)
T = TypeVar('T')
class BaseStep(ABC, Generic[T]):
"""
Stores the results of a step in a preprocess pipeline
Args:
obj (T): the implementation dependent object representing the step processed data
key (str): identifier for the step
desc (str | None, optional): description of the setup. Defaults to "key" value.
"""
obj: T
name: str
desc: str
def __init__(self, obj:T, name:str, desc:str|None=None):
self.obj = obj
self.name = name
if desc is None:
self.desc = name
else:
self.desc = desc
@property
@abstractmethod
def n_times(self) -> int:
pass
@property
@abstractmethod
def sfreq(self) -> float:
pass
@property
@abstractmethod
def ch_names(self) -> List[str]:
pass
@property
def duration(self) -> float:
return self.n_times / self.sfreq
@abstractmethod
def plot(self, **kwargs):
pass