start implementation

This commit is contained in:
Juraj Novosad
2025-07-07 12:00:02 +02:00
parent 8cb72e0539
commit babdffdd83
13 changed files with 560 additions and 0 deletions

44
src/config_parser.py Normal file
View File

@ -0,0 +1,44 @@
import yaml
import logging
class ExperimentConfig:
def __init__(self, config_file: str):
"""
Initialize the ExperimentConfig with a configuration dictionary.
:param config: Configuration dictionary.
"""
self.config = self.load_yaml(config_file)
@classmethod
def load_yaml(cls, file_path: str) -> dict:
"""Load a YAML file and return its content.
Args:
file_path (str): Path to the YAML file.
Returns:
dict: Parsed content of the YAML file.
"""
with open(file_path, 'r') as file:
return yaml.safe_load(file)
def _setup_logging(self):
"""Set up logging based on the configuration."""
log_level = self.config.get('general', {}).get('log_level', 'INFO').upper()
log_file = self.config.get('general', {}).get('log_file', None)
log_handlers = [logging.StreamHandler()] # Default to console logging
if log_file:
log_handlers.append(logging.FileHandler(log_file))
logging.basicConfig(
level=log_level,
format="%(asctime)s.%(msecs)03d %(levelname)s - %(funcName)s: %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
handlers=log_handlers
)

19
src/interfaces.py Normal file
View File

@ -0,0 +1,19 @@
class ModuleInterface:
"""
Interface for modules in the EEG Code Research Tool.
"""
def run(self, *args, **kwargs):
"""
Run the module with the provided arguments.
"""
raise NotImplementedError("Subclasses must implement this method.")
def get_config(self) -> dict:
"""
Get the configuration of the module.
"""
raise NotImplementedError("Subclasses must implement this method.")

0
src/model_interface.py Normal file
View File

3
src/model_loader.py Normal file
View File

@ -0,0 +1,3 @@