示例#1
0
def test_padded_stack_errors(stackgrids, how, where):
    with utils.raises(ValueError):
        misc.padded_stack(stackgrids['input']['g1'],
                          stackgrids['input']['g3'],
                          how=how,
                          where=where,
                          shift=2)
示例#2
0
def test_padded_stack_a_bunch(stackgrids):
    step1 = misc.padded_stack(stackgrids['input']['g0'],
                              stackgrids['input']['g1'],
                              how='v',
                              where='-',
                              shift=-1)
    step2 = misc.padded_stack(step1,
                              stackgrids['input']['g2'],
                              how='h',
                              where='+',
                              shift=1)
    step3 = misc.padded_stack(step2,
                              stackgrids['input']['g3'],
                              how='v',
                              where='-',
                              shift=-2)
    step4 = misc.padded_stack(step3,
                              stackgrids['input']['g4'],
                              how='h',
                              where='-',
                              shift=-1)
    step5 = misc.padded_stack(step4,
                              stackgrids['input']['g5'],
                              how='h',
                              where='+',
                              shift=7)
    nptest.assert_array_equal(step5, stackgrids['output']['g-all'])
示例#3
0
    def test_big_grid_upperright_to_lowerleft(self):
        step1 = misc.padded_stack(self.g0, self.g1, how='v', where='-', shift=-1)
        step2 = misc.padded_stack(step1, self.g2, how='h', where='+', shift=1)
        step3 = misc.padded_stack(step2, self.g3, how='v', where='-', shift=-2)
        step4 = misc.padded_stack(step3, self.g4, how='h', where='-', shift=-1)
        step5 = misc.padded_stack(step4, self.g5, how='h', where='+', shift=7)

        nptest.assert_array_equal(step5, self.expected_all_gs)
示例#4
0
def test_padded_stack_three(stackgrids):
    step1 = misc.padded_stack(stackgrids['input']['g0'],
                              stackgrids['input']['g1'],
                              how='v',
                              where='-',
                              shift=-1)
    step2 = misc.padded_stack(step1,
                              stackgrids['input']['g2'],
                              how='h',
                              where='+',
                              shift=1)
    nptest.assert_array_equal(step2, stackgrids['output']['g0-g1-g2'])
示例#5
0
def test_padded_stack_pairs(stackgrids, idx1, idx2, how, where, shift,
                            expected):
    result = misc.padded_stack(stackgrids['input'][idx1],
                               stackgrids['input'][idx2],
                               how=how,
                               where=where,
                               shift=shift)
    nptest.assert_array_equal(result, stackgrids['output'][expected])
示例#6
0
 def test_bad_where(self):
     misc.padded_stack(self.g1, self.g3, how='v', where='junk', shift=2)
示例#7
0
 def test_vert_merge_0and1and2(self):
     step1 = misc.padded_stack(self.g0, self.g1, how='v', where='-', shift=-1)
     step2 = misc.padded_stack(step1, self.g2, how='h', where='+', shift=1)
     nptest.assert_array_equal(step2, self.expected_g0_1_2)
示例#8
0
 def test_vert_merge_0and1(self):
     merged = misc.padded_stack(self.g0, self.g1, how='v', where='-', shift=1)
     nptest.assert_array_equal(merged, self.expected_g0_1)
示例#9
0
 def test_horizontal_merge_right(self):
     g_merged = misc.padded_stack(self.g1, self.g2, how='h', where='+', shift=1)
     nptest.assert_array_equal(g_merged, self.expected_g1_2_right)
示例#10
0
 def test_vertical_merge_below(self):
     g_merged = misc.padded_stack(self.g3, self.g1, how='v', where='+', shift=-2)
     nptest.assert_array_equal(g_merged, self.expected_g1_3)