diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2020-01-26 08:14:32 +0100 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2020-01-26 08:14:32 +0100 |
commit | ea424f096c05a9587ffaa0bc6e5392790a046bd7 (patch) | |
tree | 01d0f9c596ebea229e6a8e2774a7a69a502a3488 /tests/roof.py | |
parent | 02b452a86d11655002fdfbb1566ef494e2c954d2 (diff) | |
download | ufo-roof-temp-ea424f096c05a9587ffaa0bc6e5392790a046bd7.tar.gz ufo-roof-temp-ea424f096c05a9587ffaa0bc6e5392790a046bd7.tar.bz2 ufo-roof-temp-ea424f096c05a9587ffaa0bc6e5392790a046bd7.tar.xz ufo-roof-temp-ea424f096c05a9587ffaa0bc6e5392790a046bd7.zip |
Build ROOF sinograms
Diffstat (limited to 'tests/roof.py')
-rw-r--r-- | tests/roof.py | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/tests/roof.py b/tests/roof.py index 831de7c..931c32f 100644 --- a/tests/roof.py +++ b/tests/roof.py @@ -1,35 +1,41 @@ import gi +import re import sys import json import argparse + gi.require_version('Ufo', '0.0') from gi.repository import Ufo from gi.repository import GObject class RoofConfig: - def __init__(self, config="roof.json"): + def __init__(self, args, config="roof.json"): self.streams = 1 - + self.bit_depth = 8 + self.convert = False if ((not args.output) or (re.compile('\.raw$').search(args.output))) else True + self.build = "raw" if args.plain else "ufo" if self.convert else "sino" + 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: + elif cfg.get("hardware", {}).get("modules") != None: self.streams = cfg["setup"]["modules"] - -config = "roof.json" -output = None + if cfg.get("hardware", {}).get("bit_depth") != None: + self.bit_depth = cfg["hardware"]["bit_depth"] parser = argparse.ArgumentParser() parser.add_argument('-c', '--config', dest="config", default="roof.json", help="ROOF configuration (JSON)") parser.add_argument('-o', '--output', dest="output", default=None, help="Output file") parser.add_argument('-n', '--number', dest="number", default=None, type=int, help="Specify number of frames to capture") +parser.add_argument('-p', '--plain', dest="plain", default=False, type=bool, help="Plain network test (no ROOF structures)") +#parser.add_argument('-r', '--raw', dest="raw", default=False, type=bool, help="Store raw data, ignore processed") args = parser.parse_args() -cfg = RoofConfig(args.config) +cfg = RoofConfig(args, args.config) pm = Ufo.PluginManager() graph = Ufo.TaskGraph() @@ -46,7 +52,7 @@ else: if args.number is None: args.number = 5 build = pm.get_task('roof-build') -build.set_properties(config=args.config, number=args.number) +build.set_properties(config=args.config, number=args.number, build=cfg.build) for id in range(cfg.streams): read = pm.get_task('roof-read') |