Spaces:
Build error
Build error
Upload eeg_processor.py
Browse files- modules/eeg_processor.py +23 -0
modules/eeg_processor.py
CHANGED
|
@@ -135,4 +135,27 @@ class EEGProcessor:
|
|
| 135 |
'activity': activity,
|
| 136 |
'mobility': mobility,
|
| 137 |
'complexity': complexity
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
}
|
|
|
|
| 135 |
'activity': activity,
|
| 136 |
'mobility': mobility,
|
| 137 |
'complexity': complexity
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
def process_file(self, file_path: str) -> Dict:
|
| 141 |
+
"""Process an EEG file and extract features.
|
| 142 |
+
|
| 143 |
+
Args:
|
| 144 |
+
file_path: Path to the EEG file (EDF, BDF, or CNT format)
|
| 145 |
+
|
| 146 |
+
Returns:
|
| 147 |
+
Dict containing processed EEG data and features
|
| 148 |
+
"""
|
| 149 |
+
# Load EEG file using MNE
|
| 150 |
+
raw = mne.io.read_raw_edf(file_path, preload=True)
|
| 151 |
+
|
| 152 |
+
# Preprocess the data
|
| 153 |
+
raw_processed = self.preprocess(raw)
|
| 154 |
+
|
| 155 |
+
# Extract features
|
| 156 |
+
features = self.extract_features(raw_processed)
|
| 157 |
+
|
| 158 |
+
return {
|
| 159 |
+
'raw_data': raw_processed,
|
| 160 |
+
'features': features
|
| 161 |
}
|