You are on page 1of 80

APSG Documentation

Release 0.7.0 Beta

Ondrej Lexa

Aug 31, 2022


Contents

1 Package modules 3
1.1 core module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 plotting module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
1.3 tensors module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
1.4 db module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

2 Tutorial 35
2.1 Basic usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.2 Basic operations with vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.3 Classes Lin and Fol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.4 Vec3 methods for Lin and Fol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.5 Classes Pair and Fault . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.6 Group class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
2.7 Ortensor class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.8 StereoNet class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.9 StereoGrid class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
2.10 Fabric plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
2.11 Cluster class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
2.12 Some tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

3 Installation 61
3.1 Using Conda . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
3.2 Using pip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
3.3 Master version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

4 Usage 63

5 Contributing 65
5.1 Types of Contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
5.2 Get Started! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
5.3 Pull Request Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

6 Credits 69
6.1 Development Lead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.2 Contributors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

Python Module Index 71

i
Index 73

ii
APSG Documentation, Release 0.7.0 Beta

APSG defines several new python classes to easily manage, analyze and visualize orientational structural geology data.
It is under active developement, so until documenation will be finished, you can go trough tutorial to see what APSG
can do for you.
Contents:

Contents 1
APSG Documentation, Release 0.7.0 Beta

2 Contents
CHAPTER 1

Package modules

APSG provides following modules:

1.1 core module

A module to manipulate, analyze and visualize structural geology data.


class apsg.core.Vec3
Bases: numpy.ndarray
Vec3 is base class to store 3-dimensional vectors derived from numpy.ndarray on which Lin and Fol
classes are based.
Vec3 support most of common vector algebra using following operators
• + - vector addition
• - - vector subtraction
• * - dot product
• ** - cross product
• abs - magnitude (length) of vector
Check following methods and properties for additional operations.
Parameters
• arr (array_like) – Input data that or can be converted to an array. This includes lists,
tuples, and ndarrays. When more than one argument is passed (i.e. inc is not None) arr is
interpreted as dip direction of the vector in degrees.
• inc (float) – None or dip of the vector in degrees.
• mag (float) – The magnitude of the vector if inc is not None.
Returns Vec3 object

3
APSG Documentation, Release 0.7.0 Beta

Example

>>> v = Vec3([1, -2, 3])


>>> abs(v)
3.7416573867739413

# The dip direction and dip angle of vector with magnitude of 1 and 3. >>> v = Vec3(120, 60) >>> abs(v) 1.0

>>> v = Vec3(120, 60, 3)


>>> abs(v)
3.0

H(other)
Return DefGrad rotational matrix H which rotate vector u to vector v. Axis of rotation is perpendicular
to both vectors u and v.
Parameters other (Vec3) – other vector
Returns Defgrad rotational matrix

Example

>>> u = Vec3(210, 50)


>>> v = Vec3(60, 70)
>>> u.transform(u.H(v)) == v
True

angle(other)
Calculate the angle between two vectors in degrees.
Parameters other – other Vec3 vector
Returns The angle between self and other in degrees.

Example

>>> v = Vec3([1, 0, 0])


>>> u = Vec3([0, 0, 1])
>>> v.angle(u)
90.0

cross(other)
Calculate the cross product of two vectors.
Parameters other – other Vec3 vector
Returns The cross product of self and other.

Example

>>> v = Vec3([1, 0, 0])


>>> u = Vec3([0, 0, 1])
>>> v.cross(u)
V(0.000, -1.000, 0.000)

4 Chapter 1. Package modules


APSG Documentation, Release 0.7.0 Beta

proj(other)
Return projection of vector u onto vector v.
Parameters other (Vec3) – other vector
Returns vector representation of self projected onto ‘other’

Example

>> u.proj(v)

Note: To project on plane use: u - u.proj(v), where v is plane normal.

classmethod rand()
Random unit vector from distribution on sphere
rotate(axis, angle)
Return rotated vector about axis.
Parameters
• axis (Vec3) – axis of rotation
• angle (float) – angle of rotation in degrees
Returns vector represenatation of self rotated angle degrees about vector axis. Rotation is clock-
wise along axis direction.

Example

# Rotate e1 vector around z axis. >>> u = Vec3([1, 0, 0]) >>> z = Vec3([0, 0, 1]) >>> u.rotate(z, 90)
V(0.000, 1.000, 0.000)
transform(F, **kwargs)
Return affine transformation of vector u by matrix F.
Parameters F (DefGrad or numpy.array) – transformation matrix
Keyword Arguments norm – normalize transformed vectors. [True or False] Default False
Returns vector representation of affine transformation (dot product) of self by F

Example

# Reflexion of y axis. >>> F = [[1, 0, 0], [0, -1, 0], [0, 0, 1]] >>> u = Vec3([1, 1, 1]) >>> u.transform(F)
V(1.000, -1.000, 1.000)
V
Convert self to Vec3 object.

Note: This is an alias of asvec3 property.

asfol
Convert self to Fol object.

1.1. core module 5


APSG Documentation, Release 0.7.0 Beta

Example

>>> u = Vec3([1,1,1])
>>> u.asfol
S:225/55

aslin
Convert self to Lin object.

Example

>>> u = Vec3([1,1,1])
>>> u.aslin
L:45/35

asvec3
Convert self to Vec3 object.

Example

>>> l = Lin(120,50)
>>> l.asvec3
V(-0.321, 0.557, 0.766)

dd
Return azimuth, inclination tuple.

Example

>>> v = Vec3([1, 0, -1])


>>> azi, inc = v.dd
>>> azi
0.0
>>> inc
-44.99999999999999

flip
Return a new vector with inverted z coordinate.
type
Return the type of self.
upper
Return True if z-coordinate is negative, otherwise False.
uv
Normalize the vector to unit length.
Returns unit vector of self

6 Chapter 1. Package modules


APSG Documentation, Release 0.7.0 Beta

Example

>>> u = Vec3([1,1,1])
>>> u.uv
V(0.577, 0.577, 0.577)

class apsg.core.Lin
Bases: apsg.core.Vec3
Represents a linear feature.
It provides all Vec3 methods and properties but behave as axial vector.
Parameters
• azi – The plunge direction or trend in degrees.
• inc – The plunge in degrees.

Example

>>> Lin(120, 60)


L:120/60

angle(other)
Return an angle (<90) between two linear features in degrees.

Example

>>> l = Lin(45, 50)


>>> l.angle(Lin(110, 25))
55.253518182588884

cross(other)
Create planar feature defined by two linear features.

Example

>>> l = Lin(120,10)
>>> l.cross(Lin(160,30))
S:196/35

dot(other)
Calculate the axial dot product.
classmethod rand()
Random Lin
dd
Return trend and plunge tuple.
class apsg.core.Fol
Bases: apsg.core.Vec3
Represents a planar feature.
It provides all Vec3 methods and properties but plane normal behave as axial vector.

1.1. core module 7


APSG Documentation, Release 0.7.0 Beta

Parameters
• azi – The dip azimuth in degrees.
• inc – The dip angle in degrees.

Example

>>> Fol(120, 60)


S:120/60

angle(other)
Return angle of two planar features in degrees.

Example

>>> f = Fol(120, 30)


>>> f.angle(Fol(210, 60))
64.34109372674472

cross(other)
Return linear feature defined as intersection of two planar features.

Example

>>> f = Fol(60,30)
>>> f.cross(Fol(120,40))
L:72/29

dot(other)
Axial dot product.
rake(rake)
Return a Vec3 object with given rake.

Example

>>> f = Fol(120,50)
>>> f.rake(30)
V(0.589, 0.711, 0.383)
>>> f.rake(30).aslin
L:50/23

classmethod rand()
Random Fol
transform(F, **kwargs)
Return affine transformation of planar feature by matrix F.
Parameters F (DefGrad or numpy.array) – transformation matrix
Keyword Arguments norm – normalize transformed vectors. True or False. Default False
Returns representation of affine transformation (dot product) of self by F

8 Chapter 1. Package modules


APSG Documentation, Release 0.7.0 Beta

Example

>>> F = [[1, 0, 0], [0, 1, 1], [0, 0, 1]]


>>> f = Fol(90, 90)
>>> f.transform(F)
S:90/45

dd
Return dip-direction, dip tuple.
dv
Return a dip Vec3 object.

Example

>>> f = Fol(120,50)
>>> f.dv
V(-0.321, 0.557, 0.766)

rhr
Return strike and dip tuple (right-hand-rule).
class apsg.core.Pair(fazi, finc, lazi, linc)
Bases: object
The class to store pair of planar and linear feature.
When Pair object is created, both planar and linear feature are adjusted, so linear feature perfectly fit onto
planar one. Warning is issued, when misfit angle is bigger than 20 degrees.
Parameters
• fazi (float) – dip azimuth of planar feature in degrees
• finc (float) – dip of planar feature in degrees
• lazi (float) – plunge direction of linear feature in degrees
• linc (float) – plunge of linear feature in degrees

Example

>>> p = Pair(140, 30, 110, 26)

H(other)
Return DefGrad rotational matrix H which rotate Pair to other Pair.
Parameters other (Pair) – other pair
Returns Defgrad rotational matrix

Example

>>> p1 = Pair(58, 36, 81, 34)


>>> p2 = Pair(217,42, 162, 27)
>>> p1.transform(p1.H(p2)) == p2
True

1.1. core module 9


APSG Documentation, Release 0.7.0 Beta

classmethod from_pair(fol, lin)


Create Pair from Fol and Lin objects.

Example

>>> f = Fol(140, 30)


>>> l = Lin(110, 26)
>>> p = Pair.from_pair(f, l)

classmethod rand()
Random Pair
rotate(axis, phi)
Rotates Pair by angle phi about axis.
Parameters
• axis (Vec3) – axis of rotation
• phi (float) – angle of rotation in degrees

Example

>>> p = Pair(140, 30, 110, 26)


>>> p.rotate(Lin(40, 50), 120)
P:210/83-287/60

transform(F, **kwargs)
Return an affine transformation of Pair by matrix F.
Parameters F (DefGrad or numpy.array) – transformation matrix
Keyword Arguments norm – normalize transformed vectors. True or False. Default False
Returns representation of affine transformation (dot product) of self by F

Example

>>> F = [[1, 0, 0], [0, 1, 1], [0, 0, 1]]


>>> p = Pair(90, 90, 0, 50)
>>> p.transform(F)
P:90/45-50/37

fol
Return a planar feature of Pair as Fol.
lin
Return a linear feature of Pair as Lin.
rax
Return an oriented vector perpendicular to both Fol and Lin.
type
class apsg.core.Fault(fazi, finc, lazi, linc, sense)
Bases: apsg.core.Pair
Fault class for related Fol and Lin instances with sense of movement.

10 Chapter 1. Package modules


APSG Documentation, Release 0.7.0 Beta

When Fault object is created, both planar and linear feature are adjusted, so linear feature perfectly fit onto
planar one. Warning is issued, when misfit angle is bigger than 20 degrees.
Parameters
• fazi (float) – dip azimuth of planar feature in degrees
• finc (float) – dip of planar feature in degrees
• lazi (float) – plunge direction of linear feature in degrees
• linc (float) – plunge of linear feature in degrees
• sense (float) – sense of movement +/-1 hanging-wall up/down

Example

>>> p = Fault(140, 30, 110, 26, -1)

classmethod from_pair(fol, lin, sense)


Create Fault with given sense from Fol and Lin objects
classmethod from_vecs(fvec, lvec)
Create Fault from two ortogonal Vec3 objects
Parameters
• fvec – vector normal to fault plane
• lvec – vector parallel to movement
rotate(axis, phi)
Rotates Fault by phi degrees about axis.
Parameters
• axis – axis of rotation
• phi – angle of rotation in degrees

Example

>>> f = Fault(140, 30, 110, 26, -1)


>>> f.rotate(Lin(220, 10), 60)
F:300/31-301/31 +

d
Return dihedra plane as Fol
m
Return kinematic M-plane as Fol
p
Return P-axis as Lin
pvec
Return P axis as Vec3
sense
Return sense of movement (+/-1)

1.1. core module 11


APSG Documentation, Release 0.7.0 Beta

t
Return T-axis as Lin
tvec
Return T-axis as Vec3.
class apsg.core.Group(data, name=’Default’)
Bases: list
Represents a homogeneous group of Vec3, Fol or Lin objects.
Group provide append and extend methods as well as list indexing to get or set individual items. It also supports
following operators:
• + - merge groups
• ** - mutual cross product
• abs - array of magnitudes (lengths) of all objects
See following methods and properties for additional operations.
Parameters
• data (list) – list of Vec3, Fol or Lin objects
• name (str) – Name of group
Returns Group object

Example

>>> g = Group([Lin(120, 20), Lin(151, 23), Lin(137, 28)])

angle(other=None)
Return angles of all data in Group object
Without arguments it returns angles of all pairs in dataset. If argument is group or single data object all
mutual angles are returned.
append(item)
Append object to the end of the list.
bootstrap(N=100, size=None)
Return iterator of bootstraped samples from Group.
Parameters
• N – number of samples to be generated
• size – number of data in sample. Default is same as Group.

Example

>>> np.random.seed(58463123)
>>> g = Group.randn_lin(100, mean=Lin(120,40))
>>> sm = [gb.R for gb in g.bootstrap(100)]
>>> g.fisher_stats
{'k': 16.1719344862197, 'a95': 3.627369676728579, 'csd': 20.142066812987963}
>>> Group(sm).fisher_stats
{'k': 1577.5503256282452, 'a95': 0.3559002104835758, 'csd': 2.
˓→0393577026717056}
(continues on next page)

12 Chapter 1. Package modules


APSG Documentation, Release 0.7.0 Beta

(continued from previous page)

copy()
Return a shallow copy of the list.
cross(other=None)
Return cross products of all data in Group object
Without arguments it returns cross product of all pairs in dataset. If argument is group or single data object
all mutual cross products are returned.
dot(vec)
Return array of dot products of all data in Group with vector.
classmethod examples(name=None)
Create Group from example datasets. Available names are returned when no name of example dataset is
given as argument.
Keyword Arguments name – name of dataset

Example

>>> g = Group.examples('B2')

extend(items=())
Extend list by appending elements from the iterable.
classmethod fisher_lin(N=100, mean=L:0/90, kappa=20, name=’Default’)
Method to create Group of Lin objects distributed according to Fisher distribution.
Parameters
• N – number of objects to be generated
• kappa – precision parameter of the distribution. Default 20
• name – name of dataset. Default is ‘Default’

Example

>>> g = Group.fisher_lin(100, mean=Lin(120,10))

classmethod from_array(azis, incs, typ=<class ’apsg.core.Lin’>, name=’Default’)


Create Group object from arrays of azimuths and inclinations
Parameters
• azis – list or array of azimuths
• incs – list or array of inclinations
Keyword Arguments
• typ – type of data. Fol or Lin
• name – name of Group object. Default is ‘Default’

1.1. core module 13


APSG Documentation, Release 0.7.0 Beta

Example

>>> f = Fault(140, 30, 110, 26, -1)

classmethod from_csv(filename, typ=<class ’apsg.core.Lin’>, acol=0, icol=1)


Create Group object from csv file
Parameters filename (str) – name of CSV file to load
Keyword Arguments
• typ – Type of objects. Default Lin
• acol (int or str) – azimuth column (starts from 0). Default 0
• icol (int or str) – inclination column (starts from 0). Default 1 When acol and icol
are strings they are used as column headers.

Example

>>> g1 = Group.from_csv('file1.csv', typ=Fol) #doctest: +SKIP


>>> g2 = Group.from_csv('file2.csv', acol=1, icol=2) #doctest: +SKIP

classmethod from_file(filename)
Load group from pickle file.
Parameters filename (str) – name of data file to load.
classmethod gss_fol(N=500, name=’Default’)
Method to create Group of uniformly distributed Fol objects. Based on Group.gss_vec3 method,
but only half of sphere is used.
Parameters
• N – number of objects to be generated. Default 500
• name – name of dataset. Default is ‘Default’

Example

>>> g = Group.gss_fol(300)
>>> g.ortensor.eigenvals
(0.33498372991251285, 0.33333659934369725, 0.33167967074378996)

classmethod gss_lin(N=500, name=’Default’)


Method to create Group of uniformly distributed Lin objects. Based on Group.gss_vec3 method,
but only half of sphere is used.
Parameters
• N – number of objects to be generated. Default 500
• name – name of dataset. Default is ‘Default’

Example

14 Chapter 1. Package modules


APSG Documentation, Release 0.7.0 Beta

>>> g = Group.gss_lin(300)
>>> g.ortensor.eigenvals
(0.33498372991251285, 0.33333659934369725, 0.33167967074378996)

classmethod gss_vec3(N=1000, name=’Default’)


Method to create Group of uniformly distributed Vec3 objects. Golden Section Spiral points on a sphere
algorithm.
http://www.softimageblog.com/archives/115
Parameters
• N – number of objects to be generated. Default 1000
• name – name of dataset. Default is ‘Default’

Example

>>> v = Group.gss_vec3(300)
>>> v.ortensor.eigenvals
(0.3333568856957158, 0.3333231511543691, 0.33331996314991513)

classmethod kent_lin(p, kappa=20, beta=0, N=500, name=’Default’)


Method to create Group of Lin objects distributed according to Kent distribution (Kent, 1982) - The
5-parameter Fisher–Bingham distribution.
Parameters
• p – Pair object defining orientation of data
• N – number of objects to be generated
• kappa – concentration parameter. Default 20
• beta – ellipticity 0 <= beta < kappa
• name – name of dataset. Default is ‘Default’

Example

>>> p = Pair(135, 30, 90, 22)


>>> g = Group.kent_lin(p, 30, 5, 300)

proj(vec)
Return projections of all data in Group onto vector.
classmethod randn_fol(N=100, mean=S:0/0, sig=20, name=’Default’)
Method to create Group of normaly distributed random Fol objects.
Keyword Arguments
• N – number of objects to be generated
• mean – mean orientation given as Fol. Default Fol(0, 0)
• sig – sigma of normal distribution. Default 20
• name – name of dataset. Default is ‘Default’

1.1. core module 15


APSG Documentation, Release 0.7.0 Beta

Example

>>> np.random.seed(58463123)
>>> g = Group.randn_fol(100, Lin(240, 60))
>>> g.R
S:237/60

classmethod randn_lin(N=100, mean=L:0/90, sig=20, name=’Default’)


Method to create Group of normaly distributed random Lin objects.
Keyword Arguments
• N – number of objects to be generated
• mean – mean orientation given as Lin. Default Lin(0, 90)
• sig – sigma of normal distribution. Default 20
• name – name of dataset. Default is ‘Default’

Example

>>> np.random.seed(58463123)
>>> g = Group.randn_lin(100, Lin(120, 40))
>>> g.R
L:118/42

rotate(axis, phi)
Rotate Group object phi degress about axis.
classmethod sfs_fol(N=500, name=’Default’)
Method to create Group of uniformly distributed Fol objects. Based on Group.sfs_vec3 method,
but only half of sphere is used.
Parameters
• N – number of objects to be generated. Default 500
• name – name of dataset. Default is ‘Default’

Example

>>> g = Group.sfs_fol(300)
>>> g.ortensor.eigenvals
(0.33417707294664595, 0.333339733866985, 0.332483193186369)

classmethod sfs_lin(N=500, name=’Default’)


Method to create Group of uniformly distributed Lin objects. Based on Group.sfs_vec3 method,
but only half of sphere is used.
Parameters
• N – number of objects to be generated. Default 500
• name – name of dataset. Default is ‘Default’

16 Chapter 1. Package modules


APSG Documentation, Release 0.7.0 Beta

Example

>>> g = Group.sfs_lin(300)
>>> g.ortensor.eigenvals
(0.33417707294664595, 0.333339733866985, 0.332483193186369)

classmethod sfs_vec3(N=1000, name=’Default’)


Method to create Group of uniformly distributed Vec3 objects. Spherical Fibonacci Spiral points on a
sphere algorithm adopted from John Burkardt.
http://people.sc.fsu.edu/~jburkardt/
Keyword Arguments
• N – number of objects to be generated. Default 1000
• name – name of dataset. Default is ‘Default’

Example

>>> v = Group.sfs_vec3(300)
>>> v.ortensor.eigenvals
(0.33346453471636356, 0.33333474915201167, 0.3332007161316248)

to_csv(filename, delimiter=’, ’, rounded=False)


Save Group object to csv file
Parameters filename (str) – name of CSV file to save.
Keyword Arguments
• delimiter (str) – values delimiter. Default ‘,’
• rounded (bool) – round values to integer. Default False
to_file(filename)
Save group to pickle file.
Parameters filename (str) – name of file to save.
transform(F, **kwargs)
Return affine transformation of Group by matrix ‘F’.
Parameters F – Transformation matrix. Should be array-like value e.g. DefGrad
Keyword Arguments norm – normalize transformed vectors. True or False. Default False
classmethod uniform_fol(N=500, name=’Default’)
Method to create Group of uniformly distributed Fol objects.
Keyword Arguments
• N – approximate (maximum) number of objects to be generated
• name – name of dataset. Default is ‘Default’

Example

>>> g = Group.uniform_fol(300)
>>> g.ortensor.eigenvals
(0.3354383042654646, 0.3322808478672677, 0.3322808478672675)

1.1. core module 17


APSG Documentation, Release 0.7.0 Beta

classmethod uniform_lin(N=500, name=’Default’)


Method to create Group of uniformly distributed Lin objects.
Keyword Arguments
• N – approximate (maximum) number of objects to be generated
• name – name of dataset. Default is ‘Default’

Example

>>> g = Group.uniform_lin(300)
>>> g.ortensor.eigenvals
(0.33543830426546456, 0.3322808478672677, 0.3322808478672676)

R
Return resultant of data in Group object.
Resultant is of same type as Group. Note that Fol and Lin are axial in nature so resultant can give other
result than expected. For most cases is should not be problem as it is calculated as resultant of centered
data. Anyway for axial data orientation tensor analysis will give you right answer.
As axial summing is not commutative we use vectorial summing of centered data for Fol and Lin
V
Return Group object with all data converted to Vec3.
asfol
Return Group object with all data converted to Fol.
aslin
Return Group object with all data converted to Lin.
asvec3
Return Group object with all data converted to Vec3.
centered
Rotate Group object to position that eigenvectors are parallel to axes of coordinate system: E1(vertical),
E2(east-west), E3(north-south)
cluster
Return hierarchical clustering Cluster of Group.
data
Return list of objects in Group.
dd
Return array of azimuths and inclinations of Group
delta
Cone angle containing ~63% of the data in degrees.
For enough large sample it approach angular standard deviation (csd) of Fisher statistics
fisher_stats
Fisher’s statistics.
fisher_stats property returns dictionary with k estimated precision parameter, csd estimated angular stan-
dard deviation a95 confidence limit
flip
Return Group object with inverted z-coordinate.

18 Chapter 1. Package modules


APSG Documentation, Release 0.7.0 Beta

halfspace
Change orientation of vectors in Group, so all have angle<=90 with resultant.
ortensor
Return orientation tensor Ortensor of Group.
rdegree
Degree of preffered orientation of data in Group object.
D = 100 * (2 * |R| - n) / n
rhr
Return array of strikes and dips of Group
upper
Return boolean array of z-coordinate negative test
uv
Return Group object with normalized (unit length) elements.
var
Spherical variance based on resultant length (Mardia 1972).
var = 1 - |R| / n
class apsg.core.PairSet(data, name=’Default’)
Bases: list
Represents a homogeneous group of Pair objects.
append(item)
Append object to the end of the list.
extend(items=())
Extend list by appending elements from the iterable.
classmethod from_array(fazis, fincs, lazis, lincs, name=’Default’)
Create PairSet from arrays of azimuths and inclinations
classmethod from_csv(fname, delimiter=’, ’, facol=1, ficol=2, lacol=3, licol=4)
Read PairSet from csv file
rotate(axis, phi)
Rotate PairSet
to_csv(fname, delimiter=’, ’, rounded=False)
data
fol
Return Fol part of PairSet as Group of Fol
fvec
Return vectors of Fol of PairSet as Group of Vec3
lin
Return Lin part of PairSet as Group of Lin
lvec
Return vectors of Lin part of PairSet as Group of Vec3
misfit
Return array of misfits

1.1. core module 19


APSG Documentation, Release 0.7.0 Beta

ortensor
Return Lisle (1989) orientation tensor Ortensor of Group.
rax
Return vectors perpendicular to both Fol and Lin of PairSet as Group of Vec3.
class apsg.core.FaultSet(data, name=’Default’)
Bases: apsg.core.PairSet
Represents a homogeneous group of Fault objects.
angmech(method=’classic’)
Implementation of Angelier-Mechler dihedra method
Parameters
• method – ‘probability’ or ‘classic’. Classic method assigns +/-1
• individual positions, while 'probability' returns maximum
(to) –
• estimate. (likelihood) –
classmethod examples(name=None)
Create FaultSet from example datasets. Available names are returned when no name of example dataset
is given as argument.
Keyword Arguments name – name of dataset

Example

>>> fs = FaultSet.examples('MELE')

classmethod from_array(fazis, fincs, lazis, lincs, senses, name=’Default’)


Create dataset from arrays of azimuths and inclinations
classmethod from_csv(fname, delimiter=’, ’, facol=1, ficol=2, lacol=3, licol=4, scol=5)
Read FaultSet from csv file
to_csv(fname, delimiter=’, ’, rounded=False)
d
Return dihedra planes of FaultSet as Group of Fol
m
Return m-planes of FaultSet as Group of Fol
p
Return p-axes of FaultSet as Group of Lin
pvec
Return p-axes of FaultSet as Group of Vec3
sense
Return array of sense values
t
Return t-axes of FaultSet as Group of Lin
tvec
Return t-axes of FaultSet as Group of Vec3

20 Chapter 1. Package modules


APSG Documentation, Release 0.7.0 Beta

class apsg.core.Cluster(d, **kwargs)


Bases: object
Provides a hierarchical clustering using scipy.cluster routines.
The distance matrix is calculated as an angle between features, where Fol and Lin use axial angles while
Vec3 uses direction angles.
cluster(**kwargs)
Do clustering on data
Result is stored as tuple of Groups in groups property.
Keyword Arguments
• criterion – The criterion to use in forming flat clusters
• maxclust – number of clusters
• angle – maximum cophenetic distance(angle) in clusters
dendrogram(**kwargs)
Show dendrogram
See scipy.cluster.hierarchy.dendrogram for possible kwargs.
elbow(no_plot=False, n=None)
Plot within groups variance vs. number of clusters.
Elbow criterion could be used to determine number of clusters.
linkage(**kwargs)
Do linkage of distance matrix
Keyword Arguments method – The linkage algorithm to use
R
Return group of clusters resultants.
class apsg.core.StereoGrid(d=None, **kwargs)
Bases: object
The class to store regular grid of values to be contoured on StereoNet.
StereoGrid object could be calculated from Group object or by user- defined function, which accept unit
vector as argument.
Parameters
• g – Group object of data to be used for desity calculation. If
• zero values grid is returned. (ommited,) –
Keyword Arguments
• npoints – approximate number of grid points Default 1800
• grid – type of grid ‘radial’ or ‘ortho’. Default ‘radial’
• sigma – sigma for kernels. Default 1
• method – ‘exp_kamb’, ‘linear_kamb’, ‘square_kamb’, ‘schmidt’, ‘kamb’. Default
‘exp_kamb’
• trim – Set negative values to zero. Default False
• Note – Euclidean norms are used as weights. Normalize data if you dont want to use
weigths.

1.1. core module 21


APSG Documentation, Release 0.7.0 Beta

apply_func(func, *args, **kwargs)


Calculate values using function passed as argument. Function must accept Vec3-like (or 3 elements array)
as argument and return scalar value.
calculate_density(dcdata, **kwargs)
Calculate density of elements from Group object.
contour(*args, **kwargs)
Show contours of values.
contourf(*args, **kwargs)
Show filled contours of values.
initgrid(**kwargs)
plotcountgrid()
Show counting grid.
max
max_at
min
min_at
apsg.core.G(s, typ=<class ’apsg.core.Lin’>, name=’Default’)
Create a group from space separated string of azimuths and inclinations.

1.2 plotting module

class apsg.plotting.StereoNet(*args, **kwargs)


Bases: object
StereoNet class for Schmidt net plotting.
A stereonet is a lower hemisphere Schmidt net on to which a variety of geological data can be plotted.
If args are provided plot is immediately shown. If no args are provided, following methods and properties could
be used for additional operations.
Parameters plottable APSG class (any) –
Keyword Arguments
• fol_plot – default method for Fol instances. [‘plane’ or ‘pole’] Default ‘plane’
• title – figure title. Default ‘’
• figsize – Figure size. Default from settings ()
• ncols – number of subplot columns. Default 1
• ticks – show ticks. Default True
• grid – show grid lines. Default False
• gridlw – grid lines width. Default 1
• grid_style – grid lines style. Default ‘k:’
• cbpad – colorbar padding. Default 0.1
• keyword arguments are passed to matplotlib plot. (Other) –

22 Chapter 1. Package modules


APSG Documentation, Release 0.7.0 Beta

Example

>>> s = StereoNet()
>>> g = Group.randn_lin(mean=Lin(40, 20))
>>> s.contourf(g, 8, legend=True, sigma=2)
>>> s.line(g, 'g.', label='My data')
>>> s.show()

animate(**kwargs)
Return artist animation.
arc(l1, l2, *args, **kwargs)
Draw great circle segment between two points.
arrow(pos_lin, dir_lin=None, sense=1, **kwargs)
Draw arrow at given position in given direction.
axtitle(title)
Add title to active axes.
cla()
Clear axes and draw empty projection.
close()
cone(obj, alpha, *args, **kwargs)
Draw small circle.
contour(obj, *args, **kwargs)
Plot contour lines.
contourf(obj, *args, **kwargs)
Plot filled contours.
draw()
fault(obj, *arg, **kwargs)
Draw a fault-and-striae as in Angelier plot
format_coord(x, y)
getfol()
Get Fol instance by mouse click.
getfols()
Get Group of Fol by mouse clicks.
getlin()
Get Lin instance by mouse click.
getlins()
Get Group of Lin by mouse clicks.
hoeppner(obj, *arg, **kwargs)
Draw a fault-and-striae as in tangent lineation plot - Hoeppner plot.
hover(event)
line(obj, *args, **kwargs)
Draw Lin as point.
new()
Re-initialize existing StereoNet.

1.2. plotting module 23


APSG Documentation, Release 0.7.0 Beta

pair(obj, *arg, **kwargs)


Draw Pair as great circle with small point.
plane(obj, *args, **kwargs)
Draw Fol as great circle.
pole(obj, *args, **kwargs)
Draw Fol as pole.
polygon(*args, **kwargs)
Draw filled polygon defined by series of points or planes.
savefig(filename=’apsg_stereonet.pdf’, **kwargs)
Save figure to file.
scatter(obj, *args, **kwargs)
Draw Lin as point with varying marker size and/or color.
show()
Call matplotlib show.
tensor(obj, *arg, **kwargs)
Draw tensor pricipal planes as great circles.
title(title=”)
Set figure title.
vector(obj, *args, **kwargs)
This mimics plotting on lower and upper hemisphere using full and hollow symbols.
closed
class apsg.plotting.VollmerPlot(*args, **kwargs)
Bases: apsg.plotting._FabricPlot
Represents the triangular fabric plot (Vollmer, 1989).
cla()
Clear projection.
format_coord(x, y)
path(objs, *args, **kwargs)
plot(obj, *args, **kwargs)
triplot(a, b, c, *args, **kwargs)
class apsg.plotting.RamsayPlot(*args, **kwargs)
Bases: apsg.plotting._FabricPlot
Represents the Ramsay deformation plot.
cla()
Clear projection.
format_coord(x, y)
path(objs, *args, **kwargs)
plot(obj, *args, **kwargs)
show()
class apsg.plotting.FlinnPlot(*args, **kwargs)
Bases: apsg.plotting._FabricPlot

24 Chapter 1. Package modules


APSG Documentation, Release 0.7.0 Beta

Represents the Ramsay deformation plot.


cla()
Clear projection.
format_coord(x, y)
path(objs, *args, **kwargs)
plot(obj, *args, **kwargs)
show()
class apsg.plotting.HsuPlot(*args, **kwargs)
Bases: apsg.plotting._FabricPlot
Represents the Hsu fabric plot.
cla()
Clear projection.
format_coord(x, y)
path(objs, *args, **kwargs)
plot(obj, *args, **kwargs)
class apsg.plotting.RosePlot(*args, **kwargs)
Bases: object
RosePlot class for rose histogram plotting.
Parameters plottable APSG class (any) –
Keyword Arguments
• title – figure title. Default ‘’
• figsize – Figure size. Default from settings ()
• axial – Directional data are axial. Defaut True
• density – Use density instead of counts. Default False
• pdf – Plot Von Mises density function instead histogram. Default False
• Shape parameter of Von Mises pdf. Default 250 (kappa;) –
• scaled – Bins scaled by area instead value. Default False
• arrow – Bar arrowness. (0-1) Default 0.95
• rwidth – Bar width (0-1). Default 1
• ticks – show ticks. Default True
• grid – show grid lines. Default False
• grid_kw – Dict passed to Axes.grid. Default {}
• keyword arguments are passed to matplotlib plot. (Other) –

Examples

1.2. plotting module 25


APSG Documentation, Release 0.7.0 Beta

>>> g = Group.randn_fol(mean=Fol(120, 0))


>>> direction, dip = g.rhr
>>> RosePlot(direction)
>>> RosePlot(direction, density=True)
>>> RosePlot(direction, pdf=True)
>>> s = RosePlot()
>>> s.plot(direction, color='r')
>>> s.show()

cla()
Clear projection.
close()
plot(obj, *args, **kwargs)
savefig(filename=’apsg_roseplot.pdf’, **kwargs)
show()

1.3 tensors module


class apsg.tensors.DefGrad
Bases: numpy.ndarray
DefGrad store deformation gradient tensor derived from numpy.ndarray.
Parameters a (3x3 array_like) – Input data, that can be converted to 3x3 2D array. This
includes lists, tuples and ndarrays.
Returns DefGrad object

Example

>>> F = DefGrad(np.diag([2, 1, 0.5]))

classmethod from_axis(vector, theta)


Return DefGrad representing rotation around axis.
Parameters
• vector – Rotation axis as Vec3 like object
• theta – Angle of rotation in degrees

Example

>>> F = DefGrad.from_axis(Lin(120, 30), 45)

classmethod from_comp(xx=1, xy=0, xz=0, yx=0, yy=1, yz=0, zx=0, zy=0, zz=1)
Return DefGrad tensor defined by individual components. Default is identity tensor.
Keyword Arguments xy, xz, yx, yy, yz, zx, zy, zz (xx,) – tensor components

26 Chapter 1. Package modules


APSG Documentation, Release 0.7.0 Beta

Example

>>> F = DefGrad.from_comp(xy=1, zy=-0.5)


>>> F
DefGrad:
[[ 1. 1. 0. ]
[ 0. 1. 0. ]
[ 0. -0.5 1. ]]

classmethod from_pair(p)
classmethod from_ratios(Rxy=1, Ryz=1)
Return isochoric DefGrad tensor with axial stretches defined by strain ratios. Default is identity tensor.
Keyword Arguments Ryz (Rxy,) – strain ratios

Example

>>> F = DefGrad.from_ratios(Rxy=2, Ryz=3)


>>> F
DefGrad:
[[2.28942849 0. 0. ]
[0. 1.14471424 0. ]
[0. 0. 0.38157141]]

rotate(vector, theta=0)
Rotate tensor around axis by angle theta.
Using rotation matrix it returns F = R * F * R . T.
velgrad(time=1)
Return VelGrad for given time
B
Return left Cauchy–Green deformation tensor or Finger deformation tensor
C
Return right Cauchy–Green deformation tensor or Green’s deformation tensor
E1
Max eigenvalue
E2
Middle eigenvalue
E3
Min eigenvalue
I
Returns the inverse tensor.
R
Return rotation part of DefGrad from polar decomposition.
U
Return stretching part of DefGrad from right polar decomposition.
V
Return stretching part of DefGrad from left polar decomposition.

1.3. tensors module 27


APSG Documentation, Release 0.7.0 Beta

axisangle
Return rotation part of DefGrad axis, angle tuple.
eigenfols
Return `Group` of principal eigenvectors as Fol objects.
eigenlins
Return `Group` of principal eigenvectors as Lin objects.
eigenvals
Return tuple of sorted eigenvalues.
eigenvects
Return `Group` of principal eigenvectors as Vec3 objects.
class apsg.tensors.VelGrad
Bases: numpy.ndarray
VelGrad store velocity gradient tensor derived from numpy.ndarray.
Parameters a (3x3 array_like) – Input data, that can be converted to 3x3 2D array. This
includes lists, tuples and ndarrays.
Returns VelGrad object

Example

>>> L = VelGrad(np.diag([0.1, 0, -0.1]))

defgrad(time=1, steps=1)
Return DefGrad tensor accumulated after given time.
Keyword Arguments
• time (float) – time of deformation. Default 1
• steps (int) – when bigger than 1, will return a list of DefGrad tensors for each
timestep.
classmethod from_comp(xx=0, xy=0, xz=0, yx=0, yy=0, yz=0, zx=0, zy=0, zz=0)
Return VelGrad tensor. Default is zero tensor.
Keyword Arguments xy, xz, yx, yy, yz, zx, zy, zz (xx,) – tensor components

Example

>>> L = VelGrad.from_comp(xx=0.1, zz=-0.1)


>>> L
VelGrad:
[[ 0.1 0. 0. ]
[ 0. 0. 0. ]
[ 0. 0. -0.1]]

rotate(vector, theta=0)
Rotate tensor around axis by angle theta.
Using rotation matrix it returns F = R * F * R . T.
rate
Return rate of deformation tensor

28 Chapter 1. Package modules


APSG Documentation, Release 0.7.0 Beta

spin
Return spin tensor
class apsg.tensors.Stress
Bases: numpy.ndarray
Stress store stress tensor derived from numpy.ndarray.
Parameters a (3x3 array_like) – Input data, that can be converted to 3x3 2D array. This
includes lists, tuples and ndarrays.
Returns Stress object

Example

>>> S = Stress([[-8, 0, 0],[0, -5, 0],[0, 0, -1]])

cauchy(n)
Return stress vector associated with plane given by normal vector.
Parameters n – normal given as Vec3 or Fol object

Example

>>> S = Stress.from_comp(xx=-5, yy=-2, zz=10, xy=1)


>>> S.cauchy(Fol(160, 30))
V(-2.520, 0.812, 8.660)

fault(n)
Return Fault object derived from given by normal vector.
Parameters n – normal given as Vec3 or Fol object

Example

>>> S = Stress.from_comp(xx=-5, yy=-2, zz=10, xy=8)


>>> S.fault(Fol(160, 30))
F:160/30-141/29 +

classmethod from_comp(xx=0, xy=0, xz=0, yy=0, yz=0, zz=0)


Return Stress tensor. Default is zero tensor.
Note that stress tensor must be symmetrical.
Keyword Arguments xy, xz, yy, yz, zz (xx,) – tensor components

Example

>>> S = Stress.from_comp(xx=-5, yy=-2, zz=10, xy=1)


>>> S
Stress:
[[-5 1 0]
[ 1 -2 0]
[ 0 0 10]]

1.3. tensors module 29


APSG Documentation, Release 0.7.0 Beta

normal_stress(n)
Return normal stress component on plane given by normal vector.
rotate(vector, theta=0)
Rotate tensor around axis by angle theta.
Using rotation matrix it returns S = R * S * R . T
shear_stress(n)
Return magnitude of shear stress component on plane given by normal vector.
stress_comp(n)
Return normal and shear stress Vec3 components on plane given by normal vector.
E1
Max eigenvalue
E2
Middle eigenvalue
E3
Min eigenvalue
I1
First invariant
I2
Second invariant
I3
Third invariant
deviatoric
A stress deviator tensor component
diagonalized
Returns Stress tensor in a coordinate system with axes oriented to the principal directions and orthogonal
matrix R, which brings actual coordinate system to principal one.
eigenfols
Returns Group of three eigenvectors represented as Fol
eigenlins
Returns Group of three eigenvectors represented as Lin
eigenvects
Returns Group of three eigenvectors represented as Vec3
hydrostatic
Mean hydrostatic stress tensor component
mean_stress
Mean stress
class apsg.tensors.Ortensor(matrix, **kwargs)
Bases: apsg.tensors.Tensor
Represents an orientation tensor, which characterize data distribution using eigenvalue method. See (Watson
1966, Scheidegger 1965).
See following methods and properties for additional operations.

30 Chapter 1. Package modules


APSG Documentation, Release 0.7.0 Beta

Parameters matrix (3x3 array_like) – Input data, that can be converted to 3x3 2D matrix.
This includes lists, tuples and ndarrays. Array could be also Group (for backward compatibil-
ity)
Keyword Arguments
• name (str) – name od tensor
• scaled (bool) – When True eigenvectors are scaled by eigenvalues. Otherwise unit
length. Default False
Returns Ortensor object

Example

>>> ot = Ortensor([[8, 0, 0], [0, 2, 0], [0, 0, 1]])


>>> ot
Ortensor: Kind: LLS
(E1:8,E2:2,E3:1)
[[8 0 0]
[0 2 0]
[0 0 1]]

classmethod from_group(g, **kwargs) → apsg.tensors.Ortensor


Return Ortensor of data in Group
Parameters g – Group of Vec3, Lin or Fol

Example

>>> g = Group.examples('B2')
>>> ot = Ortensor.from_group(g)
>>> ot
Ortensor: B2 Kind: L
(E1:0.9825,E2:0.01039,E3:0.007101)
[[ 0.19780807 -0.13566589 -0.35878837]
[-0.13566589 0.10492993 0.25970594]
[-0.35878837 0.25970594 0.697262 ]]
>>> ot.eigenlins.data
[L:144/57, L:360/28, L:261/16]

classmethod from_pairs(p, **kwargs) → apsg.tensors.Ortensor


Return Lisle (19890‘‘Ortensor‘‘ of orthogonal data in PairSet
Lisle, R. (1989). The Statistical Analysis of Orthogonal Orientation Data. The Journal of Geology, 97(3),
360-364.
Parameters p – PairSet

Example

>>> p = PairSet([Pair(109, 82, 21, 10),


Pair(118, 76, 30, 11),
Pair(97, 86, 7, 3),
Pair(109, 75, 23, 14) ])
(continues on next page)

1.3. tensors module 31


APSG Documentation, Release 0.7.0 Beta

(continued from previous page)


>>> ot = Ortensor.from_pairs(p)
>>> ot
Ortensor: Default Kind: LS
(E1:0.956,E2:0.00473,E3:-0.9608)
[[ 0.7307853 0.57519626 0.08621956]
[ 0.57519626 -0.72530456 0.22401935]
[ 0.08621956 0.22401935 -0.00548074]]
>>> ot.eigenfols[2]
S:108/79
>>> ot.eigenlins[0]
L:20/9

B
Cylindricity index (Vollmer, 1990).
E1
Return maximum eigenvalue.
E2
Return middle eigenvalue.
E3
Return minimum eigenvalue.
G
Girdle index (Vollmer, 1990).
Intensity
Intensity index (Lisle, 1985).
MAD
Return approximate deviation according to shape
MADo
Return approximate deviation from the plane normal to E3.
MADp
Return approximate angular deviation from the major axis along E1.
P
Point index (Vollmer, 1990).
R
Random index (Vollmer, 1990).
class apsg.tensors.Ellipsoid(matrix, **kwargs)
Bases: apsg.tensors.Tensor
Ellipsoid class
See following methods and properties for additional operations.
Parameters matrix (3x3 array_like) – Input data, that can be converted to 3x3 2D matrix.
This includes lists, tuples and ndarrays.
Returns Ellipsoid object

32 Chapter 1. Package modules


APSG Documentation, Release 0.7.0 Beta

Example

>>> E = Ellipsoid([[8, 0, 0], [0, 2, 0], [0, 0, 1]])


>>> E
Ellipsoid: Kind: LLS
(E1:2.828,E2:1.414,E3:1)
[[8 0 0]
[0 2 0]
[0 0 1]]

classmethod from_defgrad(F, **kwargs) → apsg.tensors.Ellipsoid


Return Ellipsoid from Defgrad.
It is ellipsoid resulting from deformation of sphere.
transform(F) → apsg.tensors.Ellipsoid
Return Ellipsoid representing result of deformation F

1.4 db module

1.4. db module 33
APSG Documentation, Release 0.7.0 Beta

34 Chapter 1. Package modules


CHAPTER 2

Tutorial

APSG defines several new python classes to easily manage, analyze and visualize orientation structural geology data.
Base class Vec3 is derived from numpy.array class and offers several new method which will be explained in
following examples.

2.1 Basic usage

APSG module could be imported either into own name space or into active one for easier interactive work:

>>> from apsg import *

2.2 Basic operations with vectors

Instance of vector object Vec3 could be created from any iterable object as list, tuple or array:

>>> u = Vec3([1, -2, 3])


>>> v = Vec3([-2, 1, 1])

For common vector operation we can use standard mathematical operators or special methods using dot notation:

>>> u + v
V(-1.000, -1.000, 4.000)
>>> u - v
V(3.000, -3.000, 2.000)
>>> 3*u - 2*v
V(7.000, -8.000, 7.000)

Its magnitude or length is most commonly defined as its Euclidean norm and could be calculated using abs:

35
APSG Documentation, Release 0.7.0 Beta

>>> abs(v)
2.4494897427831779
>>> abs(u+v)
4.2426406871192848

For dot product we can use multiplication operator * or dot method:

>>> u*v
-1
>>> u.dot(v)
-1

For cross product we can use operator ** or method cross:

>>> u**v
V(-5.000, -7.000, -3.000)
>>> u.cross(v)
V(-5.000, -7.000, -3.000)

To project vector u onto vector v we can use method proj:

>>> u.proj(v)
V(0.333, -0.167, -0.167)

To find angle (in degrees) between to vectors we use method angle:

>>> u.angle(v)
96.263952719927218

Method rotate provide possibility to rotate vector around another vector. For example, to rotate vector u around
vector v for 45°:

>>> u.rotate(v, 45)


V(2.248, 0.558, 2.939)

2.3 Classes Lin and Fol

To work with orientation data in structural geology, APSG provide two classes derived from Vec3 class. There is Fol
class to represent planar features by planes and Lin class to represent linear feature by lines. Both classes provide all
Vec3 methods, but they differ in way how instance is created and how some operations are calculated, as structural
geology data are commonly axial in nature.
To create instance of Lin or Fol class, we have to provide dip direction and dip, both in degrees:

>>> Lin(120, 60)


L:120/60
>>> Fol(216, 62)
S:216/62

or we can create instance from Vec3 object using aslin and asfol properties:

>>> u.aslin
L:297/53
>>> u.asfol
S:117/37

36 Chapter 2. Tutorial
APSG Documentation, Release 0.7.0 Beta

2.4 Vec3 methods for Lin and Fol

To find angle between two linear or planar features we can use method angle:
>>> l1 = Lin(110, 40)
>>> l2 = Lin(160, 30)
>>> l1.angle(l2)
41.597412680035468
>>> p1 = Fol(330, 50)
>>> p2 = Fol(250, 40)
>>> p1.angle(p2)
54.696399321975328

We can use cross product to construct planar feature defined by two linear features:
>>> l1**l2
S:113/40

or to construct linear feature defined as intersection of two planar features:


>>> p1**p2
L:278/36

Cross product of planar and linear features could be used to construct plane defined by linear feature and normal of
planar feature:
>>> l2**p2
S:96/53

or to find perpendicular linear feature on given plane:


>>> p2**l2
L:276/37

To rotate structural features we can use method rotate:


>>> p2.rotate(l2, 45)
S:269/78

2.5 Classes Pair and Fault

To work with paired orientation data like foliations and lineations or fault data in structural geology, APSG provide
two base Pair class and derived Fault class. Both classes are instantiated providing dip direction and dip of planar
and linear measurements, which are automatically orthogonalized. If misfit is too high, warning is raised. The Fault
class expects one more argument providing sense of movement information, either 1 or -1.
To create instance of Pair class, we have to provide dip direction and dip of planar and linear feature, both in degrees:
>>> p = Pair(120, 40, 162, 28)
>>> p
P:118/39-163/30
>>> p.misfit
3.5623168411508175
>>> type(p)
<class 'apsg.core.Pair'>

2.4. Vec3 methods for Lin and Fol 37


APSG Documentation, Release 0.7.0 Beta

Planar and linear features are accessible using fol and lin properties:

>>> p.fol
S:118/39
>>> p.lin
L:163/30
>>> type(p.fol)
<class 'apsg.core.Fol'>
>>> type(p.lin)
<class 'apsg.core.Lin'>

To rotate Pair instance we can use rotate method:

>>> p.rotate(Lin(45, 10), 60)


P:314/83-237/61

Instantiation of Fault class is similar, we just have to provide argument to define sense of movement:

>>> f = Fault(120, 60, 110, 58, -1) # -1 for normal fault


>>> f
F:120/59-110/59 -

Note the change in sense of movement after Fault rotation:

>>> f.rotate(Lin(45, 10), 60)


F:312/62-340/59 +

For simple fault analyses Fault class also provide p, t, m and d properties to get PT-axes, kinematic plane and
dihedra separation plane:

>>> f.p
L:315/75
>>> f.t
L:116/14
>>> f.m
S:27/85
>>> f.d
S:290/31

2.6 Group class

Group class serve as a homogeneous container for Lin, Fol and Vec3 objects. It allows grouping of features either
for visualization or batch analysis:

>>> g = Group([Lin(120,60), Lin(116,50), Lin(132,45), Lin(90,60), Lin(84,52)],


>>> name='L1')
>>> g
L1: 5 Lin

To simplify interactive group creation, you can use function G:

>>> g = G('120 60 116 50 132 45 90 60 84 52', name='L1')

Method len returns number of features in group:

38 Chapter 2. Tutorial
APSG Documentation, Release 0.7.0 Beta

>>> len(g)
5

Most of the Lin, Fol and Vec3 methods could be used for Group as well. For example, to measure angles between
all features in group and another feature, we can use method angle:
>>> g.angle(Lin(110,50))
array([ 11.49989817, 3.85569115, 15.61367789, 15.11039885, 16.3947936 ])

To rotate all features in group around another feature, we can use method rotate:
>>> gr = g.rotate(Lin(150, 30), 45)

To show data in list you can use data property:


>>> gr.data
[L:107/35, L:113/26, L:126/30, L:93/26, L:94/18]

Property R gives mean or resultant of all features in group. Note that Lin and Fol are axial in nature, so resultant
vector is not reliable. You can use ortensor property.:
>>> g.R
L:110/55

Group class offers several methods to infer spherical statistics as spherical variance, Fisher’s statistics, confidence
cones on data etc.:
>>> g.var
0.02337168447438509
>>> g.fisher_stats
{'k': 34.229454059110871, 'a95': 13.264029905117329, 'csd': 13.844747281750971}
>>> g.delta
12.411724720740544

To calculate orientation tensor of all features in group, we can use ortensor property.:
>>> g.ortensor
Ortensor: L1 Kind: LLS
(E1:0.954,E2:0.04021,E3:0.005749)
[[ 0.07398181 -0.09605477 -0.14324311]
[-0.09605477 0.28446118 0.42092899]
[-0.14324311 0.42092899 0.64155701]]

2.7 Ortensor class

Ortensor class represents orientation tensor of set of planar or linear features. Eigenvalues and eigenvectors could
be obtained by methods eigenvals and eigenvects. Eigenvectors could be also represented by linear or planar
features using properties eigenlins and eigenfols. Several properties to describe orientation distribution is also
impleneted, e.g. Woodcock’s shape and strength or Vollmer’s P, G, R and C indexes.:
>>> ot = Ortensor.from_group(g)
>>> ot.eigenvals
(0.954038468659639, 0.04021274946196462, 0.005748781878396576)
>>> ot.eigenvects.data
(continues on next page)

2.7. Ortensor class 39


APSG Documentation, Release 0.7.0 Beta

(continued from previous page)


[V(0.192, -0.542, -0.818), V(-0.981, -0.082, -0.176), V(-0.028, -0.836, 0.547)]
>>> ot.eigenlins.data
[L:110/55, L:5/10, L:268/33]
>>> ot.eigenfols.data
[S:290/35, S:185/80, S:88/57]
>>> ot.strength, ot.shape
(5.111716009046873, 1.6278666609093613)
>>> ot.P, ot.G, ot.R
(0.91382571919767419, 0.068927935167136606, 0.017246345635188932)

2.8 StereoNet class

When StereoNet class instance is created with arguments, they are immidiatelly plotted and shown. Most of
the objects provided by APSG could be plotted. Here we use the Group object and principal planes and lines of
Ortensor:

>>> StereoNet(g, ot.eigenfols, ot.eigenlins)

When StereoNet class instance is created without arguments, several methods and properties could be used for
additional operations. To finalize plot we can use show method (not needed in jupyter notebooks)
Any Fol, Lin, Group object could be visualized as plane, line or pole in stereographic projection using StereoNet

40 Chapter 2. Tutorial
APSG Documentation, Release 0.7.0 Beta

class:

>>> s = StereoNet()
>>> s.plane(Fol(150, 40))
>>> s.pole(Fol(150, 40))
>>> s.line(Lin(112, 30))
>>> s.show()

A cones (or small circles) could be plotted as well:

>>> s = StereoNet()
>>> g = Group.randn_lin(mean=Lin(40, 15))
>>> s.line(g, 'k.')
>>> s.cone(g.R, g.fisher_stats['a95'], 'r') # confidence cone on resultant
>>> s.cone(g.R, g.fisher_stats['csd'], 'g') # confidence cone on 63% of data
>>> s.show()

2.8. StereoNet class 41


APSG Documentation, Release 0.7.0 Beta

To make density contours plots, a contour and contourf methods are available:

>>> s = StereoNet()
>>> g = Group.randn_lin(mean=Lin(40, 20))
>>> s.contourf(g, 8, legend=True, sigma=2)
>>> s.line(g, 'g.')
>>> s.show()

42 Chapter 2. Tutorial
APSG Documentation, Release 0.7.0 Beta

Except Group, APSG provides PairSet and FaultSet classes to store Pair or Fault datasets. It can be
inicialized by passing list of Pair or Fault objects as argument or use class methods from_array or from_csv:

>>> p = PairSet([Pair(120, 30, 165, 20),


>>> Pair(215, 60, 280,35),
>>> Pair(324, 70, 35, 40)])
>>> p.misfit
array([ 2.0650076 , 0.74600727, 0.83154705])
>>> StereoNet(p)

2.8. StereoNet class 43


APSG Documentation, Release 0.7.0 Beta

StereoNet has two special methods to visualize fault data. Method fault produce classical Angelier plot:

>>> f = FaultSet([Fault(170, 60, 182, 59, -1),


>>> Fault(210, 55, 195, 53, -1),
>>> Fault(10, 60, 15, 59, -1),
>>> Fault(355, 48, 22, 45, -1)])
>>> s = StereoNet()
>>> s.fault(f)
>>> s.line(f.p, label='P-axes')
>>> s.line(f.t, label='T-axes')
>>> s.plane(f.m, label='M-planes')
>>> s.show()

44 Chapter 2. Tutorial
APSG Documentation, Release 0.7.0 Beta

hoeppner method produce Hoeppner diagram and must be invoked from StereoNet instance:

>>> s = StereoNet()
>>> s.hoeppner(f, label=repr(f))
>>> s.show()

2.8. StereoNet class 45


APSG Documentation, Release 0.7.0 Beta

Note that fault method is used, when data are passed directly to StereoNet instance:

>>> f = Fault(120, 60, 110, 58, -1)


>>> StereoNet(f, f.m, f.d, f.p, f.t)

46 Chapter 2. Tutorial
APSG Documentation, Release 0.7.0 Beta

2.9 StereoGrid class

StereoGrid class allows to visualize any scalar field on StereoNet. Internally it is used for plotting contour di-
agrams, but it exposes apply_func method to calculate scalar field by any user-defined function. Function must
accept three element numpy.array as first argument passed from grid points of StereoGrid.
Following example shows how to plot resolved shear stress on plane from given stress tensor. StereoGrid.
apply_func method is used to calculate this value over all directions and finally values are plotted by StereoNet:

>>> S = Stress([[-10, 2, -3],[2, -5, 1], [-3, 1, 2]])


>>> d = StereoGrid()
>>> d.apply_func(S.shear_stress)
>>> s = StereoNet()
>>> s.contourf(d, 10, legend=True)
>>> s.show()

2.9. StereoGrid class 47


APSG Documentation, Release 0.7.0 Beta

The FaultSet provide also amgmech method which provide access to Angelier dihedra method. Results are stored
in StereoGrid. Default behavior is to calculate counts (positive in extension, negative in compression):

>>> f = FaultSet.examples('MELE')
>>> StereoNet(f.angmech())

48 Chapter 2. Tutorial
APSG Documentation, Release 0.7.0 Beta

Setting method to ‘probability’, maximum likelihood estimate is calculated.:

>>> f = FaultSet.examples('MELE')
>>> StereoNet(f.angmech(method='probability'))

2.9. StereoGrid class 49


APSG Documentation, Release 0.7.0 Beta

2.10 Fabric plots

APSG provides several fabric plots to visualize Tensor-type objects (Ortensor, Ellipsoid). FlinnPlot class
provide classical Flinn’s deformation diagram,

>>> g1 = Group.examples('B2')
>>> g2 = Group.examples('B4')
>>> g3 = Group.uniform_lin(name='Uniform')
>>> FlinnPlot(g1, g2, g3);

50 Chapter 2. Tutorial
APSG Documentation, Release 0.7.0 Beta

RamsayPlot class provide Ramsay modification of Flinn’s deformation diagram,

>>> RamsayPlot(g1, g2, g3);

2.10. Fabric plots 51


APSG Documentation, Release 0.7.0 Beta

VollmerPlot class provide triangular fabric plot (Vollmer, 1989),

>>> VollmerPlot(g1, g2, g3);

52 Chapter 2. Tutorial
APSG Documentation, Release 0.7.0 Beta

and HsuPlot class provide Hsu fabric diagram using natural strains.

>>> HsuPlot(g1, g2, g3);

2.10. Fabric plots 53


APSG Documentation, Release 0.7.0 Beta

2.11 Cluster class

Cluster class provide access to scipy hierarchical clustering. Distance matrix is calculated as mutual angles of
features within Group keeping axial and/or vectorial nature in mind. Cluster.explain method allows to explore
explained variance versus number of clusters relation. Actual cluster is done by Cluster.cluster method, using
distance or maxclust criterion. Using of Cluster is explained in following example. We generate some data and
plot dendrogram:

>>> g1 = Group.randn_lin(mean=Lin(45,30))
>>> g2 = Group.randn_lin(mean=Lin(320,56))
>>> g3 = Group.randn_lin(mean=Lin(150,40))
>>> g = g1 + g2 + g3
>>> cl = Cluster(g)
>>> cl.dendrogram(no_labels=True)

54 Chapter 2. Tutorial
APSG Documentation, Release 0.7.0 Beta

Now we can explore evolution of within-groups variance versus number of clusters on Elbow plot (Note change in
slope for three clusters):

>>> cl.elbow()

2.11. Cluster class 55


APSG Documentation, Release 0.7.0 Beta

Finally we can do clustering and plot created clusters:

>>> cl.cluster(maxclust=3)
>>> cl.R.data # Restored centres of clusters
[L:146/39, L:43/26, L:323/59]
>>> StereoNet(*cl.groups)

56 Chapter 2. Tutorial
APSG Documentation, Release 0.7.0 Beta

2.12 Some tricks

Double cross products are allowed but not easy to understand.


For example p**l**p is interpreted as p**(l**p): a) l**p is plane defined by l and p normal b) intersection of
this plane and p is calculated:

>>> p = Fol(250,40)
>>> l = Lin(160,25)
>>> StereoNet(p, l, l**p, p**l, l**p**l, p**l**p)

2.12. Some tricks 57


APSG Documentation, Release 0.7.0 Beta

Pair class could be used to correct measurements of planar linear features which should spatialy overlap:

>>> pl = Pair(250, 40, 160, 25)


>>> pl.misfit
18.889520432245405
>>> s = StereoNet()
>>> s.plane(Fol(250, 40), 'b', label='Original')
>>> s.line(Lin(160, 25), 'bo', label='Original')
>>> s.plane(pl.fol, 'g', label='Corrected')
>>> s.line(pl.lin, 'go', label='Corrected')
>>> s.show()

58 Chapter 2. Tutorial
APSG Documentation, Release 0.7.0 Beta

StereoNet has method arrow to draw arrow. Here is example of Hoeppner plot for variable fault orientation within
given stress field:

>>> S = Stress([[-8, 0, 0],[0, -5, 0],[0, 0, -1]]).rotate(Lin(90,45), 45)


>>> d = StereoGrid(npoints=300)
>>> s = StereoNet()
>>> s.tensor(S)
>>> for dc in d.dcgrid:
>>> f = S.fault(dc)
>>> s.arrow(f.fvec, f.lvec, f.sense)
>>> s.show()

2.12. Some tricks 59


APSG Documentation, Release 0.7.0 Beta

60 Chapter 2. Tutorial
CHAPTER 3

Installation

3.1 Using Conda

The APSG package is also available through conda-forge. To install APSG using conda, use the following com-
mand:

conda install apsg --channel conda-forge

or simply
conda install apsg
if you added conda-forge to your channels (conda config --add channels conda-forge).

3.2 Using pip

To install APSG from PyPI, just execute:

pip install apsg

To upgrade an existing version of APSG from PyPI, execute


pip install apsg –upgrade –no-deps
Please note that the dependencies (Matplotlib, NumPy and SciPy) will also be upgraded if you omit the --no-deps
flag; use the --no-deps (“no dependencies”) flag if you don’t want this.

3.3 Master version

The APSG version on PyPI may always one step behind; you can install the latest development version from the
GitHub repository by executing:

61
APSG Documentation, Release 0.7.0 Beta

pip install git+git://github.com/ondrolexa/apsg.git

62 Chapter 3. Installation
CHAPTER 4

Usage

To use APSG in a project:

import apsg

To use APSG interactively it is easier to import into current namespace:

from apsg import *

63
APSG Documentation, Release 0.7.0 Beta

64 Chapter 4. Usage
CHAPTER 5

Contributing

Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:

5.1 Types of Contributions

5.1.1 Report Bugs

Report bugs at https://github.com/ondrolexa/apsg/issues.


If you are reporting a bug, please include:
• Your operating system name and version.
• Any details about your local setup that might be helpful in troubleshooting.
• Detailed steps to reproduce the bug.

5.1.2 Fix Bugs

Look through the GitHub issues for bugs. Anything tagged with “bug” is open to whoever wants to implement it.

5.1.3 Implement Features

Look through the GitHub issues for features. Anything tagged with “feature” is open to whoever wants to implement
it.

65
APSG Documentation, Release 0.7.0 Beta

5.1.4 Write Documentation

APSG could always use more documentation, whether as part of the official APSG docs, in docstrings, or even on the
web in blog posts, articles, and such.

5.1.5 Submit Feedback

The best way to send feedback is to file an issue at https://github.com/ondrolexa/apsg/issues.


If you are proposing a feature:
• Explain in detail how it would work.
• Keep the scope as narrow as possible, to make it easier to implement.
• Remember that this is a volunteer-driven project, and that contributions are welcome :)

5.2 Get Started!

Ready to contribute? Here’s how to set up apsg for local development.


1. Fork the apsg repo on GitHub.
2. Clone your fork locally with SSH or HTTPS:

$ git clone git@github.com:ondrolexa/apsg.git

$ git clone https://github.com/ondrolexa/apsg.git

3. Install your local copy and activate the virtual environment via pipenv.
$ cd apsg/ $ pipenv shell $ pipenv install –dev
4. Create a branch for local development:

$ git checkout -b name-of-your-bugfix-or-feature

6. Now you can make your changes locally.


7. When you’re done making changes, check that your changes pass flake8 and the tests, including testing other
Python versions with tox:

$ flake8 apsg tests


$ python setup.py test
$ tox

8. Commit your changes and push your branch to GitHub:

$ git add .
$ git commit -m "Your detailed description of your changes."
$ git push origin name-of-your-bugfix-or-feature

9. Submit a pull request through the GitHub website.

66 Chapter 5. Contributing
APSG Documentation, Release 0.7.0 Beta

5.3 Pull Request Guidelines

Before you submit a pull request, check that it meets these guidelines:
1. The pull request should include tests.
2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function
with a docstring, and add the feature to the list in README.rst.
3. The pull request should work for Python 2.7, 3.5, and 3.6, and for PyPy. Check https://travis-ci.org/ondrolexa/
apsg/pull_requests and make sure that the tests pass for all supported Python versions.

5.3. Pull Request Guidelines 67


APSG Documentation, Release 0.7.0 Beta

68 Chapter 5. Contributing
CHAPTER 6

Credits

6.1 Development Lead

• Ondrej Lexa <lexa.ondrej@gmail.com>

6.2 Contributors

• David Landa <david.landa@natur.cuni.cz>

69
APSG Documentation, Release 0.7.0 Beta

70 Chapter 6. Credits
Python Module Index

a
apsg.core, 3
apsg.plotting, 22
apsg.tensors, 26

71
APSG Documentation, Release 0.7.0 Beta

72 Python Module Index


Index

A cla() (apsg.plotting.StereoNet method), 23


angle() (apsg.core.Fol method), 8 cla() (apsg.plotting.VollmerPlot method), 24
angle() (apsg.core.Group method), 12 close() (apsg.plotting.RosePlot method), 26
angle() (apsg.core.Lin method), 7 close() (apsg.plotting.StereoNet method), 23
angle() (apsg.core.Vec3 method), 4 closed (apsg.plotting.StereoNet attribute), 24
angmech() (apsg.core.FaultSet method), 20 cluster (apsg.core.Group attribute), 18
animate() (apsg.plotting.StereoNet method), 23 Cluster (class in apsg.core), 20
append() (apsg.core.Group method), 12 cluster() (apsg.core.Cluster method), 21
append() (apsg.core.PairSet method), 19 cone() (apsg.plotting.StereoNet method), 23
apply_func() (apsg.core.StereoGrid method), 21 contour() (apsg.core.StereoGrid method), 22
apsg.core (module), 3 contour() (apsg.plotting.StereoNet method), 23
apsg.plotting (module), 22 contourf() (apsg.core.StereoGrid method), 22
apsg.tensors (module), 26 contourf() (apsg.plotting.StereoNet method), 23
arc() (apsg.plotting.StereoNet method), 23 copy() (apsg.core.Group method), 13
arrow() (apsg.plotting.StereoNet method), 23 cross() (apsg.core.Fol method), 8
asfol (apsg.core.Group attribute), 18 cross() (apsg.core.Group method), 13
asfol (apsg.core.Vec3 attribute), 5 cross() (apsg.core.Lin method), 7
aslin (apsg.core.Group attribute), 18 cross() (apsg.core.Vec3 method), 4
aslin (apsg.core.Vec3 attribute), 6
asvec3 (apsg.core.Group attribute), 18 D
asvec3 (apsg.core.Vec3 attribute), 6 d (apsg.core.Fault attribute), 11
axisangle (apsg.tensors.DefGrad attribute), 27 d (apsg.core.FaultSet attribute), 20
axtitle() (apsg.plotting.StereoNet method), 23 data (apsg.core.Group attribute), 18
data (apsg.core.PairSet attribute), 19
B dd (apsg.core.Fol attribute), 9
B (apsg.tensors.DefGrad attribute), 27 dd (apsg.core.Group attribute), 18
B (apsg.tensors.Ortensor attribute), 32 dd (apsg.core.Lin attribute), 7
bootstrap() (apsg.core.Group method), 12 dd (apsg.core.Vec3 attribute), 6
DefGrad (class in apsg.tensors), 26
C defgrad() (apsg.tensors.VelGrad method), 28
delta (apsg.core.Group attribute), 18
C (apsg.tensors.DefGrad attribute), 27
dendrogram() (apsg.core.Cluster method), 21
calculate_density() (apsg.core.StereoGrid
deviatoric (apsg.tensors.Stress attribute), 30
method), 22
diagonalized (apsg.tensors.Stress attribute), 30
cauchy() (apsg.tensors.Stress method), 29
dot() (apsg.core.Fol method), 8
centered (apsg.core.Group attribute), 18
dot() (apsg.core.Group method), 13
cla() (apsg.plotting.FlinnPlot method), 25
dot() (apsg.core.Lin method), 7
cla() (apsg.plotting.HsuPlot method), 25
draw() (apsg.plotting.StereoNet method), 23
cla() (apsg.plotting.RamsayPlot method), 24
dv (apsg.core.Fol attribute), 9
cla() (apsg.plotting.RosePlot method), 26

73
APSG Documentation, Release 0.7.0 Beta

E from_comp() (apsg.tensors.VelGrad class method), 28


E1 (apsg.tensors.DefGrad attribute), 27 from_csv() (apsg.core.FaultSet class method), 20
E1 (apsg.tensors.Ortensor attribute), 32 from_csv() (apsg.core.Group class method), 14
E1 (apsg.tensors.Stress attribute), 30 from_csv() (apsg.core.PairSet class method), 19
E2 (apsg.tensors.DefGrad attribute), 27 from_defgrad() (apsg.tensors.Ellipsoid class
E2 (apsg.tensors.Ortensor attribute), 32 method), 33
E2 (apsg.tensors.Stress attribute), 30 from_file() (apsg.core.Group class method), 14
E3 (apsg.tensors.DefGrad attribute), 27 from_group() (apsg.tensors.Ortensor class method),
E3 (apsg.tensors.Ortensor attribute), 32 31
E3 (apsg.tensors.Stress attribute), 30 from_pair() (apsg.core.Fault class method), 11
eigenfols (apsg.tensors.DefGrad attribute), 28 from_pair() (apsg.core.Pair class method), 9
eigenfols (apsg.tensors.Stress attribute), 30 from_pair() (apsg.tensors.DefGrad class method),
eigenlins (apsg.tensors.DefGrad attribute), 28 27
eigenlins (apsg.tensors.Stress attribute), 30 from_pairs() (apsg.tensors.Ortensor class method),
eigenvals (apsg.tensors.DefGrad attribute), 28 31
eigenvects (apsg.tensors.DefGrad attribute), 28 from_ratios() (apsg.tensors.DefGrad class
eigenvects (apsg.tensors.Stress attribute), 30 method), 27
elbow() (apsg.core.Cluster method), 21 from_vecs() (apsg.core.Fault class method), 11
Ellipsoid (class in apsg.tensors), 32 fvec (apsg.core.PairSet attribute), 19
examples() (apsg.core.FaultSet class method), 20
examples() (apsg.core.Group class method), 13 G
extend() (apsg.core.Group method), 13 G (apsg.tensors.Ortensor attribute), 32
extend() (apsg.core.PairSet method), 19 G() (in module apsg.core), 22
getfol() (apsg.plotting.StereoNet method), 23
F getfols() (apsg.plotting.StereoNet method), 23
Fault (class in apsg.core), 10 getlin() (apsg.plotting.StereoNet method), 23
fault() (apsg.plotting.StereoNet method), 23 getlins() (apsg.plotting.StereoNet method), 23
fault() (apsg.tensors.Stress method), 29 Group (class in apsg.core), 12
FaultSet (class in apsg.core), 20 gss_fol() (apsg.core.Group class method), 14
fisher_lin() (apsg.core.Group class method), 13 gss_lin() (apsg.core.Group class method), 14
fisher_stats (apsg.core.Group attribute), 18 gss_vec3() (apsg.core.Group class method), 15
FlinnPlot (class in apsg.plotting), 24
flip (apsg.core.Group attribute), 18
H
flip (apsg.core.Vec3 attribute), 6 H() (apsg.core.Pair method), 9
fol (apsg.core.Pair attribute), 10 H() (apsg.core.Vec3 method), 4
fol (apsg.core.PairSet attribute), 19 halfspace (apsg.core.Group attribute), 18
Fol (class in apsg.core), 7 hoeppner() (apsg.plotting.StereoNet method), 23
format_coord() (apsg.plotting.FlinnPlot method), hover() (apsg.plotting.StereoNet method), 23
25 HsuPlot (class in apsg.plotting), 25
format_coord() (apsg.plotting.HsuPlot method), 25 hydrostatic (apsg.tensors.Stress attribute), 30
format_coord() (apsg.plotting.RamsayPlot method),
24 I
format_coord() (apsg.plotting.StereoNet method), I (apsg.tensors.DefGrad attribute), 27
23 I1 (apsg.tensors.Stress attribute), 30
format_coord() (apsg.plotting.VollmerPlot method), I2 (apsg.tensors.Stress attribute), 30
24 I3 (apsg.tensors.Stress attribute), 30
from_array() (apsg.core.FaultSet class method), 20 initgrid() (apsg.core.StereoGrid method), 22
from_array() (apsg.core.Group class method), 13 Intensity (apsg.tensors.Ortensor attribute), 32
from_array() (apsg.core.PairSet class method), 19
from_axis() (apsg.tensors.DefGrad class method), K
26 kent_lin() (apsg.core.Group class method), 15
from_comp() (apsg.tensors.DefGrad class method),
26 L
from_comp() (apsg.tensors.Stress class method), 29 lin (apsg.core.Pair attribute), 10

74 Index
APSG Documentation, Release 0.7.0 Beta

lin (apsg.core.PairSet attribute), 19 R


Lin (class in apsg.core), 7 R (apsg.core.Cluster attribute), 21
line() (apsg.plotting.StereoNet method), 23 R (apsg.core.Group attribute), 18
linkage() (apsg.core.Cluster method), 21 R (apsg.tensors.DefGrad attribute), 27
lvec (apsg.core.PairSet attribute), 19 R (apsg.tensors.Ortensor attribute), 32
rake() (apsg.core.Fol method), 8
M RamsayPlot (class in apsg.plotting), 24
m (apsg.core.Fault attribute), 11 rand() (apsg.core.Fol class method), 8
m (apsg.core.FaultSet attribute), 20 rand() (apsg.core.Lin class method), 7
MAD (apsg.tensors.Ortensor attribute), 32 rand() (apsg.core.Pair class method), 10
MADo (apsg.tensors.Ortensor attribute), 32 rand() (apsg.core.Vec3 class method), 5
MADp (apsg.tensors.Ortensor attribute), 32 randn_fol() (apsg.core.Group class method), 15
max (apsg.core.StereoGrid attribute), 22 randn_lin() (apsg.core.Group class method), 16
max_at (apsg.core.StereoGrid attribute), 22 rate (apsg.tensors.VelGrad attribute), 28
mean_stress (apsg.tensors.Stress attribute), 30 rax (apsg.core.Pair attribute), 10
min (apsg.core.StereoGrid attribute), 22 rax (apsg.core.PairSet attribute), 20
min_at (apsg.core.StereoGrid attribute), 22 rdegree (apsg.core.Group attribute), 19
misfit (apsg.core.PairSet attribute), 19 rhr (apsg.core.Fol attribute), 9
rhr (apsg.core.Group attribute), 19
N RosePlot (class in apsg.plotting), 25
new() (apsg.plotting.StereoNet method), 23 rotate() (apsg.core.Fault method), 11
normal_stress() (apsg.tensors.Stress method), 29 rotate() (apsg.core.Group method), 16
rotate() (apsg.core.Pair method), 10
O rotate() (apsg.core.PairSet method), 19
ortensor (apsg.core.Group attribute), 19 rotate() (apsg.core.Vec3 method), 5
ortensor (apsg.core.PairSet attribute), 19 rotate() (apsg.tensors.DefGrad method), 27
Ortensor (class in apsg.tensors), 30 rotate() (apsg.tensors.Stress method), 30
rotate() (apsg.tensors.VelGrad method), 28
P
p (apsg.core.Fault attribute), 11
S
p (apsg.core.FaultSet attribute), 20 savefig() (apsg.plotting.RosePlot method), 26
P (apsg.tensors.Ortensor attribute), 32 savefig() (apsg.plotting.StereoNet method), 24
Pair (class in apsg.core), 9 scatter() (apsg.plotting.StereoNet method), 24
pair() (apsg.plotting.StereoNet method), 23 sense (apsg.core.Fault attribute), 11
PairSet (class in apsg.core), 19 sense (apsg.core.FaultSet attribute), 20
path() (apsg.plotting.FlinnPlot method), 25 sfs_fol() (apsg.core.Group class method), 16
path() (apsg.plotting.HsuPlot method), 25 sfs_lin() (apsg.core.Group class method), 16
path() (apsg.plotting.RamsayPlot method), 24 sfs_vec3() (apsg.core.Group class method), 17
path() (apsg.plotting.VollmerPlot method), 24 shear_stress() (apsg.tensors.Stress method), 30
plane() (apsg.plotting.StereoNet method), 24 show() (apsg.plotting.FlinnPlot method), 25
plot() (apsg.plotting.FlinnPlot method), 25 show() (apsg.plotting.RamsayPlot method), 24
plot() (apsg.plotting.HsuPlot method), 25 show() (apsg.plotting.RosePlot method), 26
plot() (apsg.plotting.RamsayPlot method), 24 show() (apsg.plotting.StereoNet method), 24
plot() (apsg.plotting.RosePlot method), 26 spin (apsg.tensors.VelGrad attribute), 28
plot() (apsg.plotting.VollmerPlot method), 24 StereoGrid (class in apsg.core), 21
plotcountgrid() (apsg.core.StereoGrid method), 22 StereoNet (class in apsg.plotting), 22
pole() (apsg.plotting.StereoNet method), 24 Stress (class in apsg.tensors), 29
polygon() (apsg.plotting.StereoNet method), 24 stress_comp() (apsg.tensors.Stress method), 30
proj() (apsg.core.Group method), 15
proj() (apsg.core.Vec3 method), 4 T
pvec (apsg.core.Fault attribute), 11 t (apsg.core.Fault attribute), 11
pvec (apsg.core.FaultSet attribute), 20 t (apsg.core.FaultSet attribute), 20
tensor() (apsg.plotting.StereoNet method), 24

Index 75
APSG Documentation, Release 0.7.0 Beta

title() (apsg.plotting.StereoNet method), 24


to_csv() (apsg.core.FaultSet method), 20
to_csv() (apsg.core.Group method), 17
to_csv() (apsg.core.PairSet method), 19
to_file() (apsg.core.Group method), 17
transform() (apsg.core.Fol method), 8
transform() (apsg.core.Group method), 17
transform() (apsg.core.Pair method), 10
transform() (apsg.core.Vec3 method), 5
transform() (apsg.tensors.Ellipsoid method), 33
triplot() (apsg.plotting.VollmerPlot method), 24
tvec (apsg.core.Fault attribute), 12
tvec (apsg.core.FaultSet attribute), 20
type (apsg.core.Pair attribute), 10
type (apsg.core.Vec3 attribute), 6

U
U (apsg.tensors.DefGrad attribute), 27
uniform_fol() (apsg.core.Group class method), 17
uniform_lin() (apsg.core.Group class method), 17
upper (apsg.core.Group attribute), 19
upper (apsg.core.Vec3 attribute), 6
uv (apsg.core.Group attribute), 19
uv (apsg.core.Vec3 attribute), 6

V
V (apsg.core.Group attribute), 18
V (apsg.core.Vec3 attribute), 5
V (apsg.tensors.DefGrad attribute), 27
var (apsg.core.Group attribute), 19
Vec3 (class in apsg.core), 3
vector() (apsg.plotting.StereoNet method), 24
VelGrad (class in apsg.tensors), 28
velgrad() (apsg.tensors.DefGrad method), 27
VollmerPlot (class in apsg.plotting), 24

76 Index

You might also like