From 98ef87aff7f90a44608cfd099282ad3fab8f1724 Mon Sep 17 00:00:00 2001 From: "Verbeek, J.M. (Janneke)" <j.verbeek@student.ru.nl> Date: Mon, 2 Dec 2019 15:14:46 +0100 Subject: [PATCH] Found bug, fixed bug --- umbra/filereader.py | 9 +++++++-- umbra/model.py | 2 +- umbra/umbra.py | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/umbra/filereader.py b/umbra/filereader.py index dd5ee449..444a0479 100644 --- a/umbra/filereader.py +++ b/umbra/filereader.py @@ -66,6 +66,7 @@ class CSVReader(FileReader): """ Args: path: string, the internal path to the source file + type: string, the type (source/shadow) of the source file. """ super().__init__(path) self._type = type # Very dirty fix @@ -150,7 +151,6 @@ class TxtWriter(FileWriter): final = np.append(final, "Skips: "+str(info[2])) np.savetxt(path, final, fmt="%s", header="Word|Shadowed") -# Untested def _participant_path(part_number): """ Create a path for the appropriate participant. @@ -189,11 +189,16 @@ class CSVWriter(FileWriter): writer.writerow(info) def write_multiple(self, dir, dict): + """ + Write multiple CSV files. + Args: + dir (string), the directory paths + dict (dictionary), dictionary containing results + """ for key, results in dict.items(): path = self._participant_path(dir, key) self.write(path, results) - # TODO: Test per-participant writing def _participant_path(self, dir, key): """ Create a path for the appropriate participant. diff --git a/umbra/model.py b/umbra/model.py index 702f161d..ae4532c0 100644 --- a/umbra/model.py +++ b/umbra/model.py @@ -71,7 +71,7 @@ class Model: if self._id is ut.filter_key(key): result = self._stats.analyze(self._data_source, data) - self.add_to_dict(key+"_res", result, self._multi_results) + ut.add_to_dict(key+"_res", result, self._multi_results) else: pass else: diff --git a/umbra/umbra.py b/umbra/umbra.py index ed32cc2f..9b5a64b2 100644 --- a/umbra/umbra.py +++ b/umbra/umbra.py @@ -15,6 +15,6 @@ class Umbra: """Start the main loop.""" self._controller.start() -B + if __name__ == "__main__": Umbra().main() -- GitLab