You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemds.apache.org by ba...@apache.org on 2022/05/16 13:12:55 UTC
[systemds] branch main updated: [SYSTEMDS-3354] Python Cos Sin Signal Test
This is an automated email from the ASF dual-hosted git repository.
baunsgaard pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/systemds.git
The following commit(s) were added to refs/heads/main by this push:
new 3c077cf966 [SYSTEMDS-3354] Python Cos Sin Signal Test
3c077cf966 is described below
commit 3c077cf9669910eea96ee28bd1a7dd7f64526c64
Author: baunsgaard <ba...@tugraz.at>
AuthorDate: Mon May 16 14:37:58 2022 +0200
[SYSTEMDS-3354] Python Cos Sin Signal Test
Closes #1616
---
src/main/python/tests/algorithms/test_signal.py | 54 +++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/src/main/python/tests/algorithms/test_signal.py b/src/main/python/tests/algorithms/test_signal.py
new file mode 100644
index 0000000000..85b0438b02
--- /dev/null
+++ b/src/main/python/tests/algorithms/test_signal.py
@@ -0,0 +1,54 @@
+
+# -------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# -------------------------------------------------------------
+
+import unittest
+
+import numpy as np
+from systemds.context import SystemDSContext
+
+
+class TestSignal(unittest.TestCase):
+
+ sds: SystemDSContext = None
+
+ @classmethod
+ def setUpClass(cls):
+ cls.sds = SystemDSContext()
+
+ @classmethod
+ def tearDownClass(cls):
+ cls.sds.close()
+
+ def test_create_signal(self):
+ # https://issues.apache.org/jira/browse/SYSTEMDS-3354
+
+ # signal = self.sds.from_numpy(np.arange(0, 3, 1))
+ signal = self.sds.seq(0, 2, 1)
+ pi = self.sds.scalar(3.141592654)
+ size = signal.nRow()
+ n = self.sds.seq(0, size-1)
+ k = self.sds.seq(0, size-1)
+ M = (n @ (k.t())) * (2*pi/size)
+ Xa = M.cos() @ signal
+ Xb = M.sin() @ signal
+ DFT = signal.cbind(Xa).cbind(Xb).compute()
+ print(DFT)