summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2019-11-17 09:16:57 +0100
committerSuren A. Chilingaryan <csa@suren.me>2019-11-17 09:16:57 +0100
commit3d93df54d024f49895db6277e873dccd10b5baec (patch)
treec664797c69e4b4680d04aee7669da03e452e0c5d /tests
downloadufo-roof-3d93df54d024f49895db6277e873dccd10b5baec.tar.gz
ufo-roof-3d93df54d024f49895db6277e873dccd10b5baec.tar.bz2
ufo-roof-3d93df54d024f49895db6277e873dccd10b5baec.tar.xz
ufo-roof-3d93df54d024f49895db6277e873dccd10b5baec.zip
The first test (file file-base simmulation)
Diffstat (limited to 'tests')
-rw-r--r--tests/roof.json31
-rw-r--r--tests/roof.py46
-rwxr-xr-xtests/roof.sh3
-rw-r--r--tests/roof.yaml26
-rw-r--r--tests/test_file.sh11
5 files changed, 117 insertions, 0 deletions
diff --git a/tests/roof.json b/tests/roof.json
new file mode 100644
index 0000000..0dcd1e7
--- /dev/null
+++ b/tests/roof.json
@@ -0,0 +1,31 @@
+{
+ "network": {
+ "protocol": "udp",
+ "port": 4000,
+ "streams": 16,
+ "payload_size": 1280,
+ "dataset_size": 1024000
+ },
+ "performance": {
+ "buffer_size": 2,
+ "packets_at_once": 100
+ },
+ "simulation": {
+ "first_file_number": 1,
+ "path": "/mnt/fast/ROOF2/roof2-data.pumpe256/meas/data_pumpe_dyn_192.168.100_%02u.dat"
+ },
+ "setup": {
+ "planes": 2,
+ "modules": 16,
+ "bit_depth": 16,
+ "pixels_per_module": 16,
+ "samples_per_rotation": 2000000
+ },
+ "geometry": {
+ "fan_projections": 1000,
+ "fan_detectors": 432,
+ "parallel_projections": 512,
+ "parallel_detectors": 256,
+ "detector_diameter": 216
+ }
+}
diff --git a/tests/roof.py b/tests/roof.py
new file mode 100644
index 0000000..2138931
--- /dev/null
+++ b/tests/roof.py
@@ -0,0 +1,46 @@
+import gi
+import sys
+import json
+import gobject
+
+from gi.repository import Ufo
+from gi.repository import GObject
+
+class RoofConfig:
+ def __init__(self, config="roof.json"):
+ self.streams = 1
+
+ with open(config) as json_file:
+ cfg = json.load(json_file)
+ if cfg.get("network", {}).get("streams") != None:
+ self.streams = cfg["network"]["streams"]
+ elif cfg.get("setup", {}).get("modules") != None:
+ self.streams = cfg["setup"]["modules"]
+
+config = "roof.json"
+cfg = RoofConfig(config)
+
+pm = Ufo.PluginManager()
+graph = Ufo.TaskGraph()
+scheduler = Ufo.Scheduler()
+
+
+build = pm.get_task('roof-build')
+build.set_properties(config=config, number=0)
+
+write = pm.get_task('write')
+write.set_properties(filename="test.raw")
+
+for id in range(cfg.streams):
+ read = pm.get_task('roof-read')
+ read.set_properties(config=config, id=id)
+ graph.connect_nodes(read, build)
+ build.bind_property('stop', read, 'stop', GObject.BindingFlags.DEFAULT)
+
+#read_task.set_properties(path='/home/data/*.tif', start=10, number=100)
+#graph.connect_nodes_full(read, write, 0)
+graph.connect_nodes(build, write)
+
+
+
+scheduler.run(graph)
diff --git a/tests/roof.sh b/tests/roof.sh
new file mode 100755
index 0000000..d0ec30a
--- /dev/null
+++ b/tests/roof.sh
@@ -0,0 +1,3 @@
+cat roof.yaml | yq . > roof.json
+
+GI_TYPELIB_PATH="/usr/local/lib64/girepository-1.0/" python roof.py
diff --git a/tests/roof.yaml b/tests/roof.yaml
new file mode 100644
index 0000000..a49d53b
--- /dev/null
+++ b/tests/roof.yaml
@@ -0,0 +1,26 @@
+network:
+ protocol: udp
+ port: 4000
+ streams: 16
+# header_size: 0
+ payload_size: 1280
+# max_packet_size: 1284
+ dataset_size: 1024000
+performance:
+ buffer_size: 2
+ packets_at_once: 100
+simulation:
+ first_file_number: 1
+ path: "/mnt/fast/ROOF2/roof2-data.pumpe256/meas/data_pumpe_dyn_192.168.100_%02u.dat"
+setup:
+ planes: 2
+ modules: 16
+ bit_depth: 16
+ pixels_per_module: 16
+ samples_per_rotation: 2000000
+geometry:
+ fan_projections: 1000
+ fan_detectors: 432
+ parallel_projections: 512
+ parallel_detectors: 256
+ detector_diameter: 216
diff --git a/tests/test_file.sh b/tests/test_file.sh
new file mode 100644
index 0000000..5f47e45
--- /dev/null
+++ b/tests/test_file.sh
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+packet_size=1280
+packets_per_dataset=50
+
+for packet in $(seq 0 24); do
+ for id in $(seq 0 15); do
+ name=$(ls *$id.dat | grep -P "_0?$id.dat")
+ dd if=$name of="roof_test.raw" bs=$packet_size count=$packets_per_dataset skip=$((packet * $packets_per_dataset)) oflag=append conv=notrunc
+ done
+done