Skip to content

Commit b1446d5

Browse files
authored
Merge pull request #2356 from kif/2355_diffmap
Correct missing method: `setup_ai`
2 parents 6157547 + c9144e7 commit b1446d5

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

src/pyFAI/diffmap.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
__contact__ = "Jerome.Kieffer@ESRF.eu"
3232
__license__ = "MIT"
3333
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
34-
__date__ = "09/10/2024"
34+
__date__ = "13/12/2024"
3535
__status__ = "development"
3636
__docformat__ = 'restructuredtext'
3737

@@ -48,11 +48,10 @@
4848
import json
4949
import __main__ as main
5050
from .opencl import ocl
51-
from . import version as PyFAI_VERSION, date as PyFAI_DATE, load
51+
from . import version as PyFAI_VERSION, date as PyFAI_DATE
5252
from .integrator.load_engines import PREFERED_METHODS_2D, PREFERED_METHODS_1D
5353
from .io import Nexus, get_isotime, h5py
54-
from .worker import Worker, _reduce_images
55-
from .method_registry import Method, IntegrationMethod
54+
from .worker import Worker
5655
from .utils.decorators import deprecated, deprecated_warning
5756

5857
DIGITS = [str(i) for i in range(10)]
@@ -267,14 +266,14 @@ def parse(self, sysargv=None, with_config=False):
267266
if ocl and options.gpu:
268267
ai["opencl_device"] = ocl.select_device(type="gpu")
269268
ndim = ai.get("do_2D", 1)
270-
if ndim==2:
269+
if ndim == 2:
271270
default = PREFERED_METHODS_2D[0].method[1:-1]
272271
else:
273272
default = PREFERED_METHODS_1D[0].method[1:-1]
274273
method = list(ai.get("method", default))
275-
if len(method) == 3: # (split, algo, impl)
274+
if len(method) == 3: # (split, algo, impl)
276275
method[2] = "opencl"
277-
elif len(method) == 5: # (dim, split, algo, impl, target)
276+
elif len(method) == 5: # (dim, split, algo, impl, target)
278277
method[3] = "opencl"
279278
else:
280279
logger.warning(f"Unexpected method found in configuration file: {method}")
@@ -313,8 +312,8 @@ def parse(self, sysargv=None, with_config=False):
313312
logger.warning("No such poni file %s", options.poni)
314313

315314
deprecated_keys = {
316-
"fast_motor_points" : "nbpt_fast",
317-
"slow_motor_points" : "nbpt_slow",
315+
"fast_motor_points": "nbpt_fast",
316+
"slow_motor_points": "nbpt_slow",
318317
}
319318
for key in deprecated_keys:
320319
if key in config.keys():
@@ -353,7 +352,6 @@ def parse(self, sysargv=None, with_config=False):
353352
self.slow_motor_range = config.get("slow_motor_range")
354353
self.fast_motor_range = config.get("fast_motor_range")
355354

356-
357355
self.stats = options.stats
358356

359357
if with_config:
@@ -394,9 +392,9 @@ def makeHDF5(self, rewrite=False):
394392

395393
# create motor range if not yet existing ...
396394
if self.fast_motor_range is None:
397-
self.fast_motor_range=(0, self.nbpt_fast-1)
395+
self.fast_motor_range=(0, self.nbpt_fast - 1)
398396
if self.slow_motor_range is None:
399-
self.slow_motor_range=(0, self.nbpt_slow-1)
397+
self.slow_motor_range=(0, self.nbpt_slow - 1)
400398

401399
nxs = Nexus(self.hdf5, mode="w", creator="pyFAI")
402400
self.entry_grp = entry_grp = nxs.new_entry(entry="entry",
@@ -455,7 +453,7 @@ def makeHDF5(self, rewrite=False):
455453
source = h5py.VirtualSource(self.dataset)
456454
for i in range(self.nbpt_slow):
457455
for j in range(self.nbpt_fast):
458-
layout[:,:, i, j] = source[i, j]
456+
layout[:, :, i, j] = source[i, j]
459457
self.nxdata_grp.create_virtual_dataset('map', layout, fillvalue=numpy.nan).attrs["interpretation"] = "image"
460458

461459
else:
@@ -581,7 +579,7 @@ def process_one_file(self, filename, callback=None):
581579
:return: None
582580
"""
583581
if self.ai is None:
584-
self.setup_ai()
582+
self.configure_worker(self.poni)
585583
if self.dataset is None:
586584
self.makeHDF5()
587585

0 commit comments

Comments
 (0)