|
1 | | -# Copyright 2014-2018 The ODL contributors |
| 1 | +# Copyright 2014-2019 The ODL contributors |
2 | 2 | # |
3 | 3 | # This file is part of ODL. |
4 | 4 | # |
@@ -145,20 +145,30 @@ def __init__(self, reco_space, geometry, variant, **kwargs): |
145 | 145 | else: |
146 | 146 | raise RuntimeError('bad impl') |
147 | 147 |
|
148 | | - impl, impl_in = str(impl).lower(), impl |
149 | | - if impl not in _SUPPORTED_IMPL: |
150 | | - raise ValueError('`impl` {!r} not understood'.format(impl_in)) |
151 | | - if impl not in _AVAILABLE_IMPLS: |
152 | | - raise ValueError('{!r} back-end not available'.format(impl)) |
| 148 | + impl_in = None |
| 149 | + |
| 150 | + else: |
| 151 | + impl, impl_in = str(impl).lower(), impl |
| 152 | + if impl not in _SUPPORTED_IMPL: |
| 153 | + raise ValueError('`impl` {!r} not understood'.format(impl_in)) |
| 154 | + if impl not in _AVAILABLE_IMPLS: |
| 155 | + raise ValueError('{!r} back-end not available'.format(impl)) |
153 | 156 |
|
154 | 157 | # Cache for input/output arrays of transforms |
155 | 158 | self.use_cache = kwargs.pop('use_cache', True) |
156 | 159 |
|
157 | 160 | # Sanity checks |
158 | 161 | if impl.startswith('astra'): |
159 | 162 | if geometry.ndim > 2 and impl.endswith('cpu'): |
160 | | - raise ValueError('`impl` {!r} only works for 2d' |
161 | | - ''.format(impl_in)) |
| 163 | + if impl_in is None: |
| 164 | + raise ValueError( |
| 165 | + 'fastest available `impl` {!r} only supports 2D' |
| 166 | + ''.format(impl) |
| 167 | + ) |
| 168 | + else: |
| 169 | + raise ValueError( |
| 170 | + '`impl` {!r} only supports 2D'.format(impl_in) |
| 171 | + ) |
162 | 172 |
|
163 | 173 | # Print a warning if the detector midpoint normal vector at any |
164 | 174 | # angle is perpendicular to the geometry axis in parallel 3d |
|
0 commit comments