Commit 3d656b64 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

Merge branch '149-runtimewarning-in-pyaudio3dtools-audio3dtools' into 'main'

Resolve "RuntimeWarning in pyaudio3dtools.audio3dtools"

See merge request !181
parents 70cf2baf 2e75d328
Loading
Loading
Loading
Loading
Loading
+18 −10
Original line number Diff line number Diff line
@@ -496,8 +496,11 @@ class EFAP:
                )

                if mod:
                    if not np.isnan(A[0]):
                        A[0] %= mod
                    if not np.isnan(B[0]):
                        B[0] %= mod
                    if not np.isnan(C[0]):
                        C[0] %= mod

                if self._in_triangle(P, A, B, C):
@@ -560,14 +563,16 @@ class EFAP:
                return True, None

        # if the azimuth difference is large, perform the 2D check again with azimuths wrapped to (-360, 0] and [0, 360)
        # RuntimeWarning due to NaNs can be safely ignored, _in_triangle() accounts for them
        if np.nanmax(azi) - np.nanmin(azi) > 180:
            for tri in combinations(poly, 3):
                A = np.array(self._get_azi_ele(tri[0]))
                B = np.array(self._get_azi_ele(tri[1]))
                C = np.array(self._get_azi_ele(tri[2]))
                if not np.isnan(A[0]):
                    A[0] %= 360
                if not np.isnan(B[0]):
                    B[0] %= 360
                if not np.isnan(C[0]):
                    C[0] %= 360
                if self._in_triangle(P, A, B, C):
                    return True, 360
@@ -576,8 +581,11 @@ class EFAP:
                A = np.array(self._get_azi_ele(tri[0]))
                B = np.array(self._get_azi_ele(tri[1]))
                C = np.array(self._get_azi_ele(tri[2]))
                if not np.isnan(A[0]):
                    A[0] %= -360
                if not np.isnan(B[0]):
                    B[0] %= -360
                if not np.isnan(C[0]):
                    C[0] %= -360
                if self._in_triangle(P, A, B, C):
                    return True, -360