Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1039)

Unified Diff: webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/data_access.py

Issue 2714543005: Evaluation controller, evaluation score abstract class, and score data access. (Closed)
Patch Set: Downgrading to Python 2 Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/data_access.py
diff --git a/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/data_access.py b/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/data_access.py
index 90956442e27ab49548604cfcb0f9e86d36351d35..acbe03f9af729c2fe8ea9085bdf6b08fefc59c5c 100644
--- a/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/data_access.py
+++ b/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/data_access.py
@@ -68,3 +68,22 @@ class AudioProcConfigFile(object):
def save(cls, filepath, config):
with open(filepath, 'w') as f:
json.dump(config, f)
+
+
+class ScoreFile(object):
+ """
+ Data access class to save and load float scalar scores.
+ """
+
+ def __init__(self):
+ pass
+
+ @classmethod
+ def load(cls, filepath):
+ with open(filepath) as f:
+ return float(f.readline().strip())
+
+ @classmethod
+ def save(cls, filepath, score):
+ with open(filepath, 'w') as f:
+ f.write('{0:f}\n'.format(score))

Powered by Google App Engine
This is Rietveld 408576698