Ejemplo n.º 1
0
 def test_locate_position(self):
     pos = np.array([3, 6, 11])
     self.assertEqual(0, locate_position(pos, 3))
     self.assertEqual(1, locate_position(pos, 6))
     self.assertEqual(2, locate_position(pos, 11))
     self.assertIsNone(locate_position(pos, 1))
     self.assertIsNone(locate_position(pos, 12))
Ejemplo n.º 2
0
def determine_err_locs(positions, evaluated_positions, switches_indexes ):

    position_switches = np.take(evaluated_positions, switches_indexes)
    result = np.zeros(positions.shape)

    for pos in evaluated_positions:
        r = 1
        if pos in position_switches:
            r = 2
        result[loc.locate_position(positions, pos)] = r
    return result