-
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 #2076 from kif/2072_diffmap
Fix diff_tomo tool
- Loading branch information
Showing
2 changed files
with
18 additions
and
10 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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
# Project: Azimuthal integration | ||
# https://github.com/silx-kit/pyFAI | ||
# | ||
# Copyright (C) 2015-2023 European Synchrotron Radiation Facility, Grenoble, France | ||
# Copyright (C) 2015-2024 European Synchrotron Radiation Facility, Grenoble, France | ||
# | ||
# Principal author: Jérôme Kieffer ([email protected]) | ||
# | ||
|
@@ -31,7 +31,7 @@ | |
__contact__ = "[email protected]" | ||
__license__ = "MIT" | ||
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" | ||
__date__ = "28/08/2023" | ||
__date__ = "02/02/2024" | ||
__status__ = "development" | ||
__docformat__ = 'restructuredtext' | ||
|
||
|
@@ -48,9 +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, load, load_integrators | ||
from .io import Nexus, get_isotime, h5py | ||
from .worker import Worker, _reduce_images | ||
from .method_registry import Method, IntegrationMethod | ||
|
||
DIGITS = [str(i) for i in range(10)] | ||
Position = collections.namedtuple('Position', 'index, rot, trans') | ||
|
@@ -96,6 +97,7 @@ def __init__(self, npt_fast=0, npt_slow=1, npt_rad=1000, npt_azim=None): | |
self.nxs = None | ||
self.entry_grp = None | ||
self.experiment_title = "Diffraction Mapping" | ||
# method is a property from worker | ||
|
||
def __repr__(self): | ||
return "%s experiment with ntp_slow: %s ntp_fast: %s, npt_diff: %s" % \ | ||
|
@@ -604,14 +606,15 @@ def process(self): | |
self.nxs.close() | ||
|
||
def get_use_gpu(self): | ||
return self.method.impl_lower == "opencl" | ||
return self.worker._method.impl_lower == "opencl" | ||
|
||
def set_use_gpu(self, value): | ||
if value: | ||
method = self.method.method.fixed("opencl") | ||
else: | ||
method = self.method.method.fixed("cython") | ||
self.method = method | ||
if self.worker: | ||
if value: | ||
method = self.worker._method.method.fixed("opencl") | ||
else: | ||
method = self.worker._method.method.fixed("cython") | ||
self.worker.set_method(method) | ||
|
||
use_gpu = property(get_use_gpu, set_use_gpu) | ||
|
||
|
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 |
---|---|---|
|
@@ -36,7 +36,7 @@ | |
__contact__ = "[email protected]" | ||
__license__ = "MIT" | ||
__copyright__ = "2015-2024 European Synchrotron Radiation Facility, Grenoble, France" | ||
__date__ = "30/01/2024" | ||
__date__ = "02/02/2024" | ||
|
||
import sys | ||
import os | ||
|
@@ -585,6 +585,11 @@ def test_bug_1946(self): | |
res = IntegrationMethod.select_method(dim=1, split="full", algo="csc", impl="python", degradable=False) | ||
self.assertGreater(len(res), 0, "method actually exists") | ||
|
||
def test_bug_2072(self): | ||
from ..diffmap import DiffMap | ||
d = DiffMap() | ||
d.use_gpu # used to raise AttributeError | ||
d.use_gpu = True # used to raise AttributeError | ||
|
||
class TestBug1703(unittest.TestCase): | ||
""" | ||
|