def test_sub_operator__simple(self): f1, f2 = Fol.rand(), Fol.rand() assert f1 - f2 == f1 - (-f2) # Anyway, axial sub is commutative. assert f1 - f2 == f2 - f1
def test_add_operator__simple(self): f1, f2 = Fol.rand(), Fol.rand() assert f1 + f2 == f1 + (-f2) # Anyway, axial add is commutative. assert f1 + f2 == f2 + f1
def test_angle_under_rotation(self): f1, f2 = Fol.rand(), Fol.rand() D = DefGrad.from_axis(Lin(45, 45), 60) assert np.allclose(f1.angle(f2), f1.transform(D).angle(f2.transform(D)))
def test_mutual_rotation(self): f1, f2 = Fol.rand(), Fol.rand() assert f1.transform(f1.H(f2)) == f2
def test_foliation_product_operator(self): f1, f2 = Fol.rand(), Fol.rand() assert f1.cross(f2) == f1**f2
def test_foliation_product(self): f1, f2 = Fol.rand(), Fol.rand() p = f1.cross(f2) assert np.allclose([p.angle(f1), p.angle(f2)], [90, 90])
def test_ortensor_uniform(): f = Fol.rand() assert np.allclose(Ortensor.from_group(Group([f.V, f.rake(-45), f.rake(45)]))._evals, np.ones(3) / 3)
def test_fol_vector_dd(self): fol = Fol(120, 30) assert Lin(*fol.V.dd).asfol == fol
def test_that_azimuth_0_is_same_as_360(self): assert Fol(0, 20) == Fol(360, 20)
def test_equality_for_oposite_dir(self): fol = Fol.rand() assert fol == -fol
def x(self): return Fol(0, 0)
def test_asfol_conversion(self): assert str(Vec3([1, 1, 1]).asfol) == str(Fol(225, 55)) # `Vec` to `Fol` assert str(Vec3(Fol(213, 52)).asfol) == str(Fol( 213, 52)) # `Fol` to `Vec` to `Fol`
def test_ortensor_uniform(): f = Fol.rand() assert np.allclose( Ortensor.from_group(Group([f.V, f.rake(-45), f.rake(45)]))._evals, np.ones(3) / 3)
def test_fol2vec2fol(self): self.assertTrue(Vec3(Fol(213, 52)).asfol == Fol(213, 52))
def test_scalar_product(self): fol = Fol.rand() assert np.allclose(fol * fol, 1)
def test_dd_property(self): fol = Fol(120, 30) assert Fol(*fol.dd) == fol
def test_cross_product(self): f1, f2 = Fol.rand(), Fol.rand() p = f1**f2 assert np.allclose([p.angle(f1), p.angle(f2)], [90, 90])
def test_group_heterogenous_error(self): with pytest.raises(Exception) as exc: Group([Fol(10, 10), Lin(20, 20)]) assert "All data in group must be of same type." == str( exc.exception)