class_docstr: Test circular.py.
class_docstr_tok: ["Test","circular.py","."]
docstr: Test helper circular functions.
docstr_tok: ["Test","helper","circular","functions","."]
code: def test_helper_angles(self):
      """Test helper circular functions."""
      # Check angles
      _checkangles(a1)
      _checkangles(a2, axis=None)
      with pytest.raises(ValueError):
          _checkangles(a3)
      with pytest.raises(ValueError):
          _checkangles(a3, axis=None)
      # Convert angles
      np.testing.assert_array_almost_equal(
          a1, convert_angles(a1, low=-np.pi, high=np.pi)
      )
      np.testing.assert_array_almost_equal(
          a2, convert_angles(a2, low=0, high=2 * np.pi, positive=True)
      )
      _checkangles(convert_angles(a2, low=0, high=2 * np.pi))
      _checkangles(convert_angles(a3, low=0, high=360))
      _checkangles(convert_angles(a3_nan, low=0, high=360))
      _checkangles(convert_angles(a4, low=0, high=24))
      _checkangles(convert_angles(a5, low=0, high=1440))
      _checkangles(convert_angles(a5_nan, low=0, high=1440))
      _checkangles(convert_angles(a5, low=0, high=1440, positive=True))
  
      convert_angles(a1, low=-np.pi, high=np.pi)
      convert_angles(a2, low=0, high=2 * np.pi)
      convert_angles(a3)
      convert_angles(a4, low=0, high=24)
      convert_angles(a5, low=0, high=1440)
      assert (
          convert_angles(a5, low=0, high=1440, positive=True).min() >= 0
      )
      assert convert_angles(a5, low=0, high=1440).min() <= 0
  
      # Compare with scipy.stats.circmean
      def assert_circmean(x, low, high, axis=-1):
          m1 = convert_angles(
              circmean(
                  x, low=low, high=high, axis=axis, nan_policy="omit"
              ),
              low,
              high,
          )
          m2 = circ_mean(convert_angles(x, low, high), axis=axis)
          assert (np.round(m1, 4) == np.round(m2, 4)).all()
  
      assert_circmean(a1, low=-np.pi, high=np.pi)
      assert_circmean(a2, low=0, high=2 * np.pi)
      assert_circmean(a3, low=0, high=360)
      assert_circmean(a3_nan, low=0, high=360)
      assert_circmean(a4, low=0, high=24)
      assert_circmean(a5, low=0, high=1440, axis=1)
      assert_circmean(a5, low=0, high=1440, axis=0)
      assert_circmean(a5, low=0, high=1440, axis=None)
      assert_circmean(a5_nan, low=0, high=1440, axis=-1)
      assert_circmean(a5_nan, low=0, high=1440, axis=0)
      assert_circmean(a5_nan, low=0, high=1440, axis=None)
  
file_path: pingouin/pingouin/tests/test_circular.py
imports: import pytest
  import numpy
  from unittest import TestCase
  from scipy.stats import circmean
  from pingouin import read_dataset
  from pingouin.circular import convert_angles, _checkangles
  from pingouin.circular import circ_axial, circ_corrcc, circ_corrcl, circ_mean, circ_r, circ_rayleigh, circ_vtest
label_desc: Use image node_id 1 for calling the TestCircular obj's underlying member method code with example usage: obj.test_helper_angles() without return types