Created by Mauro Alberti
Last run: 2019-06-16
In [1]:
import numpy as np
import sys
sys.path.append(r"C:\Users\mauro\Documents\projects\gsf")
from pygsf.orientations.orientations import Plane, Axis, Direct
from pygsf.mathematics.arrays import svd
In [2]:
plane1 = Plane(90, 0)
plane2 = Plane(90, 5)
# plane to xyz
n_axis_1 = plane1.normAxis()
n_axis_2 = plane2.normAxis()
normal_1 = n_axis_1.toXYZ()
normal_2 = n_axis_2.toXYZ()
print(normal_1)
print(normal_2)
xyzes = (normal_1, normal_2)
# pack tuples into array
a = np.stack(xyzes)
print(type(a))
print(a.shape)
# svd
res = svd(a)
"""
print(type(res))
for res_el in res:
print(res_el)
"""
u = res[0]
s = res[1]
vh = res[2]
#print(vh)
print("mean", vh[0,:]) # mean value
print("girdle normal", vh[2, :]) # normal to girdle
In [3]:
# axes to xyz
axis_1 = Axis.fromAzPl(270, 80)
axis_2 = Axis.fromAzPl(270, 90)
axis_3 = Axis.fromAzPl(90, 80)
print(axis_1)
print(axis_2)
print(axis_3)
xyz_1 = axis_1.toXYZ()
xyz_2 = axis_2.toXYZ()
xyz_3 = axis_3.toXYZ()
print(xyz_1)
print(xyz_2)
print(xyz_3)
xyzes = (xyz_1, xyz_2, xyz_3)
# pack tuples into array
a = np.stack(xyzes)
print(type(a))
print(a.shape)
# svd
res = svd(a)
u = res[0]
s = res[1]
vh = res[2]
print("\nu")
print(u)
print("\ns")
print(s)
print("\nvh")
print(vh)
print("\nmean", vh[0,:]) # mean value
print("\ngirdle normal", vh[2, :]) # normal to girdle
In [4]:
# axes to xyz
axis_1 = Axis.fromAzPl(270, 10)
axis_2 = Axis.fromAzPl(270, 0)
axis_3 = Axis.fromAzPl(90, 5)
axis_4 = Axis.fromAzPl(270, 3)
print(axis_1)
print(axis_2)
print(axis_3)
print(axis_4)
xyz_1 = axis_1.toXYZ()
xyz_2 = axis_2.toXYZ()
xyz_3 = axis_3.toXYZ()
xyz_4 = axis_4.toXYZ()
print(xyz_1)
print(xyz_2)
print(xyz_3)
print(xyz_4)
xyzes = (xyz_1, xyz_2, xyz_3, xyz_4)
# pack tuples into array
a = np.stack(xyzes)
print(type(a))
print(a.shape)
# svd
res = svd(a)
u = res[0]
s = res[1]
vh = res[2]
print("\nu")
print(u)
print("\ns")
print(s)
print("\nvh")
print(vh)
print("\nmean", vh[0,:]) # mean value
print("\ngirdle normal", vh[2, :]) # normal to girdle
In [5]:
# directions to xyz
d_1 = Direct.fromAzPl(270, 10)
d_2 = Direct.fromAzPl(270, 5)
d_3 = Direct.fromAzPl(270, -5)
d_4 = Direct.fromAzPl(270, -10)
print(d_1)
print(d_2)
print(d_3)
print(d_4)
xyz_1 = d_1.toXYZ()
xyz_2 = d_2.toXYZ()
xyz_3 = d_3.toXYZ()
xyz_4 = d_4.toXYZ()
print(xyz_1)
print(xyz_2)
print(xyz_3)
print(xyz_4)
xyzes = (xyz_1, xyz_2, xyz_3, xyz_4)
# pack tuples into array
a = np.stack(xyzes)
print(type(a))
print(a.shape)
# svd
res = svd(a)
u = res[0]
s = res[1]
vh = res[2]
print("\nu")
print(u)
print("\ns")
print(s)
print("\nvh")
print(vh)
print("\nmean", vh[0,:]) # mean value
print("\ngirdle normal", vh[2, :]) # normal to girdle
In [6]:
# directions to xyz
d_1 = Direct.fromAzPl(90, 10)
d_2 = Direct.fromAzPl(90, 5)
d_3 = Direct.fromAzPl(90, -5)
d_4 = Direct.fromAzPl(90, -10)
print(d_1)
print(d_2)
print(d_3)
print(d_4)
xyz_1 = d_1.toXYZ()
xyz_2 = d_2.toXYZ()
xyz_3 = d_3.toXYZ()
xyz_4 = d_4.toXYZ()
print(xyz_1)
print(xyz_2)
print(xyz_3)
print(xyz_4)
xyzes = (xyz_1, xyz_2, xyz_3, xyz_4)
# pack tuples into array
a = np.stack(xyzes)
print(type(a))
print(a.shape)
# svd
res = svd(a)
u = res[0]
s = res[1]
vh = res[2]
print("\nu")
print(u)
print("\ns")
print(s)
print("\nvh")
print(vh)
print("\nmean", vh[0,:]) # mean value
print("\ngirdle normal", vh[2, :]) # normal to girdle
In [7]:
## directions to xyz
d_1 = Direct.fromAzPl(90, 85)
d_2 = Direct.fromAzPl(90, 88)
d_3 = Direct.fromAzPl(270, 88)
d_4 = Direct.fromAzPl(270, 85)
print(d_1)
print(d_2)
print(d_3)
print(d_4)
xyz_1 = d_1.toXYZ()
xyz_2 = d_2.toXYZ()
xyz_3 = d_3.toXYZ()
xyz_4 = d_4.toXYZ()
print(xyz_1)
print(xyz_2)
print(xyz_3)
print(xyz_4)
xyzes = (xyz_1, xyz_2, xyz_3, xyz_4)
# pack tuples into array
a = np.stack(xyzes)
print(type(a))
print(a.shape)
# svd
res = svd(a)
u = res[0]
s = res[1]
vh = res[2]
print("\nu")
print(u)
print("\ns")
print(s)
print("\nvh")
print(vh)
print("\nmean", vh[0,:]) # mean value
print("\ngirdle normal", vh[2, :]) # normal to girdle
In [8]:
# directions to xyz
d_1 = Direct.fromAzPl(90, -85)
d_2 = Direct.fromAzPl(90, -88)
d_3 = Direct.fromAzPl(270, -88)
d_4 = Direct.fromAzPl(270, -85)
print(d_1)
print(d_2)
print(d_3)
print(d_4)
xyz_1 = d_1.toXYZ()
xyz_2 = d_2.toXYZ()
xyz_3 = d_3.toXYZ()
xyz_4 = d_4.toXYZ()
print(xyz_1)
print(xyz_2)
print(xyz_3)
print(xyz_4)
xyzes = (xyz_1, xyz_2, xyz_3, xyz_4)
# pack tuples into array
a = np.stack(xyzes)
print(type(a))
print(a.shape)
# svd
res = svd(a)
u = res[0]
s = res[1]
vh = res[2]
print("\nu")
print(u)
print("\ns")
print(s)
print("\nvh")
print(vh)
print("\nmean", vh[0,:]) # mean value
print("\ngirdle normal", vh[2, :]) # normal to girdle
In [9]:
# directions to xyz
d_1 = Direct.fromAzPl(88, 0)
d_2 = Direct.fromAzPl(89, 0)
d_3 = Direct.fromAzPl(91, 0)
d_4 = Direct.fromAzPl(92, 0)
print(d_1)
print(d_2)
print(d_3)
print(d_4)
xyz_1 = d_1.toXYZ()
xyz_2 = d_2.toXYZ()
xyz_3 = d_3.toXYZ()
xyz_4 = d_4.toXYZ()
print(xyz_1)
print(xyz_2)
print(xyz_3)
print(xyz_4)
xyzes = (xyz_1, xyz_2, xyz_3, xyz_4)
# pack tuples into array
a = np.stack(xyzes)
print(type(a))
print(a.shape)
# svd
res = svd(a)
u = res[0]
s = res[1]
vh = res[2]
print("\nu")
print(u)
print("\ns")
print(s)
print("\nvh")
print(vh)
print("\nmean", vh[0,:]) # mean value
print("\ngirdle normal", vh[2, :]) # normal to girdle