@@ -530,14 +530,15 @@ def wrap_0_pi(theta: ArrayLike) -> Union[float, NDArray]:
530530 :param theta: input angle
531531 :type theta: scalar or ndarray
532532 :return: angle wrapped into range :math:`[0, \pi)`
533+ :rtype: scalar or ndarray
533534
534535 This is used to fold angles of colatitude. If zero is the angle of the
535536 north pole, colatitude increases to :math:`\pi` at the south pole then
536537 decreases to :math:`0` as we head back to the north pole.
537538
538539 :seealso: :func:`wrap_mpi2_pi2` :func:`wrap_0_2pi` :func:`wrap_mpi_pi` :func:`angle_wrap`
539540 """
540- theta = np .abs (theta )
541+ theta = np .abs (getvector ( theta ) )
541542 n = theta / np .pi
542543 if isinstance (n , np .ndarray ):
543544 n = n .astype (int )
@@ -546,7 +547,7 @@ def wrap_0_pi(theta: ArrayLike) -> Union[float, NDArray]:
546547
547548 y = np .where (np .bitwise_and (n , 1 ) == 0 , theta - n * np .pi , (n + 1 ) * np .pi - theta )
548549 if isinstance (y , np .ndarray ) and y .size == 1 :
549- return float (y )
550+ return float (y [ 0 ] )
550551 else :
551552 return y
552553
@@ -558,6 +559,7 @@ def wrap_mpi2_pi2(theta: ArrayLike) -> Union[float, NDArray]:
558559 :param theta: input angle
559560 :type theta: scalar or ndarray
560561 :return: angle wrapped into range :math:`[-\pi/2, \pi/2]`
562+ :rtype: scalar or ndarray
561563
562564 This is used to fold angles of latitude.
563565
@@ -573,7 +575,7 @@ def wrap_mpi2_pi2(theta: ArrayLike) -> Union[float, NDArray]:
573575
574576 y = np .where (np .bitwise_and (n , 1 ) == 0 , theta - n * np .pi , n * np .pi - theta )
575577 if isinstance (y , np .ndarray ) and len (y ) == 1 :
576- return float (y )
578+ return float (y [ 0 ] )
577579 else :
578580 return y
579581
@@ -585,13 +587,14 @@ def wrap_0_2pi(theta: ArrayLike) -> Union[float, NDArray]:
585587 :param theta: input angle
586588 :type theta: scalar or ndarray
587589 :return: angle wrapped into range :math:`[0, 2\pi)`
590+ :rtype: scalar or ndarray
588591
589592 :seealso: :func:`wrap_mpi_pi` :func:`wrap_0_pi` :func:`wrap_mpi2_pi2` :func:`angle_wrap`
590593 """
591594 theta = getvector (theta )
592595 y = theta - 2.0 * math .pi * np .floor (theta / 2.0 / np .pi )
593596 if isinstance (y , np .ndarray ) and len (y ) == 1 :
594- return float (y )
597+ return float (y [ 0 ] )
595598 else :
596599 return y
597600
@@ -603,13 +606,14 @@ def wrap_mpi_pi(theta: ArrayLike) -> Union[float, NDArray]:
603606 :param theta: input angle
604607 :type theta: scalar or ndarray
605608 :return: angle wrapped into range :math:`[-\pi, \pi)`
609+ :rtype: scalar or ndarray
606610
607611 :seealso: :func:`wrap_0_2pi` :func:`wrap_0_pi` :func:`wrap_mpi2_pi2` :func:`angle_wrap`
608612 """
609613 theta = getvector (theta )
610614 y = np .mod (theta + math .pi , 2 * math .pi ) - np .pi
611615 if isinstance (y , np .ndarray ) and len (y ) == 1 :
612- return float (y )
616+ return float (y [ 0 ] )
613617 else :
614618 return y
615619
@@ -643,6 +647,7 @@ def angdiff(a, b=None):
643647 - ``angdiff(a, b)`` is the difference ``a - b`` wrapped to the range
644648 :math:`[-\pi, \pi)`. This is the operator :math:`a \circleddash b` used
645649 in the RVC book
650+
646651 - If ``a`` and ``b`` are both scalars, the result is scalar
647652 - If ``a`` is array_like, the result is a NumPy array ``a[i]-b``
648653 - If ``a`` is array_like, the result is a NumPy array ``a-b[i]``
@@ -651,6 +656,7 @@ def angdiff(a, b=None):
651656
652657 - ``angdiff(a)`` is the angle or vector of angles ``a`` wrapped to the range
653658 :math:`[-\pi, \pi)`.
659+
654660 - If ``a`` is a scalar, the result is scalar
655661 - If ``a`` is array_like, the result is a NumPy array
656662
@@ -671,7 +677,7 @@ def angdiff(a, b=None):
671677
672678 y = np .mod (a + math .pi , 2 * math .pi ) - math .pi
673679 if isinstance (y , np .ndarray ) and len (y ) == 1 :
674- return float (y )
680+ return float (y [ 0 ] )
675681 else :
676682 return y
677683
0 commit comments