Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
v00.00.00, 2012-04-16 -- pre-init dev beta
v00.00.01, 2016-06-27 -- AFRL commmit
674 changes: 674 additions & 0 deletions LICENSE.md

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paytonej, would an MIT license make more sense here? That would be more in line with the "free in both the 'beer' and 'speech' senses" ideology (docs/faq.rst, line 20)

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include *.txt
recursive-include docs *.txt
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Cryspy: Computational Crystallography in Python: *A Python Toolbox for (some, specialized) EBSD Data Analyses*

Cryspy is a toolbox for computational crystallography in Python.
It intends to provide a set of open source tools for
visualization, analysis, and postprocessing of EBSD data.

## COMPONENTS

* io : modules for import and export of EBSD data
* rot : modules for rotation representation, manipulation, and conversion
* vis : modules for data visualization
* ebsd : modules for EBSD data analysis and manipulation
* xtal : modules for crystallography and symmetry calculations
* util : utilities

## CONTENT HIGHLIGHTS

io
------------------------------------------------------------------------------
* loadang:: support for loading TSL *.ang files

rot
------------------------------------------------------------------------------
* angax : class for the angle/axis convention
* bunge : class for Bunge Euler angles
* quat : class for quaternion representations
* rodri : class for Rodrigues vector representations
* tvec : class for transformation vectors (reshaped rotation matrices)

xtal
------------------------------------------------------------------------------
* lattvec : class for representing lattice vectors
* miller : class for representing lattice plane normals
* unitcell: class for representing unit cells
* rotsymm : class for rotational symmetry objects

vis
------------------------------------------------------------------------------
* stereoproj : class for plotting stereographic projections
* eaproj : class for plotting equal area projections

util
------------------------------------------------------------------------------
* rationalize : function for turning fractional vectors into rational indices
* sigdec : function for rounding to n significant digits
10 changes: 0 additions & 10 deletions __init__.py

This file was deleted.

111 changes: 111 additions & 0 deletions bin/DeGraefHenry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 15 16:59:33 2013

@author: epayton
"""

import ovlib as ov
from numpy import pi

# 4.3.1
uc = ov.unitcell(a=3., b=4., c=6., beta=120.)
bodydiag = ov.lattvec(1,1,1)
print bodydiag.length(uc) # result should be 6.557

# 4.3.2
uc = ov.unitcell(a=2., b=2., c=3.)
atom1 = ov.lattsite(1./2., 1./3., 1./4.)
atom2 = ov.lattsite(1./3., 1./2., 3./4.)
print atom1.distance(atom2, uc) # result should be 1.572

# 4.3.3
uc = ov.unitcell()
atom1 = ov.lattsite(1./2., 1./2., 0.)
atom2 = ov.lattsite(1./2., 0., 1./2.)
origin = ov.lattsite(0., 0., 0.)
print atom1.angle(atom2, uc, origin)*180./pi # result should be 1.572

# 4.3.4
uc = ov.unitcell(a=4., b=6., c=5., beta=120.)
vec1 = ov.lattvec(1., 0., 1.)
vec2 = ov.lattvec(-2., 0., 1.)
print vec1.angle(vec2, uc)*180./pi

# 6.5(i)
uc = ov.unitcell(a=2., b=2., c=2.)
plane = ov.miller(1., 1., 0.)
print plane.dspacing(uc)

# 6.5(ii)
uc = ov.unitcell(a=3., b=4., c=6., gamma=120.)
plane = ov.miller(1., 1., 1.)
print plane.dspacing(uc)

# 6.5(iii)
uc = ov.unitcell(a=4., b=6., c=5., beta=120.)
plane1 = ov.miller( 1., 0., 1.)
plane2 = ov.miller(-2., 0., 1.)
print plane1.angle(plane2, uc)*180./pi

# Table 7.2
uc = ov.unitcell(beta=45.)
u = [1., 0., 0., 1., 1., 0., 1.]
v = [0., 1., 0., 1., 0., 1., 1.]
w = [0., 0., 1., 0., 1., 1., 1.]
vec1 = ov.lattvec(u, v, w)
cart1 = vec1.to_cartesian(uc)
xproj1, yproj1, hemi1 = ov.stereotrans(cart1)

# Table 7.2
vec2 = ov.miller(u, v, w)
cart2 = vec2.to_cartesian(uc)
xproj2, yproj2, hemi2 = ov.stereotrans(cart2)

# Fig 7.11(a)
sg = ov.stereoproj() # initialize the stereographic projection
sg.add_lattvec(vec1,uc) # add our lattice vectors to the projection
sg.add_lattveclabels(vec1,uc)
sg.grid_greatcircles()
sg.grid_smallcircles()
sg.grid_spokes(degreestep=45)

from matplotlib.font_manager import FontProperties
font=FontProperties()
font.set_size('large')
font.set_style('italic')
sg.add_eastlabel(fontproperties=font)
sg.add_southlabel(fontproperties=font)
sg.add_centerlabel(fontproperties=font)
sg.add_coordinatereadout(uc)

# Fig 7.11(b)
sg = ov.stereoproj() # initialize the stereographic projection
sg.add_miller(vec2,uc) # add our lattice vectors to the projection
sg.add_millerlabels(vec2,uc)
sg.grid_wulffnet()

from matplotlib.font_manager import FontProperties
font=FontProperties()
font.set_size('large')
font.set_style('italic')
sg.add_eastlabel(fontproperties=font)
sg.add_southlabel(fontproperties=font)
sg.add_centerlabel(fontproperties=font)
sg.add_coordinatereadout(uc)
# NOTE THAT (111) and (110) are in the wrong places in the figure in the text!

## Fig 7.11(b) as equal area proj
sg = ov.eaproj() # initialize the stereographic projection
sg.add_miller(vec2,uc) # add our lattice vectors to the projection
sg.add_millerlabels(vec2,uc)
sg.grid_spokes()
#
from matplotlib.font_manager import FontProperties
font=FontProperties()
font.set_size('large')
font.set_style('italic')
sg.add_eastlabel(fontproperties=font)
sg.add_southlabel(fontproperties=font)
sg.add_centerlabel(fontproperties=font)
sg.add_coordinatereadout(uc)
98 changes: 98 additions & 0 deletions bin/TESTS.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 11 11:18:08 2012

@author: epayton
"""

from ovlib import *
from numpy import array, pi

################################################################################

print "\n check that we can initialize"
print quat()
print tvec()
print bunge()
print rodri()


################################################################################
print '-----------------'
print "\n check that we can construct individual quaternions"

# check that we can construct with a single rotation given as a tuple
q1a=quat(0.6070,-0.7043,0.0634,-0.3627)
print q1a

# check that we can construct with a tuple of lists
q2a=quat([0.6070],[-0.7043],[0.0634],[-0.3627])
print q2a

# check that we can construct with an array
q3a=quat(array([0.6070]),array([-0.7043]),array([0.0634]),array([-0.3627]))
print q3a

################################################################################
print '-----------------'
print "\n check that we can construct multiple quaternions"

# check that we can construct with multiple rotations given as tuples
a=0.6070,0.9688
b=-0.7043,0.1176
c=0.0634,0.0263
d=-0.3627,0.2166
q1b=quat(a,b,c,d)
print q1b

# check that we can construct with multiple values in a tuple of lists
a=[0.6070,0.9688]
b=[-0.7043,0.1176]
c=[0.0634,0.0263]
d=[-0.3627,0.2166]
q2b=quat(a,b,c,d)
print q2b

# check that we can construct with a tuple of arrays
a=array([0.6070,0.9688])
b=array([-0.7043,0.1176])
c=array([0.0634,0.0263])
d=array([-0.3627,0.2166])
q3b=quat(a,b,c,d)
print q3b

################################################################################
print '-----------------'
print "\n check that we can convert quaternions to tvecs"

tq1=tvec.from_quat(q1a)
print tq1

tq2=tvec.from_quat(q1b)
print tq2

################################################################################
print '-----------------'
print "\n check that we can convert tvecs to quats"

qt1=quat.from_tvec(tq1)
print qt1

qt2=quat.from_tvec(tq2)
print qt2

################################################################################
print '-----------------'
print "\n check that we can convert Bunge Euler to quats"

be1=quat.from_bunge(bunge(phi1=pi,PHI=pi/7.,phi2=0.0))

################################################################################
print '-----------------'
print "\n check that we can get symmetries"

r1 = rotationelements('m-3m') # rotation symmetry elements
r2 = pointgroupelements('6/mmm') # point group elements
cs = rotsymm('m3') # rotational symmetry class
print cs

61 changes: 61 additions & 0 deletions bin/TEST_ROTATION-CONVENTIONS.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 04 17:05:51 2013

@author: epayton
"""

import ovlib as ov

uc = ov.unitcell()

# From Lecture notes for CMU 27-750, Fall 2009, "Analysis of EBSD Data (L17)"
# by B. El-Dasher, A.D. Rollett, G.S. Rohrer, P.N. Kalu, p. 35:
# "A simple test of the frames used for Euler angles is to have the softwares
# [sic] plot pole figures for a single orientation..."

'''
Check if Euler angles are working properly in passive convention
'''
pf = ov.stereoproj()
m = ov.miller(1,0,0)
pf.add_miller(m.rotate(ov.rmat.from_bunge(ov.bunge(0.2,0,0))), uc, uppermarkerfacecolor='r', lowermarkerfacecolor='r')
pf.add_miller(m, uc)

# the red marker should appear counterclockwise from the blue
m = ov.miller(0,0,1)
pf.add_miller(m.rotate(ov.rmat.from_bunge(ov.bunge(0.0,0.2,0))), uc, uppermarkerfacecolor='r', lowermarkerfacecolor='r')
pf.add_miller(m, uc)

'''
Check if ang/ax is working properly in passive convention
'''
pf = ov.stereoproj()
# the red marker should appear in same directions as above:
m = ov.miller(1,0,0)
pf.add_miller(m.rotate(ov.rmat.from_angax(ov.angax(0.2,0,0,1))), uc, uppermarkerfacecolor='r', lowermarkerfacecolor='r')
pf.add_miller(m, uc)
m = ov.miller(0,0,1)
pf.add_miller(m.rotate(ov.rmat.from_angax(ov.angax(0.2,1,0,0))), uc, uppermarkerfacecolor='r', lowermarkerfacecolor='r')
pf.add_miller(m, uc)

'''
Check if quat is working properly in passive convention
'''
# the red marker should appear in same directions as above:
pf = ov.stereoproj()
m = ov.miller(1,0,0)
pf.add_miller(m.rotate(ov.quat.from_angax(ov.angax(0.2,0,0,1))), uc, uppermarkerfacecolor='r', lowermarkerfacecolor='r')
pf.add_miller(m, uc)
m = ov.miller(0,0,1)
pf.add_miller(m.rotate(ov.quat.from_angax(ov.angax(0.2,1,0,0))), uc, uppermarkerfacecolor='r', lowermarkerfacecolor='r')
pf.add_miller(m, uc)

pf = ov.stereoproj()
m = ov.miller(1,0,0)
pf.add_miller(m.rotate(ov.quat.from_bunge(ov.bunge(0.2,0,0))), uc, uppermarkerfacecolor='r', lowermarkerfacecolor='r')
pf.add_miller(m, uc)
m = ov.miller(0,0,1)
pf.add_miller(m.rotate(ov.quat.from_bunge(ov.bunge(0,0.2,0))), uc, uppermarkerfacecolor='r', lowermarkerfacecolor='r')
pf.add_miller(m, uc)

Loading