Exemple #1
0
def test_trim_left_fill_value():
    """ Test that fill_value is indeed introduced """
    array = np.arange(0, 101, dtype=float)  # [0, 1, 2, ..., 100]
    trimmed = triml(array, percentile=20, fill_value=np.nan)
    assert np.any(np.isnan(trimmed))
Exemple #2
0
def test_trim_left_trivial():
    """ Test that nothing is trimmed when percentile is zero """
    array = np.arange(0, 101)
    trimmed = triml(array, percentile=0)
    assert np.allclose(array, trimmed)
Exemple #3
0
def test_trim_left_all_axes():
    """ Test that trimming is working """
    array = np.arange(0, 101)  # [0, 1, 2, ..., 100]
    trimmed = triml(array, percentile=20, fill_value=100)
    assert np.all(trimmed >= 20)
Exemple #4
0
 def test_trivial(self):
     """ Test that nothing is trimmed when percentile is zero """
     array = np.arange(0, 101)
     trimmed = triml(array, percentile=0)
     self.assertTrue(np.allclose(array, trimmed))