From e1fcd681bcf374b8edf58aee9641bfba5d42fd6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20Veli=C4=8Dkovi=C4=87?= Date: Sat, 20 Jan 2018 19:26:36 +0000 Subject: [PATCH] Committing the Bridge class --- __init__.py | 0 backend/bridge.py | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 __init__.py create mode 100644 backend/bridge.py diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend/bridge.py b/backend/bridge.py new file mode 100644 index 0000000..b125128 --- /dev/null +++ b/backend/bridge.py @@ -0,0 +1,18 @@ +import numpy as np +# Linking functions to be accessed by the frontend + +default_db = 'backend/db/' + +class Bridge: + def __init__(self, path_to_db=default_db): + self.objs = np.load(path_to_db + 'objs_db.npy') + self.plcs = np.load(path_to_db + 'plcs_db.npy') + + # obj_dist: distribution of objects (shape: (1000,)) + # plc_dist: distribution of places (shape: (401,)) + # use_obj: whether to use objects + # use_plc: whether to use places + # Returns: a vector of shape (10,) containing volume levels + def get_sound(obj_dist, plc_dist, use_obj=True, use_plc=True): + return np.ones(10) +