|
31 | 31 | __contact__ = "Jerome.Kieffer@ESRF.eu" |
32 | 32 | __license__ = "MIT" |
33 | 33 | __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" |
34 | | -__date__ = "09/10/2024" |
| 34 | +__date__ = "13/12/2024" |
35 | 35 | __status__ = "development" |
36 | 36 | __docformat__ = 'restructuredtext' |
37 | 37 |
|
|
48 | 48 | import json |
49 | 49 | import __main__ as main |
50 | 50 | 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 |
52 | 52 | from .integrator.load_engines import PREFERED_METHODS_2D, PREFERED_METHODS_1D |
53 | 53 | 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 |
56 | 55 | from .utils.decorators import deprecated, deprecated_warning |
57 | 56 |
|
58 | 57 | DIGITS = [str(i) for i in range(10)] |
@@ -267,14 +266,14 @@ def parse(self, sysargv=None, with_config=False): |
267 | 266 | if ocl and options.gpu: |
268 | 267 | ai["opencl_device"] = ocl.select_device(type="gpu") |
269 | 268 | ndim = ai.get("do_2D", 1) |
270 | | - if ndim==2: |
| 269 | + if ndim == 2: |
271 | 270 | default = PREFERED_METHODS_2D[0].method[1:-1] |
272 | 271 | else: |
273 | 272 | default = PREFERED_METHODS_1D[0].method[1:-1] |
274 | 273 | method = list(ai.get("method", default)) |
275 | | - if len(method) == 3: # (split, algo, impl) |
| 274 | + if len(method) == 3: # (split, algo, impl) |
276 | 275 | method[2] = "opencl" |
277 | | - elif len(method) == 5: # (dim, split, algo, impl, target) |
| 276 | + elif len(method) == 5: # (dim, split, algo, impl, target) |
278 | 277 | method[3] = "opencl" |
279 | 278 | else: |
280 | 279 | logger.warning(f"Unexpected method found in configuration file: {method}") |
@@ -313,8 +312,8 @@ def parse(self, sysargv=None, with_config=False): |
313 | 312 | logger.warning("No such poni file %s", options.poni) |
314 | 313 |
|
315 | 314 | 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", |
318 | 317 | } |
319 | 318 | for key in deprecated_keys: |
320 | 319 | if key in config.keys(): |
@@ -353,7 +352,6 @@ def parse(self, sysargv=None, with_config=False): |
353 | 352 | self.slow_motor_range = config.get("slow_motor_range") |
354 | 353 | self.fast_motor_range = config.get("fast_motor_range") |
355 | 354 |
|
356 | | - |
357 | 355 | self.stats = options.stats |
358 | 356 |
|
359 | 357 | if with_config: |
@@ -394,9 +392,9 @@ def makeHDF5(self, rewrite=False): |
394 | 392 |
|
395 | 393 | # create motor range if not yet existing ... |
396 | 394 | 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) |
398 | 396 | 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) |
400 | 398 |
|
401 | 399 | nxs = Nexus(self.hdf5, mode="w", creator="pyFAI") |
402 | 400 | self.entry_grp = entry_grp = nxs.new_entry(entry="entry", |
@@ -455,7 +453,7 @@ def makeHDF5(self, rewrite=False): |
455 | 453 | source = h5py.VirtualSource(self.dataset) |
456 | 454 | for i in range(self.nbpt_slow): |
457 | 455 | for j in range(self.nbpt_fast): |
458 | | - layout[:,:, i, j] = source[i, j] |
| 456 | + layout[:, :, i, j] = source[i, j] |
459 | 457 | self.nxdata_grp.create_virtual_dataset('map', layout, fillvalue=numpy.nan).attrs["interpretation"] = "image" |
460 | 458 |
|
461 | 459 | else: |
@@ -581,7 +579,7 @@ def process_one_file(self, filename, callback=None): |
581 | 579 | :return: None |
582 | 580 | """ |
583 | 581 | if self.ai is None: |
584 | | - self.setup_ai() |
| 582 | + self.configure_worker(self.poni) |
585 | 583 | if self.dataset is None: |
586 | 584 | self.makeHDF5() |
587 | 585 |
|
|
0 commit comments