Skip to content

Commit

Permalink
Merge pull request #331 from hakonanes/fix-330
Browse files Browse the repository at this point in the history
Use correct signal shape in shape comparison in EBSD.remove_static_background
  • Loading branch information
hakonanes committed Apr 14, 2021
2 parents c448bb0 + e648e72 commit 705d12e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ Added
- Reading of NORDIF calibration patterns specified in a setting file into an
EBSD signal. (`#317 <https://github.com/pyxem/kikuchipy/pull/317>`_)

Fixed
-----
- Passing a static background pattern to EBSD.remove_static_background() for a
non-square detector dataset works.
(`#? <https://github.com/pyxem/kikuchipy/pull/?>`_)

0.3.2 (2021-02-01)
==================

Expand Down
2 changes: 1 addition & 1 deletion kikuchipy/signals/ebsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ def remove_static_background(
f"The static background dtype_out {static_bg.dtype} is not the "
f"same as pattern dtype_out {dtype_out}."
)
pat_shape = self.axes_manager.signal_shape
pat_shape = self.axes_manager.signal_shape[::-1]
bg_shape = static_bg.shape
if bg_shape != pat_shape:
raise OSError(
Expand Down
7 changes: 7 additions & 0 deletions kikuchipy/signals/tests/test_ebsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,13 @@ def test_remove_static_background_relative_and_scalebg_raises(
relative=True, scale_bg=True, static_bg=dummy_background,
)

def test_non_square_patterns(self):
s = nickel_ebsd_small()
s = s.isig[:, :-5] # Remove bottom five rows
static_bg = s.mean(axis=(0, 1))
static_bg.change_dtype(np.uint8)
s.remove_static_background(static_bg=static_bg.data)


class TestRemoveDynamicBackgroundEBSD:
@pytest.mark.parametrize(
Expand Down

0 comments on commit 705d12e

Please sign in to comment.