From 29b1a9dcd85b719cbea5fb3898fb7cdba21c8601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Assun=C3=A7ao=20Jeshon?= Date: Wed, 5 Sep 2018 07:58:34 +0200 Subject: [PATCH 1/2] Fix some bugs appearing on Windows --- explore_data.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/explore_data.py b/explore_data.py index 2bc99c9..ddde63e 100644 --- a/explore_data.py +++ b/explore_data.py @@ -29,7 +29,9 @@ def plot(name, values, path, datetime, filename, current_color): axe = "0" + str(axe) plt.plot(range(len(values)), values, color='#A0'+axe+axe) - filepath = path + "/" + name + "/" + filename + "/" + str(datetime) + '.png' + datetime = str(datetime).replace('.', '_') + datetime = str(datetime).replace(':', '-') + filepath = os.path.join(path, name, filename, datetime + '.png') create_path(filepath) plt.savefig(filepath) @@ -51,7 +53,7 @@ def charge_iteration(charge_items, filename): ambiant_temp = format_temperature(item[1][0][0]) # temperature: 4 ~24 ~43 datetime = convert_matlab_datetime_vector_to_utc(item[2][0]) - path = "output_graphs/charges/degree" + str(ambiant_temp) + path = os.path.join("output_graphs", "charges", "degree" + str(ambiant_temp)) voltage_measured = item[3][0][0][0][0] # Battery terminal voltage (Volts) floats current_measured = item[3][0][0][1][0] # Battery output current (Amps) floats @@ -139,9 +141,9 @@ def main(): # TODO warning for for the [:1] for filepath in filepaths[:1]: - filename = filepath.split("/")[-1].split(".")[0] - print(filename) + filename = filepath.split("\\")[-1].split(".")[0] raw_mat = scipy.io.loadmat(filepath) + mat = raw_mat[filename][0][0][0][0] impedance_items = filter_mat(mat, "impedance") -- GitLab From 7821b19850f1418921799fd5036d41f66bcc768f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Assun=C3=A7ao=20Jeshon?= Date: Wed, 5 Sep 2018 08:10:27 +0200 Subject: [PATCH 2/2] Make the code runnig for other os than windows --- explore_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/explore_data.py b/explore_data.py index ddde63e..b101d63 100644 --- a/explore_data.py +++ b/explore_data.py @@ -141,7 +141,7 @@ def main(): # TODO warning for for the [:1] for filepath in filepaths[:1]: - filename = filepath.split("\\")[-1].split(".")[0] + filename = os.path.split(filepath)[-1].split(".")[0] raw_mat = scipy.io.loadmat(filepath) mat = raw_mat[filename][0][0][0][0] -- GitLab