Skip to content

Commit

Permalink
Added autolim and magnitude_limits checks
Browse files Browse the repository at this point in the history
  • Loading branch information
sivborg committed Sep 27, 2023
1 parent c16ca77 commit 3f0834b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pyxem/signals/differential_phase_contrast.py
Original file line number Diff line number Diff line change
@@ -299,10 +299,15 @@ def get_magnitude_signal(
magnitude = np.sqrt(inav02 + inav12)

if autolim:
if magnitude_limits is not None:
raise ValueError(
"If autolim==True then `magnitude_limits` must be set to None"
)

magnitude_limits = pst._get_limits_from_array(
magnitude, sigma=autolim_sigma
)
if magnitude_limits:
if magnitude_limits is not None:
np.clip(magnitude, magnitude_limits[0], magnitude_limits[1], out=magnitude)

signal = Signal2D(magnitude)
@@ -540,6 +545,11 @@ def get_color_signal(
magnitude = np.sqrt(np.abs(inav0) ** 2 + np.abs(inav1) ** 2)

if autolim:
if magnitude_limits is not None:
raise ValueError(
"If autolim==True then `magnitude_limits` must be set to None"
)

magnitude_limits = pst._get_limits_from_array(
magnitude, sigma=autolim_sigma
)

0 comments on commit 3f0834b

Please sign in to comment.