summaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
authorDaniel M. Pelt <D.M.Pelt@cwi.nl>2015-06-24 18:36:03 +0200
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-07-23 11:57:15 +0200
commit11af4b554df9a8a5c31d9dcbc1ea849b32394ba3 (patch)
treef9507f1fe22559d73bfa992c960e8b254b4edcc4 /samples
parent18b6d25f7e4f0943b3592f3bb4f6ca5ed9c285d3 (diff)
downloadastra-11af4b554df9a8a5c31d9dcbc1ea849b32394ba3.tar.gz
astra-11af4b554df9a8a5c31d9dcbc1ea849b32394ba3.tar.bz2
astra-11af4b554df9a8a5c31d9dcbc1ea849b32394ba3.tar.xz
astra-11af4b554df9a8a5c31d9dcbc1ea849b32394ba3.zip
Better way of passing options to Python plugin using inspect
Diffstat (limited to 'samples')
-rw-r--r--samples/python/s018_plugin.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/samples/python/s018_plugin.py b/samples/python/s018_plugin.py
index 6677930..90e09ac 100644
--- a/samples/python/s018_plugin.py
+++ b/samples/python/s018_plugin.py
@@ -33,21 +33,16 @@ import six
class SIRTPlugin(astra.plugin.base):
"""Example of an ASTRA plugin class, implementing a simple 2D SIRT algorithm.
- Optional options:
+ Options:
- 'rel_factor': relaxation factor
+ 'rel_factor': relaxation factor (optional)
"""
- required_options=[]
- optional_options=['rel_factor']
- def initialize(self,cfg):
+ def initialize(self,cfg, rel_factor = 1):
self.W = astra.OpTomo(cfg['ProjectorId'])
self.vid = cfg['ReconstructionDataId']
self.sid = cfg['ProjectionDataId']
- try:
- self.rel = cfg['option']['rel_factor']
- except KeyError:
- self.rel = 1
+ self.rel = rel_factor
def run(self, its):
v = astra.data2d.get_shared(self.vid)