Skip to content

Commit

Permalink
Merge pull request #2356 from kif/2355_diffmap
Browse files Browse the repository at this point in the history
Correct missing method: `setup_ai`
  • Loading branch information
kif authored Dec 18, 2024
2 parents 6157547 + c9144e7 commit b1446d5
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/pyFAI/diffmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
__contact__ = "[email protected]"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "09/10/2024"
__date__ = "13/12/2024"
__status__ = "development"
__docformat__ = 'restructuredtext'

Expand All @@ -48,11 +48,10 @@
import json
import __main__ as main
from .opencl import ocl
from . import version as PyFAI_VERSION, date as PyFAI_DATE, load
from . import version as PyFAI_VERSION, date as PyFAI_DATE
from .integrator.load_engines import PREFERED_METHODS_2D, PREFERED_METHODS_1D
from .io import Nexus, get_isotime, h5py
from .worker import Worker, _reduce_images
from .method_registry import Method, IntegrationMethod
from .worker import Worker
from .utils.decorators import deprecated, deprecated_warning

DIGITS = [str(i) for i in range(10)]
Expand Down Expand Up @@ -267,14 +266,14 @@ def parse(self, sysargv=None, with_config=False):
if ocl and options.gpu:
ai["opencl_device"] = ocl.select_device(type="gpu")
ndim = ai.get("do_2D", 1)
if ndim==2:
if ndim == 2:
default = PREFERED_METHODS_2D[0].method[1:-1]
else:
default = PREFERED_METHODS_1D[0].method[1:-1]
method = list(ai.get("method", default))
if len(method) == 3: # (split, algo, impl)
if len(method) == 3: # (split, algo, impl)
method[2] = "opencl"
elif len(method) == 5: # (dim, split, algo, impl, target)
elif len(method) == 5: # (dim, split, algo, impl, target)
method[3] = "opencl"
else:
logger.warning(f"Unexpected method found in configuration file: {method}")
Expand Down Expand Up @@ -313,8 +312,8 @@ def parse(self, sysargv=None, with_config=False):
logger.warning("No such poni file %s", options.poni)

deprecated_keys = {
"fast_motor_points" : "nbpt_fast",
"slow_motor_points" : "nbpt_slow",
"fast_motor_points": "nbpt_fast",
"slow_motor_points": "nbpt_slow",
}
for key in deprecated_keys:
if key in config.keys():
Expand Down Expand Up @@ -353,7 +352,6 @@ def parse(self, sysargv=None, with_config=False):
self.slow_motor_range = config.get("slow_motor_range")
self.fast_motor_range = config.get("fast_motor_range")


self.stats = options.stats

if with_config:
Expand Down Expand Up @@ -394,9 +392,9 @@ def makeHDF5(self, rewrite=False):

# create motor range if not yet existing ...
if self.fast_motor_range is None:
self.fast_motor_range=(0, self.nbpt_fast-1)
self.fast_motor_range=(0, self.nbpt_fast - 1)
if self.slow_motor_range is None:
self.slow_motor_range=(0, self.nbpt_slow-1)
self.slow_motor_range=(0, self.nbpt_slow - 1)

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

else:
Expand Down Expand Up @@ -581,7 +579,7 @@ def process_one_file(self, filename, callback=None):
:return: None
"""
if self.ai is None:
self.setup_ai()
self.configure_worker(self.poni)
if self.dataset is None:
self.makeHDF5()

Expand Down

0 comments on commit b1446d5

Please sign in to comment.