Skip to content

Commit

Permalink
Merge pull request #92 from jsosulski/custom_temp_path
Browse files Browse the repository at this point in the history
Ability to set path for hdf5 files
  • Loading branch information
Sylvain Chevallier authored Jun 24, 2020
2 parents a3dc152 + cf57e0a commit 3bd566c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 6 additions & 3 deletions moabb/analysis/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Results:
'''

def __init__(self, evaluation_class, paradigm_class, suffix='',
overwrite=False):
overwrite=False, hdf5_path=None):
"""
class that will abstract result storage
"""
Expand All @@ -49,8 +49,11 @@ class that will abstract result storage
assert issubclass(evaluation_class, BaseEvaluation)
assert issubclass(paradigm_class, BaseParadigm)

self.mod_dir = os.path.dirname(
os.path.abspath(inspect.getsourcefile(moabb)))
if hdf5_path is None:
self.mod_dir = os.path.dirname(
os.path.abspath(inspect.getsourcefile(moabb)))
else:
self.mod_dir = os.path.abspath(hdf5_path)
self.filepath = os.path.join(self.mod_dir, 'results',
paradigm_class.__name__,
evaluation_class.__name__,
Expand Down
7 changes: 5 additions & 2 deletions moabb/evaluations/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ class BaseEvaluation(ABC):
'''

def __init__(self, paradigm, datasets=None, random_state=None, n_jobs=1,
overwrite=False, error_score='raise', suffix=''):
overwrite=False, error_score='raise', suffix='',
hdf5_path=None):
self.random_state = random_state
self.n_jobs = n_jobs
self.error_score = error_score
self.hdf5_path = hdf5_path

# check paradigm
if not isinstance(paradigm, BaseParadigm):
Expand Down Expand Up @@ -82,7 +84,8 @@ def __init__(self, paradigm, datasets=None, random_state=None, n_jobs=1,
self.results = Results(type(self),
type(self.paradigm),
overwrite=overwrite,
suffix=suffix)
suffix=suffix,
hdf5_path=self.hdf5_path)

def process(self, pipelines):
'''Runs all pipelines on all datasets.
Expand Down

0 comments on commit 3bd566c

Please sign in to comment.