-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoh_loading.py
72 lines (56 loc) · 1.65 KB
/
coh_loading.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
"""Methods for loading files and handling the resulting objects."""
import os
from coh_handle_files import generate_sessionwise_fpath, load_file
from coh_signal import data_dict_to_signal, Signal
def load_preprocessed_dict(
folderpath_preprocessing: str,
dataset: str,
preprocessing: str,
subject: str,
session: str,
task: str,
acquisition: str,
run: str,
ftype: str,
) -> Signal:
"""Loads preprocessed data saved as a dictionary and converts it to a Signal
object.
PARAMETERS
----------
folderpath_preprocessing : str
- Path to the preprocessing folder where the data and settings are found.
dataset : str
- Name of the dataset to analyse.
preprocessing : str
- Name of the preprocessing type to analyse.
subject : str
- Name of the subject to analyse.
session : str
- Name of the session to analyse.
task : str
- Name of the task to analyse.
acquisition : str
- Name of the acquisition to analyse.
run : str
- Name of the run to analyse.
ftype : str
- Filetype of the file.
RETURNS
-------
signal : Signal
- The preprocessed data converted from a dictionary to a Signal object.
"""
fpath = generate_sessionwise_fpath(
folderpath=os.path.join(folderpath_preprocessing, "Data"),
dataset=dataset,
subject=subject,
session=session,
task=task,
acquisition=acquisition,
run=run,
group_type=preprocessing,
filetype=ftype,
)
data_dict = load_file(fpath=fpath)
signal = data_dict_to_signal(data=data_dict)
return signal