示例#1
0
    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
示例#2
0
    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
示例#3
0
    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)))
示例#4
0
    def test_mutual_rotation(self):
        f1, f2 = Fol.rand(), Fol.rand()

        assert f1.transform(f1.H(f2)) == f2
示例#5
0
    def test_foliation_product_operator(self):
        f1, f2 = Fol.rand(), Fol.rand()

        assert f1.cross(f2) == f1**f2
示例#6
0
    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])
示例#7
0
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)
示例#8
0
    def test_fol_vector_dd(self):
        fol = Fol(120, 30)

        assert Lin(*fol.V.dd).asfol == fol
示例#9
0
 def test_that_azimuth_0_is_same_as_360(self):
     assert Fol(0, 20) == Fol(360, 20)
示例#10
0
 def test_equality_for_oposite_dir(self):
     fol = Fol.rand()
     assert fol == -fol
示例#11
0
 def x(self):
     return Fol(0, 0)
示例#12
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`
示例#13
0
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)
示例#14
0
 def test_fol2vec2fol(self):
     self.assertTrue(Vec3(Fol(213, 52)).asfol == Fol(213, 52))
示例#15
0
 def test_scalar_product(self):
     fol = Fol.rand()
     assert np.allclose(fol * fol, 1)
示例#16
0
    def test_dd_property(self):
        fol = Fol(120, 30)

        assert Fol(*fol.dd) == fol
示例#17
0
    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])
示例#18
0
 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)
示例#19
0
    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)))