def _phampcheck(self, pha, amp, axis):
"""Check phase and amplitude values."""
# Shape checking :
if pha.ndim != amp.ndim:
raise ValueError("pha and amp must have the same number of "
"dimensions.")
# Force phase / amplitude to be at least (1, N) :
if (pha.ndim == 1) and (amp.ndim == 1):
pha = pha.reshape(1, -1)
amp = amp.reshape(1, -1)
axis = 1
# Check if the phase is in radians :
if np.ptp(pha) > 2 * np.pi:
raise ValueError("Your phase is probably in degrees and should be"
" converted in radians using either np.degrees or"
" np.deg2rad.")
# Check if the phase/amplitude have the same number of points on axis:
if pha.shape[axis] != amp.shape[axis]:
phan, ampn = pha.shape[axis], amp.shape[axis]
raise ValueError("The phase (" + str(phan) + ") and the amplitude "
"(" + str(ampn) + ") do not have the same number"
" of points on the specified axis (" +
str(axis) + ").")
# Force the phase to be in [-pi, pi] :
pha = (pha + np.pi) % (2 * np.pi) - np.pi
return pha, amp, axis
###########################################################################
# PROPERTIES
###########################################################################
# ----------- IDPAC -----------
评论列表
文章目录