Commit 3c28e20b authored by Feliks Kiszkurno's avatar Feliks Kiszkurno
Browse files

Added absolute path option to import functions

parent 330490d5
%% Cell type:code id: tags:
``` python
import slopestabilitytools
import settings
import os
settings.init()
```
%% Cell type:code id: tags:
``` python
print(os.path.abspath(os.path.join(os.getcwd(), os.pardir)) + '/')
test_results = slopestabilitytools.datamanagement.import_tests(abs_path=os.path.abspath(os.path.join(os.getcwd(), os.pardir))+'/')
#for test_name in test_results.keys():
```
%%%% Output: stream
/home/felikskrno/Documents/Studies/MasterThesis/PythonProjects/SlopeStability/
......@@ -12,14 +12,12 @@ import settings
import pandas as pd
def import_tests():
def import_tests(abs_path=''):
test_results = {}
test_names = slopestabilitytools.datamanagement.test_list('.csv')
#print('test')
#print(test_names)
test_names = slopestabilitytools.datamanagement.test_list('.csv', abs_path=abs_path)
for test_name in test_names:
test_result_curr = pd.read_csv(settings.settings['data_folder'] + '/' + test_name + '.csv', index_col=0)
test_result_curr = pd.read_csv(abs_path + settings.settings['data_folder'] + '/' + test_name + '.csv', index_col=0)
test_results.update({test_name: test_result_curr})
return test_results
......@@ -13,9 +13,9 @@ import settings
# TODO Add more flexibility in the way, that the path is handled
def test_list(extension):
def test_list(extension, *, abs_path=''):
path = settings.settings['data_folder']
path = abs_path + settings.settings['data_folder']
file_list = os.listdir(path)
test_names = []
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment