def test_parabola_normals_positions(self, position, expected_normal):
     '''
     check that the parabola normals are calculated correctly given various
     (y,z) positions on the parameterized parabola
     '''
     normal = miop.parabola_normals(position)
     np.testing.assert_allclose(normal, expected_normal, atol=1e-7)
def test_parabola_normals_same_direction(direction):
    '''
    All the normals of the parabola should point towards +x
    '''
    position = miop.parabola_position(direction)
    normals = miop.parabola_normals(position)
    assert normals[:, 0] > 0
 def test_parabola_normals_directions(self, direction, expected_normal):
     '''
     check that the parabola normals are calculated correctly in various
     directions
     '''
     position = miop.parabola_position(direction)
     normal = miop.parabola_normals(position)
     np.testing.assert_allclose(normal, expected_normal, atol=1e-7)
def test_parabola_normals_magnitude(direction):
    '''
    All the normals of the parabola should be unit vectors
    '''
    position = miop.parabola_position(direction)
    normals = miop.parabola_normals(position)
    normal_magnitude = np.sqrt(np.sum(np.square(normals), axis=-1))
    np.testing.assert_almost_equal(normal_magnitude, 1)
 def test_negative_x_axis(self):
     '''
     Check that the parabola normal on the negative x-axis points along the 
     positive x-axis
     '''
     direction = np.array([[-1, 0, 0]])
     parabola_position = miop.parabola_position(direction)
     calculated_normal = miop.parabola_normals(parabola_position)
     expected_normal = np.array([[1, 0, 0]])
     np.testing.assert_allclose(expected_normal,
                                calculated_normal,
                                atol=1e-7)