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

Added absolute path option to import functions

parent 330490d5
{
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import slopestabilitytools\n",
"import settings\n",
"import os\n",
"settings.init()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/home/felikskrno/Documents/Studies/MasterThesis/PythonProjects/SlopeStability/\n"
]
}
],
"source": [
"print(os.path.abspath(os.path.join(os.getcwd(), os.pardir)) + '/')\n",
"test_results = slopestabilitytools.datamanagement.import_tests(abs_path=os.path.abspath(os.path.join(os.getcwd(), os.pardir))+'/')\n",
"#for test_name in test_results.keys():\n"
],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
}
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
\ No newline at end of file
......@@ -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