Python matplotlib.mlab.stride_repeat() Examples
The following are 30
code examples of matplotlib.mlab.stride_repeat().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
matplotlib.mlab
, or try the search function
.
Example #1
Source File: test_mlab.py From twitter-stock-recommendation with MIT License | 6 votes |
def test_stride_ensure_integer_type(self): N = 100 x = np.empty(N + 20, dtype='>f4') x.fill(np.NaN) y = x[10:-10] y.fill(0.3) # previous to #3845 lead to corrupt access y_strided = mlab.stride_windows(y, n=33, noverlap=0.6) assert_array_equal(y_strided, 0.3) # previous to #3845 lead to corrupt access y_strided = mlab.stride_windows(y, n=33.3, noverlap=0) assert_array_equal(y_strided, 0.3) # even previous to #3845 could not find any problematic # configuration however, let's be sure it's not accidentally # introduced y_strided = mlab.stride_repeat(y, n=33.815) assert_array_equal(y_strided, 0.3)
Example #2
Source File: test_mlab.py From ImageFusion with MIT License | 6 votes |
def test_stride_ensure_integer_type(self): N = 100 x = np.empty(N + 20, dtype='>f4') x.fill(np.NaN) y = x[10:-10] y.fill(0.3) # previous to #3845 lead to corrupt access y_strided = mlab.stride_windows(y, n=33, noverlap=0.6) assert_array_equal(y_strided, 0.3) # previous to #3845 lead to corrupt access y_strided = mlab.stride_windows(y, n=33.3, noverlap=0) assert_array_equal(y_strided, 0.3) # even previous to #3845 could not find any problematic # configuration however, let's be sure it's not accidentally # introduced y_strided = mlab.stride_repeat(y, n=33.815) assert_array_equal(y_strided, 0.3)
Example #3
Source File: test_mlab.py From coffeegrindsize with MIT License | 6 votes |
def test_stride_ensure_integer_type(self): N = 100 x = np.empty(N + 20, dtype='>f4') x.fill(np.NaN) y = x[10:-10] y.fill(0.3) # previous to #3845 lead to corrupt access y_strided = mlab.stride_windows(y, n=33, noverlap=0.6) assert_array_equal(y_strided, 0.3) # previous to #3845 lead to corrupt access y_strided = mlab.stride_windows(y, n=33.3, noverlap=0) assert_array_equal(y_strided, 0.3) # even previous to #3845 could not find any problematic # configuration however, let's be sure it's not accidentally # introduced y_strided = mlab.stride_repeat(y, n=33.815) assert_array_equal(y_strided, 0.3)
Example #4
Source File: test_mlab.py From neural-network-animation with MIT License | 6 votes |
def test_stride_ensure_integer_type(self): N = 100 x = np.empty(N + 20, dtype='>f4') x.fill(np.NaN) y = x[10:-10] y.fill(0.3) # previous to #3845 lead to corrupt access y_strided = mlab.stride_windows(y, n=33, noverlap=0.6) assert_array_equal(y_strided, 0.3) # previous to #3845 lead to corrupt access y_strided = mlab.stride_windows(y, n=33.3, noverlap=0) assert_array_equal(y_strided, 0.3) # even previous to #3845 could not find any problematic # configuration however, let's be sure it's not accidentally # introduced y_strided = mlab.stride_repeat(y, n=33.815) assert_array_equal(y_strided, 0.3)
Example #5
Source File: test_mlab.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test_stride_ensure_integer_type(self): N = 100 x = np.empty(N + 20, dtype='>f4') x.fill(np.NaN) y = x[10:-10] y.fill(0.3) # previous to #3845 lead to corrupt access y_strided = mlab.stride_windows(y, n=33, noverlap=0.6) assert_array_equal(y_strided, 0.3) # previous to #3845 lead to corrupt access y_strided = mlab.stride_windows(y, n=33.3, noverlap=0) assert_array_equal(y_strided, 0.3) # even previous to #3845 could not find any problematic # configuration however, let's be sure it's not accidentally # introduced y_strided = mlab.stride_repeat(y, n=33.815) assert_array_equal(y_strided, 0.3)
Example #6
Source File: test_mlab.py From ImageFusion with MIT License | 5 votes |
def test_stride_repeat_n1_axis0(self): x = np.arange(10) y = mlab.stride_repeat(x, 1) assert_equal((1, ) + x.shape, y.shape) assert_array_equal(x, y.flat) assert_true(self.get_base(y) is x)
Example #7
Source File: test_mlab.py From ImageFusion with MIT License | 5 votes |
def test_stride_repeat_axis_gt_1_ValueError(self): x = np.array(0) assert_raises(ValueError, mlab.stride_repeat, x, 5, axis=2)
Example #8
Source File: test_mlab.py From ImageFusion with MIT License | 5 votes |
def test_stride_repeat_n5_axis0(self): x = np.arange(10) y = mlab.stride_repeat(x, 5) yr = np.repeat(x[np.newaxis], 5, axis=0) assert_equal(yr.shape, y.shape) assert_array_equal(yr, y) assert_equal((5, ) + x.shape, y.shape) assert_true(self.get_base(y) is x)
Example #9
Source File: test_mlab.py From ImageFusion with MIT License | 5 votes |
def test_stride_repeat_n5_axis1(self): x = np.arange(10) y = mlab.stride_repeat(x, 5, axis=1) yr = np.repeat(x[np.newaxis], 5, axis=0).T assert_equal(yr.shape, y.shape) assert_array_equal(yr, y) assert_equal(x.shape + (5, ), y.shape) assert_true(self.get_base(y) is x)
Example #10
Source File: test_mlab.py From coffeegrindsize with MIT License | 5 votes |
def test_stride_repeat_invalid_input_shape(self, shape): x = np.arange(np.prod(shape)).reshape(shape) with pytest.raises(ValueError): mlab.stride_repeat(x, 5)
Example #11
Source File: test_mlab.py From coffeegrindsize with MIT License | 5 votes |
def test_stride_repeat_invalid_axis(self, axis): x = np.array(0) with pytest.raises(ValueError): mlab.stride_repeat(x, 5, axis=axis)
Example #12
Source File: test_mlab.py From coffeegrindsize with MIT License | 5 votes |
def test_stride_repeat_n_lt_1_ValueError(self): x = np.arange(10) with pytest.raises(ValueError): mlab.stride_repeat(x, 0)
Example #13
Source File: test_mlab.py From coffeegrindsize with MIT License | 5 votes |
def test_stride_repeat(self, n, axis): x = np.arange(10) y = mlab.stride_repeat(x, n, axis=axis) expected_shape = [10, 10] expected_shape[axis] = n yr = np.repeat(np.expand_dims(x, axis), n, axis=axis) assert yr.shape == y.shape assert_array_equal(yr, y) assert tuple(expected_shape) == y.shape assert self.get_base(y) is x
Example #14
Source File: test_mlab.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_stride_repeat_invalid_input_shape(self, shape): x = np.arange(np.prod(shape)).reshape(shape) with pytest.raises(ValueError): mlab.stride_repeat(x, 5)
Example #15
Source File: test_mlab.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_stride_repeat_invalid_axis(self, axis): x = np.array(0) with pytest.raises(ValueError): mlab.stride_repeat(x, 5, axis=axis)
Example #16
Source File: test_mlab.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_stride_repeat_n_lt_1_ValueError(self): x = np.arange(10) with pytest.raises(ValueError): mlab.stride_repeat(x, 0)
Example #17
Source File: test_mlab.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_stride_repeat(self, n, axis): x = np.arange(10) y = mlab.stride_repeat(x, n, axis=axis) expected_shape = [10, 10] expected_shape[axis] = n yr = np.repeat(np.expand_dims(x, axis), n, axis=axis) assert yr.shape == y.shape assert_array_equal(yr, y) assert tuple(expected_shape) == y.shape assert self.get_base(y) is x
Example #18
Source File: test_mlab.py From ImageFusion with MIT License | 5 votes |
def test_stride_repeat_n_lt_1_ValueError(self): x = np.arange(10) assert_raises(ValueError, mlab.stride_repeat, x, 0)
Example #19
Source File: test_mlab.py From neural-network-animation with MIT License | 5 votes |
def test_stride_repeat_2D_ValueError(self): x = np.arange(10)[np.newaxis] assert_raises(ValueError, mlab.stride_repeat, x, 5)
Example #20
Source File: test_mlab.py From ImageFusion with MIT License | 5 votes |
def test_stride_repeat_axis_lt_0_ValueError(self): x = np.array(0) assert_raises(ValueError, mlab.stride_repeat, x, 5, axis=-1)
Example #21
Source File: test_mlab.py From ImageFusion with MIT License | 5 votes |
def test_stride_repeat_2D_ValueError(self): x = np.arange(10)[np.newaxis] assert_raises(ValueError, mlab.stride_repeat, x, 5)
Example #22
Source File: test_mlab.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_stride_repeat(self, n, axis): x = np.arange(10) y = mlab.stride_repeat(x, n, axis=axis) expected_shape = [10, 10] expected_shape[axis] = n yr = np.repeat(np.expand_dims(x, axis), n, axis=axis) assert yr.shape == y.shape assert_array_equal(yr, y) assert tuple(expected_shape) == y.shape assert self.get_base(y) is x
Example #23
Source File: test_mlab.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_stride_repeat_n_lt_1_ValueError(self): x = np.arange(10) with pytest.raises(ValueError): mlab.stride_repeat(x, 0)
Example #24
Source File: test_mlab.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_stride_repeat_invalid_axis(self, axis): x = np.array(0) with pytest.raises(ValueError): mlab.stride_repeat(x, 5, axis=axis)
Example #25
Source File: test_mlab.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_stride_repeat_invalid_input_shape(self, shape): x = np.arange(np.prod(shape)).reshape(shape) with pytest.raises(ValueError): mlab.stride_repeat(x, 5)
Example #26
Source File: test_mlab.py From neural-network-animation with MIT License | 5 votes |
def test_stride_repeat_n5_axis1(self): x = np.arange(10) y = mlab.stride_repeat(x, 5, axis=1) yr = np.repeat(x[np.newaxis], 5, axis=0).T assert_equal(yr.shape, y.shape) assert_array_equal(yr, y) assert_equal(x.shape + (5, ), y.shape) assert_true(self.get_base(y) is x)
Example #27
Source File: test_mlab.py From neural-network-animation with MIT License | 5 votes |
def test_stride_repeat_n5_axis0(self): x = np.arange(10) y = mlab.stride_repeat(x, 5) yr = np.repeat(x[np.newaxis], 5, axis=0) assert_equal(yr.shape, y.shape) assert_array_equal(yr, y) assert_equal((5, ) + x.shape, y.shape) assert_true(self.get_base(y) is x)
Example #28
Source File: test_mlab.py From neural-network-animation with MIT License | 5 votes |
def test_stride_repeat_n1_axis0(self): x = np.arange(10) y = mlab.stride_repeat(x, 1) assert_equal((1, ) + x.shape, y.shape) assert_array_equal(x, y.flat) assert_true(self.get_base(y) is x)
Example #29
Source File: test_mlab.py From neural-network-animation with MIT License | 5 votes |
def test_stride_repeat_n_lt_1_ValueError(self): x = np.arange(10) assert_raises(ValueError, mlab.stride_repeat, x, 0)
Example #30
Source File: test_mlab.py From neural-network-animation with MIT License | 5 votes |
def test_stride_repeat_axis_gt_1_ValueError(self): x = np.array(0) assert_raises(ValueError, mlab.stride_repeat, x, 5, axis=2)