summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2020-03-08 15:45:10 +0100
committerSuren A. Chilingaryan <csa@suren.me>2020-03-08 15:45:10 +0100
commitf3cec7d31f46697c47529800b532b66707525168 (patch)
tree3dbcfebce44e56ed03f6db6e3391ec35d768fd0c
parentd9206207dcba0cdf464dc7c092c923516872386c (diff)
downloadufo-roof-f3cec7d31f46697c47529800b532b66707525168.tar.gz
ufo-roof-f3cec7d31f46697c47529800b532b66707525168.tar.bz2
ufo-roof-f3cec7d31f46697c47529800b532b66707525168.tar.xz
ufo-roof-f3cec7d31f46697c47529800b532b66707525168.zip
Support /dev/null as output method
-rw-r--r--tests/roof/arguments.py2
-rw-r--r--tests/roof/config.py9
-rw-r--r--tests/roof/graph.py15
3 files changed, 13 insertions, 13 deletions
diff --git a/tests/roof/arguments.py b/tests/roof/arguments.py
index 22ea42b..3c8caed 100644
--- a/tests/roof/arguments.py
+++ b/tests/roof/arguments.py
@@ -15,7 +15,7 @@ def roof_get_args():
parser.add_argument('-b', '--benchmark', dest="benchmark", default=None, action="store_true", help="Bencmarking mode, writes to /dev/null")
parser.add_argument('-g', '--gui', dest='gui', default=False, action="store_true", help="Visualize data")
parser.add_argument('-t', '--track', dest='track', default=False, action="store_true", help="Track & control experiment")
-
+
parser.add_argument( '--no-roof', dest="noroof", default=False, action="store_true", help="Disable ROOF, only network testing (no sinogram building, store linearly)")
# I/O
diff --git a/tests/roof/config.py b/tests/roof/config.py
index 8f72014..5ea8d41 100644
--- a/tests/roof/config.py
+++ b/tests/roof/config.py
@@ -21,13 +21,13 @@ class RoofConfig:
self.imaging_rate = self.get_opt('hardware', 'imaging_rate', 0)
self.fan_bins = self.modules * self.get_opt('hardware', 'channels_per_module', 16)
self.fan_projections = self.get_opt('hardware', 'samples_per_rotation', (self.sample_rate / self.imaging_rate) if (self.imaging_rate and self.sample_rate) else 1000)
-
+
if self.args.number is None: self.args.number = 0 if self.args.benchmark else self.planes
# Consistency and default mode
if (self.args.plane is not None) and (self.args.plane > self.planes):
raise ValueError("Only {} planes in configuration, but the plane {} is requested".format(self.planes, self.args.plane))
-
+
n_modes = (int(self.args.gui) + int(self.args.track) + int(0 if self.args.write is None else 1))
if n_modes > 1:
raise ValueError("GUI, Control, and Write modes are mutualy incompatible")
@@ -59,8 +59,9 @@ class RoofConfig:
return globre.sub('*', path)
def get_writer_type(self):
+ if self.args.output and re.search('/dev/null$', self.args.output): return None
return None if self.args.benchmark else self.args.write if self.args.write else 'raw_sinograms'
-
+
def get_writer_path(self):
data_type = self.get_writer_type()
if data_type is not None:
@@ -68,7 +69,7 @@ class RoofConfig:
if self.args.format: path = re.sub('\.([^.]+)$', '.' + self.args.format, path)
return path
return None
-
+
def check_writer_type_is_raw_or_none(self):
data_type = self.get_writer_type()
data_path = self.get_writer_path()
diff --git a/tests/roof/graph.py b/tests/roof/graph.py
index 495c629..62aa44e 100644
--- a/tests/roof/graph.py
+++ b/tests/roof/graph.py
@@ -32,13 +32,13 @@ class RoofGraph(RoofConfig):
def get_roof_task(self, name, **kwargs):
kwargs.update(config = self.config_file)
return self.get_task(name, **kwargs)
-
+
def get_processor_task(self, stage, name, **kwargs):
extra_args = self.get_opt(stage, name + '-options')
if extra_args is not None: kwargs.update(extra_args)
if (re.compile('roof').match(name)): kwargs.update(config = self.config_file)
return self.save_task(stage, name, self.get_task(name, **kwargs))
-
+
def get_read_task(self, path):
params = { 'raw_width': self.fan_bins, 'raw_height': self.fan_projections, 'raw_bitdepth': self.bit_depth } if re.search('\.raw$', path) else { }
params['path'] = path
@@ -132,11 +132,11 @@ class RoofGraph(RoofConfig):
def get_processor(self, head, stage, writer = None):
# skip (but not if not already skipped in previous processor)
# how to connect readers to ffc?
-
+
filters = self.get_opt(stage, 'filters', roof_filters[stage])
read_here = self.args.read and self.args.read in roof_data_types[stage].keys()
write_here = self.args.write and self.args.write in roof_data_types[stage].keys()
-
+
start_pos = 0
if read_here:
start_filter = roof_data_types[stage][self.args.read]
@@ -159,7 +159,7 @@ class RoofGraph(RoofConfig):
if write_here and writer:
self.graph.connect_nodes(head, writer)
-
+
return None if write_here else head
@@ -172,7 +172,7 @@ class RoofGraph(RoofConfig):
# - Write mode: The reconstruction is performed and data is written after the specified step (default) [ -w <all other data types> ]
# - Control mode: Control branch and raw data writting [ -c ]
# - GUI mode: Visualization in GUI + raw_sinograms are written when enabled in GUI + some control tasks (also when enabled) [ -g ]
-
+
head = reader
# Check if we are branching here
if (self.args.track or self.args.gui) and (self.get_data_type() is not None):
@@ -204,7 +204,6 @@ class RoofGraph(RoofConfig):
# if head split to 3 branches.... Otherwise, continue with control branch...
except finish:
pass
-
+
def run(self):
self.scheduler.run(self.graph)
- \ No newline at end of file