def test_calc_data_point_locations_custom_spacing(self):
        # Scaling down from 3..12 to 1..4.
        locs = _calc_data_point_locations(4, [3, 4, 10, 12])
        np.testing.assert_allclose(locs, np.array([1, 1.33333333, 3.33333333, 4]))

        # Sorted order shouldn't affect scaling.
        locs = _calc_data_point_locations(4, [4, 3, 12, 10])
        np.testing.assert_allclose(locs, np.array([1.33333333, 1, 4, 3.33333333]))

        # Scaling up from 0.001..0.87 to 1..3.
        locs = _calc_data_point_locations(3, [0.001, 0.2543, 0.87])
        np.testing.assert_allclose(locs, np.array([1, 1.58296893, 3]))
Beispiel #2
0
    def test_calc_data_point_locations_custom_spacing(self):
        # Scaling down from 3..12 to 1..4.
        locs = _calc_data_point_locations(4, [3, 4, 10, 12])
        np.testing.assert_allclose(locs,
                                   np.array([1, 1.33333333, 3.33333333, 4]))

        # Sorted order shouldn't affect scaling.
        locs = _calc_data_point_locations(4, [4, 3, 12, 10])
        np.testing.assert_allclose(locs,
                                   np.array([1.33333333, 1, 4, 3.33333333]))

        # Scaling up from 0.001..0.87 to 1..3.
        locs = _calc_data_point_locations(3, [0.001, 0.2543, 0.87])
        np.testing.assert_allclose(locs, np.array([1, 1.58296893, 3]))
Beispiel #3
0
 def test_calc_data_point_locations_default_spacing(self):
     locs = _calc_data_point_locations(4)
     np.testing.assert_allclose(locs, [1, 2, 3, 4])
Beispiel #4
0
 def test_calc_data_point_locations_invalid_x_values(self):
     with npt.assert_raises(ValueError):
         _calc_data_point_locations(3, [1, 10.5])
 def test_calc_data_point_locations_default_spacing(self):
     locs = _calc_data_point_locations(4)
     np.testing.assert_allclose(locs, [1, 2, 3, 4])
 def test_calc_data_point_locations_invalid_x_values(self):
     with npt.assert_raises(ValueError):
         _calc_data_point_locations(3, [1, 10.5])
 def test_calc_data_point_locations_default_spacing(self):
     """Should return evenly-spaced x-axis locations."""
     locs = _calc_data_point_locations(4)
     np.testing.assert_allclose(locs, [1, 2, 3, 4])
 def test_calc_data_point_locations_invalid_x_values(self):
     """Should raise error when invalid x_values are encountered."""
     with npt.assert_raises(ValueError):
         _calc_data_point_locations(3, [1, 10.5])
 def test_calc_data_point_locations_default_spacing(self):
     """Should return evenly-spaced x-axis locations."""
     locs = _calc_data_point_locations(4)
     np.testing.assert_allclose(locs, [1, 2, 3, 4])
 def test_calc_data_point_locations_invalid_x_values(self):
     """Should raise error when invalid x_values are encountered."""
     with npt.assert_raises(ValueError):
         _calc_data_point_locations(3, [1, 10.5])