-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilesystem_handlers.py
49 lines (34 loc) · 951 Bytes
/
filesystem_handlers.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
#!/usr/bin/env python3
#adriangutierrezg
"""
"""
import os
import sys
from szs_path import SZSPATH
sys.path.insert(0, SZSPATH)
from seizureProcessing.utils.get_directories import *
def adjustPathToLatestPreprocessingStep(path, start='DS_data', stop='reref'):
'''adjusts path to the latest
stage of preprocessing
Params:
path, str or path object: path to session data
stop, str: where in the path to stop looking
Returns:
path, os.path(): path to latest preprocessing stage
'''
a = start
o = stop
if path.endswith('/'):
path = os.path.dirname(path) #fix path parsing issue
#look for paths
path_ = find_dir(path, a)
if path_:
path = path_
del path_
path_ = find_dir(path, o)
if path_:
path = path_
del path_
return path
if __name__ == '__main__':
adjustPathToLatestPreprocessingStep()