-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2356 from kif/2355_diffmap
Correct missing method: `setup_ai`
- Loading branch information
Showing
1 changed file
with
12 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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' | ||
|
||
|
@@ -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)] | ||
|
@@ -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}") | ||
|
@@ -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(): | ||
|
@@ -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: | ||
|
@@ -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", | ||
|
@@ -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: | ||
|
@@ -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() | ||
|
||
|