Skip to content
Snippets Groups Projects
Commit 480e10f4 authored by Hees, L.J.H. (Laurens)'s avatar Hees, L.J.H. (Laurens)
Browse files

Merge branch 'SC-187/cleanup-and_docstrings' of...

Merge branch 'SC-187/cleanup-and_docstrings' of gitlab.socsci.ru.nl:msdt/team1920-speechcomparison into SC-187/cleanup-and_docstrings
parents c85465cc c0196554
No related branches found
No related tags found
1 merge request!132Sc 187/cleanup and docstrings
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (2)" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/team1920-speechcomparison.iml" filepath="$PROJECT_DIR$/.idea/team1920-speechcomparison.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">
<option name="projectConfiguration" value="pytest" />
<option name="PROJECT_TEST_RUNNER" value="pytest" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="77b63012-6ca3-4e1a-a2c9-39c5129fd16d" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/umbra/umbra.py" beforeDir="false" afterPath="$PROJECT_DIR$/umbra/umbra.py" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectId" id="1UpXK7qExpTsxYJdqiA2N1aIXxl" />
<component name="PropertiesComponent">
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager">
<configuration name="umbra" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="team1920-speechcomparison" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/umbra" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/umbra/umbra.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<recent_temporary>
<list>
<item itemvalue="Python.umbra" />
</list>
</recent_temporary>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="77b63012-6ca3-4e1a-a2c9-39c5129fd16d" name="Default Changelist" comment="" />
<created>1576054443868</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1576054443868</updated>
</task>
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State>
<option name="COLUMN_ORDER" />
</State>
</value>
</entry>
</map>
</option>
</component>
</project>
\ No newline at end of file
......@@ -94,34 +94,23 @@ class FileWriter(ABC):
def __init__(self):
pass
@abstractmethod
def write(self, path, results):
pass
class CSVWriter(FileWriter):
def __init__(self):
super().__init__()
def write(self, path, results):
"""Write a CSV file of the results.
@staticmethod
def write_frame(path, results, result_type):
"""Write results of given type to appropriate file.
Args:
path: Path to save location
results: Analysis results to write to file
"""
source, shadow, info = results
info = ('Total {} Shadowed {} Skipped {}'
.format(str(info[0]), str(info[1]), str(info[2])))
sc = []
for entry in source:
sc.append([entry.word, entry.onset, entry.offset, entry.shadowed])
with open(path + '.csv', 'w') as f:
writer = csv.writer(f)
writer.writerow(['Word', 'Onset', 'Offset', 'Shadowed'])
writer.writerows(sc)
writer.writerow(info)
results.sort_values(by=['participant', 'video', 'condition'],
inplace=True)
results.to_csv(path + '/' + result_type)
@staticmethod
def write_frame(path, results, result_type):
......
......@@ -53,7 +53,7 @@ class Model:
self._shadow_tasks = tasks
def analysis_complete(self):
"""Returns whether the analysis is completed."""
"""Check whether the analysis is completed."""
return self._analysed
def compare(self):
......
......@@ -8,8 +8,10 @@ def get_path(path):
Args:
path: String to the path of the file.
"""
Returns:
Correctly formatted path
"""
if sys.platform.startswith('linux'):
return "umbra/"+path
return path
......
......@@ -4,6 +4,7 @@ import tkinter.filedialog as fd
from functools import partial
from tkinter import ttk, W
from PIL import ImageTk, Image
from mistake_enum import Mistake
from utils import set_icon, get_path, add_to_dict
......@@ -68,21 +69,10 @@ class View:
@property
def action_listener(self):
"""Get the action listener of the View.
Returns:
_action_listener: dict object for storing Strings of
commands.
"""
return self._action_listener
@action_listener.setter
def action_listener(self, value):
"""Sets the action listener of the View.
Args:
value: dict object containing the Strings of commands.
"""
self._action_listener = value
def display(self):
......@@ -489,7 +479,7 @@ class View:
if selection:
return selection
else:
self.update_message("no_dir")
self.update_message('no_dir')
def selected(self, type_code):
"""Get selected files.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment