Skip to content

Commit

Permalink
Refactor: Applied changes from @pc494
Browse files Browse the repository at this point in the history
  • Loading branch information
CSSFrancis committed Jan 29, 2024
1 parent 73c295f commit d24b96b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions pyxem/signals/diffraction2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
medfilt_1d,
sigma_clip,
)
from pyxem.utils.azimuthal_utils import slice_radial_integrate
from pyxem.utils._azimuthal_utils import _slice_radial_integrate
from pyxem.utils.dask_tools import (
_get_dask_array,
get_signal_dimension_host_chunk_slice,
Expand Down Expand Up @@ -2145,7 +2145,8 @@ def get_azimuthal_integral2d(
method: str
Can be “numpy”, “cython”, “BBox” or “splitpixel”, “lut”, “csr”,
“nosplit_csr”, “full_csr”, “lut_ocl” and “csr_ocl” if you want
to go on GPU. To Specify the device: “csr_ocl_1,2”
to go on GPU. To Specify the device: “csr_ocl_1,2”. For pure
pyxem based methods use "splitpixel_pyxem".
sum: bool
If true the radial integration is returned rather then the Azimuthal Integration.
correctSolidAngle: bool
Expand Down Expand Up @@ -2190,14 +2191,15 @@ def get_azimuthal_integral2d(
>>> ds.get_azimuthal_integral2d(npt_rad=100)
"""
if method == "splitpixel_pyxem":
usepyfai = method not in ["splitpixel_pyxem"]
if not usepyfai:
# get_slices2d should be sped up in the future by
# getting rid of shapely and using numba on the for loop
slices, factors, factors_slice, radial_range = self.calibrate.get_slices2d(
npt, npt_azim, radial_range=radial_range
)
integration = self.map(
slice_radial_integrate,
_slice_radial_integrate,
slices=slices,
factors=factors,
factors_slice=factors_slice,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


@numba.njit
def slice_radial_integrate(img, factors, factors_slice, slices, npt_rad, npt_azim):
def _slice_radial_integrate(img, factors, factors_slice, slices, npt_rad, npt_azim):
"""Slice the image into small chunks and multiply by the factors.
Parameters
Expand Down
2 changes: 1 addition & 1 deletion pyxem/utils/calibration_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from hyperspy.axes import UniformDataAxis

from pyxem.utils.indexation_utils import index_dataset_with_template_rotation
from pyxem.utils.azimuthal_utils import _get_control_points, _get_factors
from pyxem.utils._azimuthal_utils import _get_control_points, _get_factors


class Calibration:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"pyfai <= 2023.9.0", # breaking changes
"scikit-image >= 0.19.0, !=0.21.0", # regression in ellipse fitting"
"scikit-learn >= 1.0",
"shapely",
"shapely > 2.0.0", # major changes
"scipy",
"tqdm",
"traits",
Expand Down

0 comments on commit d24b96b

Please sign in to comment.